我在将 MPG 文件转换为 AVI 文件时遇到问题。当我转换一个文件时,例如 520KB MPG 文件,我的程序生成了一个大约 112MB 的 AVI 文件并且该视频无法正常工作。什么会导致这种情况?
string path = "C:\\convert\\input.mpg"
string outputpath = "C:\\convert\\"+output+".avi";
string fileargs = "-i" + " " + path + " " + outputpath;
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "C:\\convert\\ffmpeg.exe";
p.StartInfo.Arguments = fileargs;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
p.WaitForExit();
最佳答案
我已将其用于 Quicktime 重新包装。不确定它在 AVI 上是否也能正常工作,但您可以试一试。
fileargs = String.Format("-i {0} -vcodec copy -acodec copy {1}", path, outputpath);
或者,如果这不起作用,您可以尝试:
fileargs = String.Format("-i {0} -vcodec copy -acodec pcm_s16le {1}", path, outputpath);
关于c# - 在 C# 中使用 ffmpeg.exe 将 MPG 转换为 AVI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4257344/