{"record":{"id":"42ae28dd71bd783d","repo":"subhra74/xdm","slug":"ffmpegnotfound","errorCode":"FFmpegNotFound","errorMessage":"ErrorCode.FFmpegNotFound","messagePattern":"ErrorCode\\.FFmpegNotFound","errorType":"error_code","errorClass":"AssembleFailedException","httpStatus":null,"severity":"error","filePath":"app/XDM/XDM.Core/Downloader/Progressive/SingleHttp/SingleSourceHTTPDownloader.cs","lineNumber":426,"sourceCode":"                        }\r\n\r\n                        if (this.cancelFlag.IsCancellationRequested) return;\r\n\r\n                        if (state!.ConvertToMp3)\r\n                        {\r\n                            if (mediaProcessor != null)\r\n                            {\r\n                                mediaProcessor.ProgressChanged += (s, e) =>\r\n                                {\r\n                                    var prg = 50 + e.Progress / 2;\r\n                                    if (prg > 100) prg = 100;\r\n                                    this.OnAssembleProgressChanged(prg);\r\n                                };\r\n                                var res = mediaProcessor.ConvertToMp3Audio(outFile!, TargetFile!,\r\n                                    this.cancelFlag, out totalBytes);\r\n                                if (res != MediaProcessingResult.Success)\r\n                                {\r\n                                    throw new AssembleFailedException(\r\n                                        res == MediaProcessingResult.AppNotFound ? ErrorCode.FFmpegNotFound :\r\n                                        ErrorCode.FFmpegError); //TODO: Add more info about error\r\n                                }\r\n\r\n                                if (Config.Instance.FetchServerTimeStamp)\r\n                                {\r\n                                    try\r\n                                    {\r\n                                        File.SetLastWriteTime(TargetFile, state.LastModified);\r\n                                    }\r\n                                    catch { }\r\n                                }\r\n                                this.totalSize = totalBytes;\r\n                            }\r\n                            else\r\n                            {\r\n                                throw new AssembleFailedException(ErrorCode.Generic); //TODO: Add more info about error\r\n                            }\r","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/subhra74/xdm/blob/1ca5a25aae007826c859c81bea494e7c102e1242/app/XDM/XDM.Core/Downloader/Progressive/SingleHttp/SingleSourceHTTPDownloader.cs#L408-L444","documentation":"After downloading, AssemblePieces may convert the file to MP3 audio via mediaProcessor.ConvertToMp3Audio. If the result is not MediaProcessingResult.Success, an AssembleFailedException is thrown with ErrorCode.FFmpegNotFound (when the ffmpeg executable was not found) or ErrorCode.FFmpegError for other processing failures.","triggerScenarios":"ConvertToMp3Audio returns MediaProcessingResult.AppNotFound because the ffmpeg/external media tool cannot be located on the system PATH or configured location while ConvertToMp3 is enabled in Config.","commonSituations":"ffmpeg not installed, installed but not on PATH, bundled ffmpeg missing after an app update, flatpak/snap confinement hiding the binary, wrong custom tool path configured in settings.","solutions":["Install ffmpeg and ensure it is on the system PATH (or set the configured ffmpeg path in settings).","Verify the exact executable path: run `ffmpeg -version` in a terminal as the same user running the downloader.","Disable ConvertToMp3 in Config.Instance if conversion is not required - the original file will be kept.","Reinstall/repair the app so its bundled media processor is restored."],"exampleFix":"// before\nconfig.ConvertToMp3 = true; // ffmpeg not installed -> FFmpegNotFound\n// after\nif (IsOnPath(\"ffmpeg\")) config.ConvertToMp3 = true;\nelse { InstallFfmpeg(); /* or */ config.ConvertToMp3 = false; }","handlingStrategy":"fallback","validationCode":"static bool FfmpegAvailable() {\n    try { var psi = new ProcessStartInfo(\"ffmpeg\", \"-version\") { UseShellExecute = false };\n          using var p = Process.Start(psi); return p != null; }\n    catch { return false; }\n}\n// before enabling: if (!FfmpegAvailable()) keepOriginalFileOnly = true;","typeGuard":null,"tryCatchPattern":"try { downloader.Resume(); }\ncatch (AssembleFailedException e) when (e.ErrorCode == ErrorCode.FFmpegNotFound) {\n    KeepOriginalFile(); // skip MP3 conversion\n    NotifyUser(\"Install ffmpeg for MP3 conversion\");\n}","preventionTips":["Install ffmpeg and confirm `ffmpeg -version` works for the app user","Point the app's custom tool path at a valid binary after upgrades","Disable ConvertToMp3 when ffmpeg is absent","Check sandboxed installs (snap/flatpak) can see the binary"],"tags":["ffmpeg","external-tool","audio-conversion"],"backgroundTag":"missing-dependency","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"}