{"record":{"id":"3622b0e2a9fb2818","repo":"nilaoda/N_m3u8DL-RE","slug":"resstring-ffmpegnotfound","errorCode":null,"errorMessage":"ResString.ffmpegNotFound","messagePattern":"ResString\\.ffmpegNotFound","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"src/N_m3u8DL-RE/Program.cs","lineNumber":135,"sourceCode":"\n        if (option.UseShakaPackager) \n        {\n            option.DecryptionEngine = DecryptEngine.SHAKA_PACKAGER;\n        }\n\n        // LivePipeMux开启时 LiveRealTimeMerge必须开启\n        if (option is { LivePipeMux: true, LiveRealTimeMerge: false })\n        {\n            Logger.WarnMarkUp(\"LivePipeMux detected, forced enable LiveRealTimeMerge\");\n            option.LiveRealTimeMerge = true;\n        }\n\n        // 预先检查ffmpeg\n        option.FFmpegBinaryPath ??= GlobalUtil.FindExecutable(\"ffmpeg\");\n\n        if (string.IsNullOrEmpty(option.FFmpegBinaryPath) || !File.Exists(option.FFmpegBinaryPath))\n        {\n            throw new FileNotFoundException(ResString.ffmpegNotFound);\n        }\n\n        Logger.Extra($\"ffmpeg => {option.FFmpegBinaryPath}\");\n\n        // 预先检查mkvmerge\n        if (option is { MuxOptions.UseMkvmerge: true, MuxAfterDone: true })\n        {\n            option.MkvmergeBinaryPath ??= GlobalUtil.FindExecutable(\"mkvmerge\");\n            if (string.IsNullOrEmpty(option.MkvmergeBinaryPath) || !File.Exists(option.MkvmergeBinaryPath))\n            {\n                throw new FileNotFoundException(ResString.mkvmergeNotFound);\n            }\n            Logger.Extra($\"mkvmerge => {option.MkvmergeBinaryPath}\");\n        }\n\n        // 预先检查\n        if (option.Keys is { Length: > 0 } || option.KeyTextFile != null)\n        {","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/nilaoda/N_m3u8DL-RE/blob/e113dee70c924ee08dae5460624909b04d84cb76/src/N_m3u8DL-RE/Program.cs#L117-L153","documentation":"DoWorkAsync pre-checks that an ffmpeg binary is available before doing work: it tries option.FFmpegBinaryPath, then GlobalUtil.FindExecutable(\"ffmpeg\") on PATH. If none resolves to an existing file it throws FileNotFoundException with the localized 'ffmpeg not found' resource string. Merging/muxing and some decryption paths require ffmpeg.","triggerScenarios":"ffmpeg is not installed, not on PATH, the custom --ffmpeg-binary-path points to a nonexistent file, or FFmpegBinaryPath was set to a bad value programmatically.","commonSituations":"Fresh systems/dockers without ffmpeg; Windows users who never added ffmpeg to PATH; typo'd custom binary path; renamed binaries.","solutions":["Install ffmpeg or place ffmpeg(.exe) on PATH","Pass the explicit binary location via --ffmpeg-binary-path (e.g. C:\\tools\\ffmpeg\\bin\\ffmpeg.exe)","Verify the path with: ffmpeg -version in a terminal","In Docker, use an image that includes ffmpeg or add it in the Dockerfile"],"exampleFix":"// before\nN_m3u8DL-RE \"URL\" -M\n// after (custom path)\nN_m3u8DL-RE \"URL\" -M --ffmpeg-binary-path \"/usr/local/bin/ffmpeg\"","handlingStrategy":"validation","validationCode":"var ffmpeg = GlobalUtil.FindExecutable(\"ffmpeg\");\nif (ffmpeg == null || !File.Exists(ffmpeg))\n    throw new FileNotFoundException(\"install ffmpeg or pass --ffmpeg-binary-path\");","typeGuard":"static bool FfmpegAvailable(CLIOptions o) => (o.FFmpegBinaryPath != null && File.Exists(o.FFmpegBinaryPath)) || GlobalUtil.FindExecutable(\"ffmpeg\") != null;","tryCatchPattern":"try { await DoWorkAsync(option); }\ncatch (FileNotFoundException ex) when (ex.FileName == null && ex.Message.Contains(\"ffmpeg\"))\n{\n    Console.Error.WriteLine(\"ffmpeg not found: install it or set --ffmpeg-binary-path\");\n}","preventionTips":["Install ffmpeg before first use and keep it on PATH","Pin the binary path via --ffmpeg-binary-path in scripts for reproducibility","Verify with `ffmpeg -version` in the same environment/user that runs the tool (PATH differs per user)"],"tags":["csharp","ffmpeg","dependency","muxing"],"backgroundTag":"command-not-found","analyzedSha":"e113dee70c924ee08dae5460624909b04d84cb76","analyzedAt":"2026-09-13T02:43:21.078Z","contentChangedAt":"2026-09-13T02:43:21.078Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}