{"record":{"id":"c494e31d9f0c5d73","repo":"subhra74/xdm","slug":"ffmpeg-process-could-not-be-started-process-start","errorCode":null,"errorMessage":"FFmpeg process could not be started - Process.Start","messagePattern":"FFmpeg process could not be started - Process\\.Start","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"app/XDM/XDM.Core/Downloader/MediaProcessor/FFmpegMediaProcessor.cs","lineNumber":108,"sourceCode":"                    FileName = file,\r\n                    UseShellExecute = false,\r\n                    CreateNoWindow = true\r\n                };\r\n\r\n#if NET5_0_OR_GREATER\r\n                foreach (var arg in args)\r\n                {\r\n                    pb.ArgumentList.Add(arg);\r\n                }\r\n#else\r\n                pb.Arguments = XDM.Compatibility.ProcessStartInfoHelper.ArgumentListToArgsString(args);\r\n#endif\r\n                pb.RedirectStandardOutput = true;\r\n\r\n                using var proc = Process.Start(pb);\r\n                if (proc == null)\r\n                {\r\n                    throw new Exception(\"FFmpeg process could not be started - Process.Start\");\r\n                }\r\n\r\n                proc.OutputDataReceived += (a, b) =>\r\n                {\r\n                    try\r\n                    {\r\n                        var line = b.Data;\r\n                        if (line != null)\r\n                        {\r\n                            Log.Debug(line);\r\n                            if (duration == 0.0)\r\n                            {\r\n                                var md = ParsingHelper.RxDuration.Match(line);\r\n                                var ret = ParsingHelper.ParseTime(md);\r\n                                if (ret > 0) duration = ret;\r\n                            }\r\n                            var mt = ParsingHelper.RxTime.Match(line);\r\n                            var ret2 = ParsingHelper.ParseTime(mt);\r","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/subhra74/xdm/blob/1ca5a25aae007826c859c81bea494e7c102e1242/app/XDM/XDM.Core/Downloader/MediaProcessor/FFmpegMediaProcessor.cs#L90-L126","documentation":"FFmpegMediaProcessor.ProcessMedia builds a ProcessStartInfo for the ffmpeg binary and calls Process.Start. If the OS returns a null Process (process creation failed at the Win32 level despite the path being found), XDM throws 'FFmpeg process could not be started - Process.Start'.","triggerScenarios":"Process.Start(pb) returns null during ProcessMedia, e.g. the ffmpeg path points to a non-executable file, a blocked/broken AV quarantine, or an OS-level CreateProcess failure.","commonSituations":"Antivirus quarantining or blocking ffmpeg.exe right after it was located; corrupt or replaced ffmpeg binary; insufficient permissions on the executable; working directory missing; on Linux, a non-executable ffmpeg file path.","solutions":["Verify the resolved ffmpeg path is a valid executable: run it manually from a terminal ('<path> -version')","Reinstall/restore the bundled ffmpeg binary; check antivirus quarantine logs and whitelist ffmpeg","Check file permissions/execute bits on the binary (especially Linux/macOS: chmod +x)","Wrap ProcessMedia startup in try/catch with a retry, and log the full Win32Exception for diagnosis"],"exampleFix":"// before\nusing var proc = Process.Start(pb);\nif (proc == null)\n    throw new Exception(\"FFmpeg process could not be started - Process.Start\");\n// after\nusing var proc = Process.Start(pb);\nif (proc == null)\n    throw new InvalidOperationException(\n        $\"FFmpeg process could not be started at '{pb.FileName}'. Verify the binary is executable and not blocked by antivirus.\");","handlingStrategy":"validation","validationCode":"// Verify the ffmpeg binary is startable before processing\nvar path = FFmpegMediaProcessor.FindFFmpegBinary();\nif (!File.Exists(path)) throw new FileNotFoundException(\"ffmpeg missing\", path);\nvar check = Process.Start(new ProcessStartInfo(path, \"-version\")\n    { UseShellExecute = false, RedirectStandardOutput = true });\nif (check == null) throw new InvalidOperationException($\"Cannot execute ffmpeg at {path}\");\ncheck.WaitForExit(5000);","typeGuard":null,"tryCatchPattern":"try\n{\n    processor.ProcessMedia(args);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"FFmpeg process could not be started\"))\n{\n    Log.Error(ex, \"ffmpeg failed to launch; check AV quarantine, execute permission, and binary integrity\");\n    FallBackToRawStream();\n}","preventionTips":["Whitelist the ffmpeg binary in antivirus/EDR software","Confirm '<ffmpeg-path> -version' runs manually before starting media processing","On Linux/macOS ensure the execute bit is set (chmod +x) on the resolved path","Keep the bundled ffmpeg intact across app updates and reinstall if corrupted"],"tags":["ffmpeg","process","media-processing","windows"],"backgroundTag":"command-not-found","analyzedSha":"1ca5a25aae007826c859c81bea494e7c102e1242","analyzedAt":"2026-09-13T20:37:40.968Z","contentChangedAt":"2026-09-13T20:37:40.968Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}