MathewSachin/Captura · error · FFmpegNotFoundException

FFmpeg could not be found. Please download using the in-buil

Error message

FFmpeg could not be found. Please download using the in-built downloader.

What it means

Thrown by the FFmpegAudioWriter constructor (src/Captura.FFmpeg/Audio/FFmpegAudioWriter.cs:16) when FFmpegService.FFmpegExists is false. FFmpegExists (src/Captura.FFmpeg/FFmpegService.cs:14-47) probes the configured folder, the app/lib directories, and finally runs `ffmpeg.exe -version` off PATH. Captura ships without an ffmpeg binary, so the encoder pipeline cannot start until one is present.

Source

Thrown at src/Captura.FFmpeg/Audio/FFmpegAudioWriter.cs:16

using Captura.Audio;
using System.Diagnostics;
using System.IO;

namespace Captura.FFmpeg
{
    class FFmpegAudioWriter : IAudioFileWriter
    {
        readonly Process _ffmpegProcess;
        readonly Stream _ffmpegIn;
        
        public FFmpegAudioWriter(string FileName, int AudioQuality, FFmpegAudioArgsProvider AudioArgsProvider, int Frequency = 44100, int Channels = 2)
        {
            if (!FFmpegService.FFmpegExists)
            {
                throw new FFmpegNotFoundException();
            }

            var argsBuilder  = new FFmpegArgsBuilder();

            argsBuilder.AddStdIn()
                .SetFormat("s16le")
                .SetAudioCodec("pcm_s16le")
                .SetAudioFrequency(Frequency)
                .SetAudioChannels(Channels)
                .DisableVideo();

            var output = argsBuilder.AddOutputFile(FileName);

            AudioArgsProvider(AudioQuality, output);

            _ffmpegProcess = FFmpegService.StartFFmpeg(argsBuilder.GetArgs(), FileName, out _);
            
            _ffmpegIn = _ffmpegProcess.StandardInput.BaseStream;

View on GitHub (pinned to 3fdf41529b)

Solutions

  1. Run the in-built FFmpeg downloader (DownloadFFmpeg) so ffmpeg.exe lands in the configured folder before any recording.
  2. Verify FFmpegSettings.GetFolderPath() points at a directory that actually contains ffmpeg.exe.
  3. Place ffmpeg.exe in the application or lib directory as a fallback.
  4. Add the folder containing ffmpeg.exe to the system PATH as a last resort.

Example fix

// before
var writer = new FFmpegAudioWriter(fileName, quality, argsProvider);
// after
if (!FFmpegService.FFmpegExists)
    throw new FFmpegNotFoundException(); // or trigger the downloader UI
var writer = new FFmpegAudioWriter(fileName, quality, argsProvider);
Defensive patterns

Strategy: validation

Validate before calling

// run before constructing FFmpegAudioWriter
if (!FFmpegService.FFmpegExists)
{
    // trigger the in-built downloader, then re-check
    await DownloadFFmpeg.Run();
}
if (!FFmpegService.FFmpegExists)
    throw new FFmpegNotFoundException();

Type guard

// static guarantee: prefer a factory that returns null when absent
static FFmpegAudioWriter CreateOrNull(string file, int q, FFmpegAudioArgsProvider p, int freq = 44100, int ch = 2)
    => FFmpegService.FFmpegExists ? new FFmpegAudioWriter(file, q, p, freq, ch) : null;

Try / catch

try { var w = new FFmpegAudioWriter(file, q, provider); }
catch (FFmpegNotFoundException) { /* prompt download, do not retry in a loop */ }

Prevention

When it happens

Trigger: Constructing FFmpegAudioWriter while no ffmpeg.exe exists in the settings folder, AppDir, LibDir, or PATH. FFmpegExists returning false (the PATH probe throws and is swallowed) is the sole trigger.

Common situations: First run of Captura before the built-in downloader has run; a user pointed the FFmpeg folder setting at the wrong directory; ffmpeg was uninstalled or the PATH entry removed; the folder setting holds a stale path from a portable install.

Related errors


AI-assisted analysis of MathewSachin/Captura@3fdf41529b (2026-08-13). Data as JSON: /api/errors/601fb55067cf2066. Report an issue: GitHub.