This is article is used to convert WMV files to FLV files.
For converting WMV files to FLV, there is a freely available utility out there called FFMPEG that you can use any server side scripting language to start and use via a command line call from the script itself. Best of all, it's less than a dozen lines of code to do it. Simply download and unzip the FFMPEG package and place it in the /bin of your .Net project. You may well be able to place it anywhere, I always use the /bin for dll files, executables and other such objects and process files. Then you set up your code to call it like any other process.
After the
processing is done, you have the original WMV, plus, a properly encoded FLV
file that can play in any FLV player, many which are available for free.
The code
is as follows, only requiring a little bit of editing to suit your system and
file structure:
string video
= @"D:\Projects\TestProject\Uploads\WMVVideos\video.wmv";
string mpg = @"D:\Projects\
TestProject \Uploads\Videos\video.flv";
string cmd = " -i
" + "" + video + " " + "
" + "" + mpg + "" + "";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = @"D:\Projects\
TestProject \bin\ffmpeg";
proc.StartInfo.Arguments = cmd;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start();
string video = @"D:\Projects\testapp\Uploads\videowmv.wmv";
string mpg = @"D:\Projects\testapp\Uploads\videoflv.flv";
string cmd = " -i " + ""
+ video + " " + " " + ""
+ mpg + "" + "";
System.Diagnostics.Process proc = new
System.Diagnostics.Process();
proc.StartInfo.FileName
= @"D:\Projects\Gastro\bin\ffmpeg";
proc.StartInfo.Arguments
= cmd;
proc.StartInfo.UseShellExecute
= false;
proc.StartInfo.CreateNoWindow
= true;
proc.StartInfo.RedirectStandardOutput
= false;
proc.Start();
Once this
simple bit of code is working, and you learn how to use the command line and
all it's proper variables, you can more finely tune your video encoding to the
size and quality you desire. It should also be noted that FFMPEG works with
converting MP3, MPG and many other media types, as stated in the FFMEG
documentation.
FFMPEG
comes with zip format 7z.
You can
down load the tool to unzip 7z format from here
You can
download FFMPEG from here: http://sourceforge.net/project/showfiles.php?group_id=205275&package_id=248632
There's a useful example
tutorial here: http://www.codeproject.com/KB/aspnet/Any_Video_to_FLV.aspx
FFMPEG documentation
here: http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html

Bebins VPosted May 5, 2015, 3:35 AM
File converted but it is returning only 0 kb file in converted folder...Any idea?
sathya kumarPosted May 3, 2011, 8:49 AM
hi surya, Can you give this article as a clear example coding. thanks,
Mahesh ChandPosted Feb 23, 2011, 12:43 PM
Thanks for sharing. I was wondering if you know how to convert FLV files to WMV files.