How to convert FLV to AVI video in Visual Basic and C# using SWF To Video SDK - ByteScout

How to convert FLV to AVI video in Visual Basic and C# using SWF To Video SDK

  • Home
  • /
  • Articles
  • /
  • How to convert FLV to AVI video in Visual Basic and C# using SWF To Video SDK

This sample shows how to convert FLV flash movie to lossless AVI video in Visual Basic and C# with Bytescout SWF To Video SDK.

The SDK provides set of methods and properties to convert flash movies to video (compressed with the selected video compression codec, one of the available on the computer).

Visual Basic

' x64 IMPORTANT NOTE: set CPU to x86 to build in x86 mode. WHY? Because flash is not supported on x64 platform currently at all

Imports System.Diagnostics
Imports BytescoutSWFToVideoLib

Class Program
	Friend Shared Sub Main(args As String())
		' 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"

		' 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 = "........video.flv"

        ' Set output AVI or WMV video file 
        converter.OutputVideoFileName = "result.avi"

		' Don't let it run infinitely
        converter.ConversionTimeOut = 3000 ' 3000ms = 3 seconds 

		' set FPS 
		converter.FPS = 29.97F

		' Set output movie dimensions 
		converter.OutputWidth = 320
		converter.OutputHeight = 240

		' Run conversion 
		converter.RunAndWait()

		' Open the result in default media player
        Process.Start("result.avi")
	End Sub
End Class       
      

C#

// x64 IMPORTANT NOTE: set CPU to x86 to build in x86 mode. WHY? Because flash is not supported on x64 platform currently at all

using System.Diagnostics;
using BytescoutSWFToVideoLib;

namespace FlvToAvi
{
	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";

			// 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 = "..\..\..\..\video.flv";

        	// set output AVI or WMV video filename
       		converter.OutputVideoFileName = "result.avi";
		
			// 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();

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

Tutorials:

prev
next