#region //运行mencoder的视频解码器转换
public string MChangeFilePhy(string vFileName, string playFile, string imgFile)
{
string tool = Server.MapPath(PublicMethod.mencodertool);
if ((!System.IO.File.Exists(tool)) || (!System.IO.File.Exists(vFileName)))
{
return "";
}
string flv_file = System.IO.Path.ChangeExtension(playFile, ".flv"); //截图的尺寸大小,配置在Web.Config中,如:<add key="CatchFlvImgSize" value="240x180" />
string FlvImgSize = PublicMethod.sizeOfImg;
System.Diagnostics.ProcessStartInfo FilestartInfo = new System.Diagnostics.ProcessStartInfo(tool);
FilestartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
FilestartInfo.Arguments = " " + vFileName + " -o " + flv_file + " -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=1000:mbd=2:mv0:trell:v4mv:cbp:last_pred=1:dia=-1:cmp=0:vb_strategy=1 -vf scale=" + widthOfFile + ":" + heightOfFile + " -ofps 12 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames";
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo = FilestartInfo;
//开始执行
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.Start();
int pCode = Convert.ToInt32(p.WaitForExit(99999999)); //*发生异常的地方,视频一旦超过4M*
pCode = p.ExitCode;
if (pCode == 0)
{ //截图
CatchImg(vFileName, imgFile);
}
p.Close();
p.Dispose();
return "";
}
#endregion
超过4M的视频就不能转码,也不可以截到图,发生以下异常,
{“p.BasePriority”引发了“System.InvalidOperationException”类型的异常 int
“p.ExitCode”引发了“System.InvalidOperationException”类型的异常 int
“p.ExitTime”引发了“System.InvalidOperationException”类型的异常 System.DateTime }
但不报错;请问高手怎样改才可以; 因为视频一般都大于4M,所以恳请高手帮帮忙.
public string MChangeFilePhy(string vFileName, string playFile, string imgFile)
{
string tool = Server.MapPath(PublicMethod.mencodertool);
if ((!System.IO.File.Exists(tool)) || (!System.IO.File.Exists(vFileName)))
{
return "";
}
string flv_file = System.IO.Path.ChangeExtension(playFile, ".flv"); //截图的尺寸大小,配置在Web.Config中,如:<add key="CatchFlvImgSize" value="240x180" />
string FlvImgSize = PublicMethod.sizeOfImg;
System.Diagnostics.ProcessStartInfo FilestartInfo = new System.Diagnostics.ProcessStartInfo(tool);
FilestartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
FilestartInfo.Arguments = " " + vFileName + " -o " + flv_file + " -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=1000:mbd=2:mv0:trell:v4mv:cbp:last_pred=1:dia=-1:cmp=0:vb_strategy=1 -vf scale=" + widthOfFile + ":" + heightOfFile + " -ofps 12 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames";
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo = FilestartInfo;
//开始执行
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.Start();
int pCode = Convert.ToInt32(p.WaitForExit(99999999)); //*发生异常的地方,视频一旦超过4M*
pCode = p.ExitCode;
if (pCode == 0)
{ //截图
CatchImg(vFileName, imgFile);
}
p.Close();
p.Dispose();
return "";
}
#endregion
超过4M的视频就不能转码,也不可以截到图,发生以下异常,
{“p.BasePriority”引发了“System.InvalidOperationException”类型的异常 int
“p.ExitCode”引发了“System.InvalidOperationException”类型的异常 int
“p.ExitTime”引发了“System.InvalidOperationException”类型的异常 System.DateTime }
但不报错;请问高手怎样改才可以; 因为视频一般都大于4M,所以恳请高手帮帮忙.
http://sourceforge.net/projects/mplayer-win32/files/MPlayer%20and%20MEncoder/revision%2032492/MPlayer-rtm-svn-32492.7z/download把最后一个参数
-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames
改成
-lavfopts format=flv