subhra74/xdm · error · FileNotFoundException

FFmpeg executable not found

Error message

FFmpeg executable not found

What it means

FindFFmpegBinary searches the bundled application directories and the system PATH (via PlatformHelper.FindExecutableFromSystemPath) for the ffmpeg executable. When neither location yields a path, it throws FileNotFoundException 'FFmpeg executable not found'. IsFFmpegInstalled uses this method to probe availability.

Solutions

  1. Install FFmpeg (winget install ffmpeg / apt install ffmpeg / brew install ffmpeg) so it is discoverable on PATH
  2. If you have ffmpeg elsewhere, add its directory to the system PATH environment variable and restart the app
  3. Verify the bundled ffmpeg files exist in the application folder; reinstall XDM if they were removed
  4. Confirm with 'ffmpeg -version' in a new terminal that the binary resolves before retrying

Example fix

// before
var ffmpeg = FFmpegMediaProcessor.FindFFmpegBinary(); // throws if missing
// after
if (!FFmpegMediaProcessor.IsFFmpegInstalled())
{
    Log.Warn("FFmpeg not found; prompting user to install FFmpeg or disabling muxing");
    DisableMuxingFeature();
    return;
}
var ffmpeg = FFmpegMediaProcessor.FindFFmpegBinary();
Defensive patterns

Strategy: fallback

Validate before calling

// Probe availability without triggering the exception
bool hasFFmpeg = FFmpegMediaProcessor.IsFFmpegInstalled();
if (!hasFFmpeg)
    Log.Warn("FFmpeg is not installed and not on PATH");

Try / catch

try
{
    ffmpegPath = FFmpegMediaProcessor.FindFFmpegBinary();
}
catch (FileNotFoundException)
{
    ffmpegPath = PromptUserForFFmpegPath(); // or disable muxing feature
}

Prevention

When it happens

Trigger: Calling FindFFmpegBinary (directly or via IsFFmpegInstalled/ProcessMedia's file lookup) when ffmpeg is neither shipped alongside the app nor installed in any PATH directory.

Common situations: FFmpeg was never installed; ffmpeg installed but not on PATH; PATH changed or the install was removed; bundled ffmpeg files deleted by antivirus or a partial update.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of subhra74/xdm@1ca5a25aae (2026-09-13). Data as JSON: /api/errors/2b189f0b88d99234. Report an issue: GitHub.

Appendix: source

Thrown at app/XDM/XDM.Core/Downloader/MediaProcessor/FFmpegMediaProcessor.cs:228

                    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");
        }

        public static bool IsFFmpegInstalled()
        {
            try
            {
                FindFFmpegBinary();
            }
            catch (FileNotFoundException)
            {
                return false;
            }
            return true;
        }
    }
}

View on GitHub (pinned to 1ca5a25aae)