星期一, 10月 01, 2007

將影片轉成FLV格式

source: http://ucsharp.wordpress.com/2007/07/25/c-and-ffmpeg/

/*
* 利用ffmpeg轉換格式
* p.s 先下載ffmpeg.exe,並放置指定位置
*/

private void MPG2FLV_Load(object sender, EventArgs e)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = @"C:\edgar\mediaHandler\ffmpeg\ffmpeg";
proc.StartInfo.Arguments = "-i C:\\edgar\\mediaHandler\\ffmpeg\\1.mpg -ar 22050 -ab 32 -f flv -s 320×240 -aspect 4:3 -y movie4.flv";

/* use /y to overwrite if there it exists already or will fail */

proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
proc.WaitForExit();
proc.Close();
}

沒有留言: