Ffmpeg不像在CMD中那样创建通过.NET运行的文件 [英] Ffmpeg not creating file running through .NET like when in CMD

查看:134
本文介绍了Ffmpeg不像在CMD中那样创建通过.NET运行的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个小项目,需要使用ffmpeg从主视频中提取一些视频。我在命令提示符下调用了以下内容,并在文件夹中正确命名了我的8秒视频:



I am working on a small project that needs to use ffmpeg to pull out some video from the main video. I have called the following within a command prompt and get my 8 second video named correctly in the folder:

ffmpeg -ss 00:47:25 -t 8 -i C:\\Personal\\TestData\\MainVideo.mp4 -vcodec copy -acodec copy C:\\Personal\\TestData\\Portion1.mp4





但是,当我尝试从Process.Start命令运行它时,它会打开看起来像命令提示符的内容,但不会保存文件。





However, when I try to run this from a Process.Start command it opens what looks like a command prompt, but doesn't save the file out.

var processn = Process.Start("CMD.exe", "/C ffmpeg -ss 00:47:25 -t 8 -i C:\\Personal\\TestData\\MainVideo.mp4 -vcodec copy -acodec copy C:\\Personal\\TestData\\Portion1.mp4");
                          processn.WaitForExit(50000);





我没有想法。

谢谢



我尝试了什么:



我已经完全访问了该文件夹中的所有人。

我试过直接调用ffmpeg.exe并只传入参数但没有成功。





I am out of ideas.
Thank you

What I have tried:

I have given full access to everyone on that folder.
I have tried calling the ffmpeg.exe directly and just pass in the parameter with no success.

var processStartInfo = new ProcessStartInfo(@"C:\FFmpeg\bin\ffmpeg.exe");
                        processStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                        processStartInfo.Arguments = $"/C -ss 00:47:25 -t 8 -i C:\\Personal\\TestData\\MainVideo1.mp4 -vcodec copy -acodec copy C:\\Personal\\TestData\\Portion1.mp4";
                        processStartInfo.UseShellExecute = false;
                        processStartInfo.CreateNoWindow = true;

                        var processn = Process.Start(processStartInfo);
                        processn.EnableRaisingEvents = true;
                        processn.WaitForExit();

推荐答案

/ C -ss 00:47:25 -t 8 -i C :\\Personal\\TestData \\ MainVideo1.mp4 -vcodec copy -acodec copy C:\\Personal\\TestData \\Portion1.mp4;
processStartInfo.UseShellExecute = false;
processStartInfo.CreateNoWindow = true;

var processn = Process.Start(processStartInfo);
processn.EnableRaisingEvents = true;
processn.WaitForExit();
"/C -ss 00:47:25 -t 8 -i C:\\Personal\\TestData\\MainVideo1.mp4 -vcodec copy -acodec copy C:\\Personal\\TestData\\Portion1.mp4"; processStartInfo.UseShellExecute = false; processStartInfo.CreateNoWindow = true; var processn = Process.Start(processStartInfo); processn.EnableRaisingEvents = true; processn.WaitForExit();


这就是我最终让它工作的原因



This is what I did to finally get it to work

var processStartInfo = new ProcessStartInfo(@"C:\FFmpeg\bin\ffmpeg.exe");
processStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
processStartInfo.Arguments =


@ - ss {startTime} -t 8 -i C:\ Personal\TestData \ MainVideo.mp4 -vcodec copy -acodec copy C:\Personal\TestData\Portion {计数器}的.mp4\" ;
processStartInfo.UseShellExecute = false;
processStartInfo.CreateNoWindow = true;
var processn = Process.Start(processStartInfo);
@"-ss {startTime} -t 8 -i C:\Personal\TestData\MainVideo.mp4 -vcodec copy -acodec copy C:\Personal\TestData\Portion{counter}.mp4"; processStartInfo.UseShellExecute = false; processStartInfo.CreateNoWindow = true; var processn = Process.Start(processStartInfo);


这篇关于Ffmpeg不像在CMD中那样创建通过.NET运行的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆