public static string FindFFmpegBinary() { var executableNames = Environment.OSVersion.Platform == PlatformID.Win32NT ? new string[] { "ffmpeg-x86.exe", "ffmpeg.exe" } : new string[] { "ffmpeg" }; foreach (var executableName in executableNames) { var path = Path.Combine(Config.DataDir, executableName); if (File.Exists(path)) { return(path); } path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, executableName); if (File.Exists(path)) { return(path); } var ffmpegPathEnvVar = Environment.GetEnvironmentVariable("FFMPEG_HOME"); //Log.Debug("FFMPEG_HOME: " + ffmpegPathEnvVar); if (ffmpegPathEnvVar != null) { path = Path.Combine(ffmpegPathEnvVar, executableName); if (File.Exists(path)) { return(path); } } path = PlatformHelper.FindExecutableFromSystemPath(executableName); if (path != null) { return(path); } } throw new FileNotFoundException("FFmpeg executable not found"); }