Skip to content

Report FFmpeg version and codec support in parler doctor #12

Description

@AbdelStark

Summary

Extend parler doctor to report the installed FFmpeg version and flag when video codec support may be limited. Right now the check only tests whether the ffmpeg binary is on PATH — it does not tell the user which version they have or whether common video codecs are available.

Background

parler uses FFmpeg to extract audio from video files (.mp4, .mkv, .mov, .avi, .ts). Users frequently hit issues because:

  • Their distro's FFmpeg build lacks certain codec libraries (e.g. libx264, aac)
  • The wrong FFmpeg is on PATH (e.g. a minimal build from a conda env)

Reporting the version in parler doctor makes these problems immediately visible without needing to process a real file.

What to implement

In parler/doctor.py, extend the existing FFmpeg check to also run ffmpeg -version and parse the first line:

# Current output
parler doctor
✓  FFmpeg       available

# Target output
parler doctor
✓  FFmpeg       7.1 (built with libx264, libopus, aac)
⚠  FFmpeg       3.4.8 — version is old, some video formats may fail

Specifically:

  1. Run ffmpeg -version (or ffprobe -version) via subprocess.run with capture_output=True
  2. Parse the version string from the first output line (e.g. ffmpeg version 7.1 Copyright ...)
  3. Include the version in the DoctorCheck.detail field
  4. Emit a warn status if the version is older than 4.0 (a reasonable baseline for codec support)
  5. If FFmpeg is not found, keep the existing fail status unchanged

JSON output (parler doctor --json) should include the version string in the relevant check's detail field — no schema change needed.

Files to look at

File What to understand
parler/doctor.py The DoctorCheck dataclass and existing FFmpeg check function
parler/audio/ffmpeg.py ffmpeg_available() — the current binary detection
tests/unit/test_cli_commands.pyTestOperationalCommands Existing doctor tests to follow

Acceptance criteria

  • parler doctor includes the FFmpeg version string in the FFmpeg check detail
  • When FFmpeg version < 4.0, status is warn with a hint about upgrading
  • When FFmpeg is missing, behaviour is unchanged (fail)
  • The --json output includes the version in the detail field of the FFmpeg check
  • New unit tests cover: version parsed correctly, old version triggers warn, missing ffmpeg still fails
  • ruff check and ruff format --check pass

Setting up

git clone https://github.com/AbdelStark/mistral-parler && cd mistral-parler
uv sync --locked --group dev
uv run parler doctor --json | python -m json.tool   # see current output shape

Tips for first-timers

  • Use subprocess.run(["ffmpeg", "-version"], capture_output=True, text=True) — wrap in try/except FileNotFoundError for the missing-binary case
  • The version line looks like: ffmpeg version 7.1-0ubuntu0.1 Copyright (c) 2000-2024 ...
  • Use a simple regex or str.split() to extract the version token; no need for packaging or semver libraries
  • Look at the existing _check_ffmpeg function in doctor.py to see how DoctorCheck objects are constructed

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ingestionAudio, video, and source ingestion pipelineenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions