Beispiel #1
0
        static void Main(string[] args)
        {
            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            //converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey  = "demo";

            // Set the converter to the live data conversion mode
            // (it will fully load the embedded video stream before the conversion)
            converter.SWFConversionMode = SWFConversionModeType.SWFWithLiveData;

            // set input SWF file
            converter.InputSWFFileName = "shapes.swf";

            // you may calculate output video duration using information about the the source swf movie
            // WARNING #1: this method to calculate the output video duration is not working for movies with dynamic scenes
            // and interactive scripts as in these movies it is not possible to calculate the precise duration of the movie
            // WARNING #2: you should set the input swf or flv filename (or url) before this calculation

            // So the movie duration is calculated as the following:
            // as swf frame count (number of frames in the swf) / movieFPS (frames per second defined in swf)
            // and then multiplied by 1000 (as we are setting the .ConverstionTimeout in milliseconds)
            // as the following (uncomment if you want to set the length of the output video to the same as the original swf)
            // or as the following source code (uncomment to enable):

            // converter.ConversionTimeout = 1000 * (converter.FrameCount / converter.MovieFPS)


            // set output AVI or WMV video filename
            converter.OutputVideoFileName = "result.webm";

            // Don't let it run infinitely
            converter.ConversionTimeOut = 15000;             // 15000ms = 15 seconds

            // set FPS
            converter.FPS = 29.97f;

            // Set output movie dimensions
            converter.OutputWidth  = 320;
            converter.OutputHeight = 240;

            // Run conversion
            converter.RunAndWait();

            // release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(converter);
            converter = null;


            // Open the result in default media player
            Process.Start("result.webm");
        }
        static void Main(string[] args)
        {
            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey  = "demo";

            // set input SWF file
            converter.InputSWFFileName = "HelloWorld.swf";

            // set output AVI video filename
            converter.OutputVideoFileName = "result.avi";

            // This property is for one-frame or endless SWF movies.
            // Will stop conversion after specified time (milliseconds).
            converter.ConversionTimeOut = 5000;             // 5000ms = 5s

            // you may calculate output video duration using information about the the source swf movie
            // WARNING #1: this method to calculate the output video duration is not working for movies with dynamic scenes
            // and interactive scripts as in these movies it is not possible to calculate the precise duration of the movie
            // WARNING #2: you should set the input swf or flv filename (or url) before this calculation

            // So the movie duration is calculated as the following:
            // as swf frame count (number of frames in the swf) / movieFPS (frames per second defined in swf)
            // and then multiplied by 1000 (as we are setting the .ConverstionTimeout in milliseconds)
            // as the following (uncomment if you want to set the length of the output video to the same as the original swf)
            // or as the following source code (uncomment to enable):

            // converter.ConversionTimeout = 1000 * (converter.FrameCount / converter.MovieFPS)


            // Set output movie dimensions
            converter.OutputWidth  = 640;
            converter.OutputHeight = 480;

            // Run conversion
            converter.RunAndWait();

            // release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(converter);
            converter = null;


            // Open the result movie in default media player
            Process.Start("result.avi");
        }
        static void Main(string[] args)
        {
            // Please make sure the Bytescout Lossless Video Codec is installed on the computer
            // Bytescout lossless video codec is available for free from
            // http://bytescout.com/lossless_video_codec_for_avi.html


            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            //converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey  = "demo";

            // Set empty video codec name to get the output video uncompressed
            converter.CurrentVideoCodecName = "bytescout lossless";

            // set input SWF file
            converter.InputSWFFileName = "Shapes.swf";

            // you may calculate output video duration using information about the the source swf movie
            // WARNING #1: this method to calculate the output video duration is not working for movies with dynamic scenes
            // and interactive scripts as in these movies it is not possible to calculate the precise duration of the movie
            // WARNING #2: you should set the input swf or flv filename (or url) before this calculation

            // So the movie duration is calculated as the following:
            // as swf frame count (number of frames in the swf) / movieFPS (frames per second defined in swf)
            // and then multiplied by 1000 (as we are setting the .ConverstionTimeout in milliseconds)
            // as the following (uncomment if you want to set the length of the output video to the same as the original swf)
            // or as the following source code (uncomment to enable):

            // converter.ConversionTimeout = 1000 * (converter.FrameCount / converter.MovieFPS)


            // set output AVI video filename
            converter.OutputVideoFileName = "result.avi";


            // Set output movie dimensions
            converter.OutputWidth  = 320;
            converter.OutputHeight = 240;

            // Run conversion
            converter.RunAndWait();

            // Open the result movie in default media player
            Process.Start("result.avi");
        }
        static void DoWork(object data)
        {
            int index = (int)data;

            try
            {
                Console.WriteLine("Thread {0} started...", index);

                // Create BytescoutImageToVideo.ImageToVideo object instance
                SWFToVideo converter = new SWFToVideo();

                // Activate the component
                converter.RegistrationName = "demo";
                converter.RegistrationKey  = "demo";

                converter.SWFConversionMode = SWFConversionModeType.SWFAnimation;

                // set input SWF file
                converter.InputSWFFileName = string.Format("movie{0}.swf", index);

                // Set output video file name
                converter.OutputVideoFileName = String.Format("result_{0}.wmv", index);

                // set FPS
                converter.FPS = 29.97f;

                // Set output video size
                converter.OutputWidth  = 640;
                converter.OutputHeight = 480;

                // Run the conversion
                converter.RunAndWait();

                // Release resources
                System.Runtime.InteropServices.Marshal.ReleaseComObject(converter);

                Console.WriteLine("Thread {0} finished.", index);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Thread {0} failed: {1}", index, ex.Message);
            }

            if (Interlocked.Decrement(ref _numBusy) == 0)
            {
                _doneEvent.Set();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            String inputSwfFile  = Server.MapPath("SlideShowWithEffects.swf");
            String outputAviFile = Path.GetTempPath() + "result.avi";

            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            //converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey  = "demo";

            // set input SWF file
            converter.InputSWFFileName = inputSwfFile;

            // set output AVI video filename
            converter.OutputVideoFileName = outputAviFile;

            // Set output movie dimensions
            converter.OutputWidth  = 640;
            converter.OutputHeight = 480;

            // Run conversion
            converter.RunAndWait();

            // release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(converter);
            converter = null;


            // Show filename of result file

            Response.Clear();
            Response.ContentType = "text/html";

            Response.Write("Result video file:  <b>" + outputAviFile + "</b>");

            Response.End();
        }
        static void Main(string[] args)
        {
            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            //converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey  = "demo";

            // set input SWF file
            converter.InputSWFFileName = "SlideShowWithEffects.swf";
            // set output AVI video filename
            converter.OutputVideoFileName = "result.avi";


            // Set background music
            converter.ExternalAudioTrackFromFileName = "bgmusic.mp3";
            // Set output audio codec
            converter.CurrentAudioCodecName = "ADPCM";

            // Set output movie dimensions
            converter.OutputWidth  = 640;
            converter.OutputHeight = 480;

            // Run conversion
            converter.RunAndWait();

            // release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(converter);
            converter = null;


            // Open the result movie in default media player
            Process.Start("result.avi");
        }