0

I'm calling FFmpeg via ProcessStartInfo inside my C# application however, I can't keep getting the error;

File for preset 'lossless_slow' not found

Here's my C# code;

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();
}

Now I've put my presets in the folder

C:\Users\wonea\ .ffmpeg

and included this in the Windows path user variable HOME. This works fine when running FFmpeg from the command line, however fails when the commands are issued inside my C# application, why!? Thanks for any help...!

Also of note, I'm running the service as "Network Service".

wonea
  • 4,783
  • 17
  • 86
  • 139
  • > file for preset lossless_slow ... Do you know if/where that file exists in the ffmpeg dir heirarchy? Does it require an additional dir-path in your PATH? Good luck! – shellter May 19 '11 at 15:34

2 Answers2

0

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?

burgersmoke
  • 1,031
  • 10
  • 6
0

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.

rupello
  • 8,361
  • 2
  • 37
  • 34
  • Thanks, I realised it was looking for C:\.FFmpeg\.FFmpeg\ bizarre but Procmon highlighted the problem. – wonea May 20 '11 at 14:04