问题描述:

I am trying to convert one flv video to mp4 video. Why this

following code results error? it gives exception as "No process is

associated with this object." The parameters

"Path_FFMPEG"="E:\\Arun Kumar\\Main Project\\Advertisement Demo\\Advertisementdemo\\Advertisementdemo\\ffmpeg\\bin\\ffmpeg.exe" and "strParam"="-i E:\\Arun Kumar\\Main Project\\Advertisement Demo\\Advertisementdemo\\Advertisementdemo\\Videos\\cars1.flv -same_quant E:\\Arun Kumar\\Main Project\\Advertisement Demo\\Advertisementdemo\\Advertisementdemo\\Videos\\ConvertedFiles\\cars1.mp4"

Process ffmpeg = new Process();

ProcessStartInfo ffmpeg_StartInfo = new ProcessStartInfo(Path_FFMPEG, strParam);

ffmpeg_StartInfo.UseShellExecute = false;

ffmpeg_StartInfo.RedirectStandardError = true;

ffmpeg_StartInfo.RedirectStandardOutput = true;

ffmpeg.StartInfo = ffmpeg_StartInfo;

ffmpeg_StartInfo.CreateNoWindow = true;

ffmpeg.EnableRaisingEvents = true;

ffmpeg.Start();

ffmpeg.WaitForExit();

ffmpeg.Close();

ffmpeg.Dispose();

ffmpeg = null;

网友答案:

try this code (assuming your mp4 is named video):

    System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = //PHYSICAL path to ffmpeg (use \\ instead of \);
proc.StartInfo.Arguments = "-i video.flv video.mp4
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start();
proc.WaitForExit();
proc.Close();
相关阅读:
Top