How to Convert One-Frame SWF to AVI Video Using SWF To Video SDK

  • Home
  • /
  • Articles
  • /
  • How to Convert One-Frame SWF to AVI Video Using SWF To Video SDK
This example shows how .ConversionTimeOut property of the SDK can be used to convert one-frame or endless SWF flash movie to AVI video file.

.ConversionTimeOut property allows you to control the length of the video to be converted. If you have infinitely looped or one-frame SWF movie, you can set needed duration in milliseconds with .ConversionTimeOut property.

Visual Basic .NET

Imports BytescoutSWFToVideoLib

Module Module1

    Sub Main()

        ' Create an instance of SWFToVideo ActiveX object
        Dim converter As New SWFToVideo()

        ' Set debug log
        'converter.SetLogFile("log.txt")

        ' Register SWFToVideo
        converter.RegistrationName = "demo"

        converter.RegistrationKey = "demo"

        ' Add SWF file and set its output filename
        converter.SetMovie("HelloWorld.swf", "result.avi")

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

        ' Set output movie dimensions
        converter.OutputWidth = 640
        converter.OutputHeight = 480

        ' Run conversion
        converter.RunAndWait()

        ' Open the result movie in default media player
        Process.Start("result.avi")

    End Sub

End Module
Visual C#

using System.Diagnostics;

using BytescoutSWFToVideoLib;

namespace VideoLengthSetting
{
    class Program
    {

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

            // Add SWF file and set its output filename
            converter.SetMovie("HelloWorld.swf", "result.avi");

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

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

            // Run conversion
            converter.RunAndWait();

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

        }
    }
}
prev
next