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 input SWF file
            converter.InputSWFFileName = "Shapes.swf";

            // Enable trasparency
            converter.RGBAMode = true;

            // Extract all frames to .\Output sub-folder
            converter.ConvertAllToPNG(".\\Output");

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


            // Open the first extracted frame in default application
            Process.Start("frame0.png");
        }
        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";

            // Enable trasparency - set BEFORE setting swf filename
            converter.RGBAMode = true;

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

            // Select 20th frame
            converter.StartFrame = 20;
            converter.StopFrame  = 20;

            // Run conversion
            converter.ConvertToPNG("result.png");

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


            // Open the result in default application
            Process.Start("result.png");
        }
        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";

            // Enable trasparency - BEFORE setting input file
            converter.RGBAMode = true;

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


            // Select 20th frame
            converter.StartFrame = 20;
            converter.StopFrame  = 20;

            // Run conversion
            converter.ConvertToPNG("result.png");

            // Open the result in default application
            Process.Start("result.png");
        }
Beispiel #4
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");
        }
Beispiel #7
0
        /*
         * IF YOU SEE TEMPORARY FOLDER ACCESS ERRORS:
         *
         * Temporary folder access is required for web application when you use ByteScout SDK in it.
         * If you are getting errors related to the access to temporary folder like "Access to the path 'C:\Windows\TEMP\... is denied" then you need to add permission for this temporary folder to make ByteScout SDK working on that machine and IIS configuration because ByteScout SDK requires access to temp folder to cache some of its data for more efficient work.
         *
         * SOLUTION:
         *
         * If your IIS Application Pool has "Load User Profile" option enabled the IIS provides access to user's temp folder. Check user's temporary folder
         *
         * If you are running Web Application under an impersonated account or IIS_IUSRS group, IIS may redirect all requests into separate temp folder like "c:\temp\".
         *
         * In this case
         * - check the User or User Group your web application is running under
         * - then add permissions for this User or User Group to read and write into that temp folder (c:\temp or c:\windows\temp\ folder)
         * - restart your web application and try again
         *
         */

        protected void Page_Load(object sender, EventArgs e)
        {
            String inputSwfFile = Server.MapPath("Shapes.swf");

            // 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";


            // Enable trasparency - set BEFORE setting SWF filename
            converter.RGBAMode = true;

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


            // Select the frame to extract (20th)
            converter.StartFrame = 20;
            converter.StopFrame  = 20;

            // Run conversion.
            // Empty parameter means conversion to binary stream instead of file.
            converter.ConvertToPNG("");

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


            // Display the extracted image:

            Response.Clear();
            // Add content type header
            Response.ContentType = "image/png";
            // Set the content disposition
            Response.AddHeader("Content-Disposition", "inline;filename=result.png");

            // Write the image bytes into the Response output stream
            Response.BinaryWrite((byte[])converter.BinaryImage);

            Response.End();
        }
        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();
            }
        }
        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";

            // Enable trasparency - set BEFORE setting swf filename
            converter.RGBAMode = true;

            // 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)


            // Select 20th frame
            converter.StartFrame = 20;
            converter.StopFrame  = 20;

            // Run conversion
            converter.ConvertToPNG("result.png");

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


            // Open the result in default application
            Process.Start("result.png");
        }
        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();
        }
Beispiel #11
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;

            // Add SWF file
            converter.InputSWFFileName = "http://bytescout.com/demo/swfscout_VideoSample.swf";

            // Enable trasparency
            converter.RGBAMode = true;

            // Select 20th frame
            converter.StartFrame = 20;
            converter.StopFrame  = 20;
            // Save it to file
            converter.ConvertToPNG("frame20.png");

            // Select 50th frame
            converter.StartFrame = 50;
            converter.StopFrame  = 50;
            // Save it to file
            converter.ConvertToPNG("frame50.png");

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


            // Open the result in default media player
            Process.Start("frame20.png");
        }
        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");
        }
        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 a value for the variable
            // (!) You should call SetVariable() before SetMovie()
            converter.SetVariable("Variable1", "hi this is passed variable");

            // Enable trasparency - BEFORE setting input SWF file
            converter.RGBAMode = true;

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

            // Select first frame
            converter.StartFrame = 0;
            converter.StopFrame  = 0;

            // Run conversion
            converter.ConvertToPNG("result.png");

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


            // Open the result in default application
            Process.Start("result.png");
        }
        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";

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

            // Don't let it run infinitely
            converter.ConversionTimeOut = 5000;             // 5000ms = 5 seconds

            // set FPS
            converter.FPS = 29.97f;

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

            // Run the conversion
            converter.Run();

            // Show conversion progress:

            int i = 0;

            char[] spin = new char[] { '|', '/', '-', '\\' };

            while (!Console.KeyAvailable && converter.IsRunning)
            {
                float progress = converter.ConversionProgress;
                Console.WriteLine(String.Format("Converting images {0}% {1}", progress, spin[i++]));
                Console.CursorTop--;
                i %= 4;
                Thread.Sleep(50);
            }

            if (converter.IsRunning)
            {
                converter.Stop();
                Console.WriteLine("Conversion aborted by user.");
            }
            else
            {
                Console.WriteLine("Conversion competed successfully.");
            }

            // Open the result in default media player
            Process.Start("result.wmv");

            Console.WriteLine();
            Console.WriteLine("Hit any key...");
            Console.ReadKey();
        }