In this topic, we’ll see how easy it is to convert a Flash movie into an FLV file. We have an input SWF file (SimpleMovie.swf) and we’re going to convert it to FLV (SimpleMovie.FLV). Aspose.Flash provides a single method named RenderToFlv which does the magic. This method is provided by FlashContainer class.
In this example, we’ll learn how FlashContainer class is used to load a Flash movie and then call RenderToFlv method to convert the loaded SWF file into an FLV file. This output FLV file can be played using any FLV Player. You can download some free FLV Player from the internet.
[C#]
//create a flash container to load flash movie
FlashContainer container = new FlashContainer("SimpleMovie.swf");
//create a file stream to hold and create an FLV file
Stream outStream = new FileStream("SimpleMovie.flv", FileMode.Create);
//call RenderToFLV method to conver SWF to FLV
container.RenderToFlv(outStream);
//clear buffer for this stream
outStream.Flush();
//close the output stream
outStream.Close();
[VB.NET]
'create a flash container to load flash movie
Dim container As New FlashContainer("SimpleMovie.swf")
'create a file stream to hold and create an FLV file
Dim outStream As Stream = New FileStream("SimpleMovie.flv", FileMode.Create)
'call RenderToFLV method to conver SWF to FLV
container.RenderToFlv(outStream)
'clear buffer for this stream
outStream.Flush()
'close the output stream
outStream.Close()