문제

C # 응용 프로그램 내에서 ProcessStartInfo를 통해 FFMPEG를 호출하지만 오류를 계속 사용할 수 없습니다.

사전 설정된 'foresless_slow'를위한 파일이 아닙니다. 발견

여기 내 C # 코드가 있습니다.

var processinfo = new ProcessStartInfo();
processinfo.FileName = "FFmpeg\\bin\\ffmpeg.exe";
processinfo.Arguments = "-i C:\Temp\input.mp4 -y -acodec aac -strict experimental -ab 96k -vcodec libx264 -vpre lossless_slow -crf 22 -threads 0 C:\Temp\output.mp4"
processinfo.RedirectStandardOutput = true;
processinfo.RedirectStandardError = true;
processinfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
processinfo.UseShellExecute = false;
processinfo.LoadUserProfile = true;
processinfo.EnvironmentVariables.Add("HOME", @"C:\Users\wonea\.ffmpeg");

var reg = System.Diagnostics.Process.Start(processinfo);

string output = string.Empty;
string error = string.Empty;

using (System.IO.StreamReader myOutput = reg.StandardOutput)
{
    output = myOutput.ReadToEnd();
}
using (System.IO.StreamReader myError = reg.StandardError)
{
    error = myError.ReadToEnd();
}
.

이제 폴더에 사전 설정을 폴더에 넣었습니다.

c : \ users \ wonea \ .ffmpeg

및 Windows 경로 사용자 변수 홈 에이 작업을 포함합니다.이는 명령 줄에서 ffmpeg를 실행할 때는 잘 작동하지만 명령이 내 C # 응용 프로그램 내부에서 발행 될 때 실패합니다!어떤 도움을 주셔서 감사합니다 ...!

또한 메모를 통해 서비스를 "네트워크 서비스"로 실행 중입니다.

도움이 되었습니까?

해결책

In situations like this I always start up the procmon tool which can show you all the file operations of your application. You can set up a filter based on the name of the preset file and see where ffmpeg is trying to locate it.

다른 팁

Setting the HOME variable looks good here.

The only thing I see is that in the code you set HOME to be @"C:\Users\wonea.ffmpeg" and in the text you mention the file is at : C:\Users\wonea.ffmpeg

Is one of these a typo?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top