c# - ffmpeg c#asp视频转换

标签 c# asp.net video ffmpeg

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;

最佳答案

试试这个代码(假设你的 mp4 被命名为 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();

关于c# - ffmpeg c#asp视频转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10443700/

相关文章:

c# - MVC3 View : Handling null models with finesse

html - 如何阻止JWPlayer在视频结束时变黑

python - 使 Python 中的 GStreamer 视频/音频流畅和循环

c# - 如何修改sql server中的xml节点

c# - 不返回代码标记属性? (__attribute__ ((noreturn)))

c# - 如何在 ASP.Net Core 2.x 的 Action Filter 中获取配置、Cookie 和 DBContext

c# - 从 ASP.NET C# 类页面实例化 C# 类

performance - 自动播放 YouTube 视频而不减慢页面加载时间

c# - MVC C# 阻止普通用户访问管理控制 URL - 无角色

c# - 寻找一种 Android 解决方案来阻止单击选项卡更改为新页面