{"record":{"id":"9fa225a1c2b611a7","repo":"nilaoda/N_m3u8DL-RE","slug":"resstring-mkvmergenotfound","errorCode":null,"errorMessage":"ResString.mkvmergeNotFound","messagePattern":"ResString\\.mkvmergeNotFound","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"src/N_m3u8DL-RE/Program.cs","lineNumber":146,"sourceCode":"        }\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        {\n            if (!string.IsNullOrEmpty(option.DecryptionBinaryPath) && !File.Exists(option.DecryptionBinaryPath))\n            {\n                throw new FileNotFoundException(option.DecryptionBinaryPath);\n            }\n            switch (option.DecryptionEngine)\n            {\n                case DecryptEngine.SHAKA_PACKAGER:\n                {\n                    var file = FindShakaPackager();\n                    if (file == null) throw new FileNotFoundException(ResString.shakaPackagerNotFound);\n                    option.DecryptionBinaryPath = file;","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/nilaoda/N_m3u8DL-RE/blob/e113dee70c924ee08dae5460624909b04d84cb76/src/N_m3u8DL-RE/Program.cs#L128-L164","documentation":"When --use-mkvmerge is combined with --mux-after-done, DoWorkAsync requires the mkvmerge binary. It falls back to GlobalUtil.FindExecutable(\"mkvmerge\") and throws FileNotFoundException with the localized resource string if mkvmerge cannot be located on disk.","triggerScenarios":"Running with --mux-after-done --use-mkvmerge while mkvmerge (from MKVToolNix) is not installed, not on PATH, or --mkvmerge-binary-path points to a missing file.","commonSituations":"Users choosing mkvmerge muxing without MKVToolNix installed; Windows PATH not including MKVToolNix install dir; typo in custom binary path.","solutions":["Install MKVToolNix so mkvmerge is on PATH","Pass --mkvmerge-binary-path with the full path to mkvmerge","Verify with: mkvmerge --version","Drop --use-mkvmerge to use the default ffmpeg muxer instead"],"exampleFix":"// before\nN_m3u8DL-RE \"URL\" -M --use-mkvmerge\n// after\nN_m3u8DL-RE \"URL\" -M --use-mkvmerge --mkvmerge-binary-path \"/usr/bin/mkvmerge\"","handlingStrategy":"validation","validationCode":"if (useMkvmerge && muxAfterDone)\n{\n    var mkv = GlobalUtil.FindExecutable(\"mkvmerge\");\n    if (mkv == null || !File.Exists(mkv)) throw new FileNotFoundException(\"install MKVToolNix or pass --mkvmerge-binary-path\");\n}","typeGuard":"static bool MkvmergeAvailable(CLIOptions o) => !o.MuxOptions.UseMkvmerge || (o.MkvmergeBinaryPath != null && File.Exists(o.MkvmergeBinaryPath)) || GlobalUtil.FindExecutable(\"mkvmerge\") != null;","tryCatchPattern":"try { await DoWorkAsync(option); }\ncatch (FileNotFoundException ex) when (ex.Message.Contains(\"mkvmerge\"))\n{\n    Console.Error.WriteLine(\"mkvmerge not found: install MKVToolNix or set --mkvmerge-binary-path\");\n}","preventionTips":["Install MKVToolNix alongside ffmpeg on machines used for muxing","On Windows, add the MKVToolNix install directory to PATH","Verify with `mkvmerge --version` before long batch runs"],"tags":["csharp","mkvmerge","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"}