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

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

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

This example demonstrates how to convert FLV flash movie to WMV video in Visual Basic and C# with Bytescout SWF To Video SDK.

The SDK supports Windows Media Video (WMV) as output video format and allows to convert both SWF and FLV to WMV video.

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.wmv"

		' 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.wmv")
	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 FlvToWmv
{
	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.wmv";
		
			// 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.wmv");
		}
	}
}

Tutorials:

prev
next