MathewSachin/Captura · error · FFmpegException

An Error Occurred with FFmpeg, Exit Code: {ExitCode}.\nSee F

Error message

An Error Occurred with FFmpeg, Exit Code: {ExitCode}.\nSee FFmpeg Log for more info.

What it means

Thrown by FFmpegGifConverter.StartAsync (src/Captura.FFmpeg/Video/FFmpegGifConverter.cs:37) after process.WaitForExit() when exit code is non-zero. The command uses a fixed filter_complex graph `split -> palettegen -> paletteuse`, which is the most failure-prone part: it requires a decodable video input and a single video stream.

Source

Thrown at src/Captura.FFmpeg/Video/FFmpegGifConverter.cs:37

            }

            var argsBuilder = new FFmpegArgsBuilder();

            argsBuilder.AddInputFile(Args.InputFile);

            const string filter = "\"[0:v] split [a][b];[a] palettegen [p];[b][p] paletteuse\"";

            argsBuilder.AddOutputFile(Args.FileName)
                .AddArg("filter_complex", filter)
                .SetFrameRate(Args.FrameRate);

            var process = FFmpegService.StartFFmpeg(argsBuilder.GetArgs(), Args.FileName, out var log);
            log.ProgressChanged += Progress.Report;

            await Task.Run(() => process.WaitForExit());

            if (process.ExitCode != 0)
                throw new FFmpegException(process.ExitCode);

            Progress.Report(100);
        }
    }
}

View on GitHub (pinned to 3fdf41529b)

Solutions

  1. Confirm Args.InputFile is a playable video file (ffprobe reports a video stream).
  2. Reproduce the exact command (with the filter_complex string) in a terminal to read the stderr directly.
  3. Use an ffmpeg build that includes the palette filters (standard zeranoe/BTBK builds do).
  4. Inspect the IFFmpegLogRepository entry for Args.FileName.

Example fix

// before
await converter.StartAsync(args, progress);
// after - validate input is decodable video first
if (!await HasVideoStream(args.InputFile))
    throw new InvalidOperationException("Input has no video stream");
await converter.StartAsync(args, progress);
Defensive patterns

Strategy: validation

Validate before calling

// confirm InputFile has a decodable video stream before invoking the converter
if (!await HasVideoStream(Args.InputFile))
    throw new InvalidOperationException("Input has no decodable video stream");
// HasVideoStream can shell out to ffprobe or use FFmpegService to run a quick probe

Try / catch

try { await converter.StartAsync(args, progress); }
catch (FFmpegException e) { /* read log for Args.FileName, show ffmpeg stderr */ }

Prevention

When it happens

Trigger: ffmpeg exits non-zero while applying the palettegen/paletteuse filter graph. Typical causes: input file not a video, input has no video stream, unsupported input codec, or an ffmpeg build without the required filters.

Common situations: User points the converter at a corrupted or audio-only file; the input is an unusual codec this ffmpeg cannot decode; a minimal/static ffmpeg build lacks palettegen/paletteuse filters.

Related errors


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