Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
关于ProcessStartInfo的ffmpeg c#asp.net帮助_C#_Asp.net_Video_Ffmpeg - Fatal编程技术网

关于ProcessStartInfo的ffmpeg c#asp.net帮助

关于ProcessStartInfo的ffmpeg c#asp.net帮助,c#,asp.net,video,ffmpeg,C#,Asp.net,Video,Ffmpeg,我编写了使用ffmpeg在c#asp.net中转换文件的代码。执行时,它会将错误显示为“文件名、目录名或卷标语法不正确”,但我的路径是正确的。那么解决这个问题的办法是什么呢 ProcessStartInfo info = new ProcessStartInfo("e:\ffmpeg\bin\ffmpeg.exe", "-i cars1.flv -same_quant intermediate1.mpg"); process.Start(); 我尝试了另一种方法,如下所示。但这也是行不通的

我编写了使用ffmpeg在c#asp.net中转换文件的代码。执行时,它会将错误显示为“文件名、目录名或卷标语法不正确”,但我的路径是正确的。那么解决这个问题的办法是什么呢

ProcessStartInfo info = new ProcessStartInfo("e:\ffmpeg\bin\ffmpeg.exe", "-i cars1.flv -same_quant intermediate1.mpg");

process.Start();
我尝试了另一种方法,如下所示。但这也是行不通的

ProcessStartInfo info = new ProcessStartInfo("ffmpeg.exe", "-i cars1.flv -same_quant intermediate1.mpg");
请帮助我使用c#asp.net中的ffmpeg将一种视频文件格式转换为另一种格式的示例代码。提前感谢。

路径中的反斜杠(
\
)视为开始。要防止出现这种情况,请使用双反斜杠(
\\
),或在字符串前面加上
@

ProcessStartInfo info = new ProcessStartInfo("e:\\ffmpeg\\bin\\ffmpeg.exe", 
                         "-i cars1.flv -same_quant intermediate1.mpg");
或:


有可用的包装器库

也指

谢谢


Deepu

您需要在路径中使用反斜杠。请参见下文,这是我如何使用ffmpeg.exe创建视频的

        string sConverterPath = @"C:\ffmpeg.exe";
        string sConverterArguments = @" -i ";
        sConverterArguments += "\"" + sAVIFile + "\"";
        sConverterArguments += " -s " + iVideoWidth.ToString() + "x" + iVideoHeight.ToString() + " ";
        sConverterArguments += " -b " + iVideoBitRate.ToString() + "k -ab " + iAudioBitRate.ToString() + "k -ac 1 -ar 44100 -r 24 -absf remove_extra ";
        sConverterArguments += "\"" + sOutputFile + "\"";


        Process oProcess = new Process();
        oProcess.StartInfo.UseShellExecute = true;
        oProcess.StartInfo.Arguments = sConverterArguments;
        oProcess.StartInfo.FileName = sConverterPath;

是的。。问题解决了。谢谢你,伙计。但是我需要更多的帮助。现在我的异常包含以下消息“StandardOut尚未重定向或进程尚未启动”。请参阅ffmpeg中我的另一个问题。我发布所有代码。告诉我有什么变化。
    string apppath = Request.PhysicalApplicationPath; 

    string outf = Server.MapPath(".");

    string fileargs = "-i" + " " + "\"C:/file.mp4 \"" + " " + "\"C:/files/test.flv \"";

    Process myProcess = new Process();

    myProcess.StartInfo.FileName = Server.MapPath(".")+"//ffmpeg.exe";

    myProcess.StartInfo.Arguments = fileargs;

    myProcess.StartInfo.UseShellExecute = false;

    myProcess.StartInfo.CreateNoWindow = false;

    myProcess.StartInfo.RedirectStandardOutput = false;

    myProcess.Start();

    myProcess.WaitForExit(50 * 1000);
        string sConverterPath = @"C:\ffmpeg.exe";
        string sConverterArguments = @" -i ";
        sConverterArguments += "\"" + sAVIFile + "\"";
        sConverterArguments += " -s " + iVideoWidth.ToString() + "x" + iVideoHeight.ToString() + " ";
        sConverterArguments += " -b " + iVideoBitRate.ToString() + "k -ab " + iAudioBitRate.ToString() + "k -ac 1 -ar 44100 -r 24 -absf remove_extra ";
        sConverterArguments += "\"" + sOutputFile + "\"";


        Process oProcess = new Process();
        oProcess.StartInfo.UseShellExecute = true;
        oProcess.StartInfo.Arguments = sConverterArguments;
        oProcess.StartInfo.FileName = sConverterPath;