Skip to main content

CLI tool for encoding videos with ffmpeg and scoring quality with VMAF

Project description

ffvm

A CLI tool for encoding videos with ffmpeg and scoring quality with VMAF. Supports single files, batch processing, and automatic CRF sweeping to hit a target VMAF score.

Installation

Requires ffmpeg (built with libvmaf) and ffprobe in PATH.

pip install ffvm

Commands

encode

Encode a single video file.

ffvm encode input.mp4 output.mp4 --vcodec libx265 --crf 28

Options:

  • --vcodec — Video codec: copy, libx264, libx265, libsvtav1 (default: libx264)
  • --crf — Constant Rate Factor (default: 23)
  • --acodec — Audio codec: copy, aac, libopus (default: copy)
  • --ab — Audio bitrate, e.g. 160k
  • --resolution — Output resolution, e.g. 1920x1080
  • --compare — Run VMAF comparison after encoding

batch

Encode all videos in a directory.

ffvm batch ./videos --vcodec libsvtav1 --crf 30 --compare

Output files are named {original}_{codec}_{crf}.{ext}. Additional options:

  • --output-dir — Write encoded files to a different directory
  • --recursive — Search subdirectories for videos
  • --overwrite — Skip overwrite confirmations
  • --compare — Run VMAF on each encode and display a results table

sweep

Find the optimal CRF for a video using binary search against a VMAF target. Extracts representative segments, tests CRF values, and encodes the full video at the best CRF found.

ffvm sweep input.mp4 output.mp4 --target-vmaf 95.0 --crf-min 20 --crf-max 35

Options:

  • --target-vmaf — Target VMAF score (default: 93.0)
  • --crf-min — Lower bound of CRF search range (default: 23)
  • --crf-max — Upper bound of CRF search range (default: 32)

batch-sweep

Run CRF sweep on every video in a directory. Each video gets its own optimal CRF.

ffvm batch-sweep ./videos --vcodec libsvtav1 --target-vmaf 95.0

How sweep works

  1. Extracts 1-7 short segments (scaled by video length) from the middle 80% of the video
  2. Binary searches through the CRF range, encoding and VMAF-scoring each segment per iteration
  3. Converges when crf_max - crf_min <= 1
  4. Encodes the full video at the resulting CRF

Roadmap

  • RAM disk support for intermediate files
  • Test suite (unit tests for pure functions, integration tests for encode pipeline)
  • Better error handling for ffmpeg subprocess failures
  • Robust VMAF score parsing
  • Logging for long-running operations (sweep, batch)
  • UI improvements (progress display, summary tables)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ffvm-0.1.1.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ffvm-0.1.1-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file ffvm-0.1.1.tar.gz.

File metadata

  • Download URL: ffvm-0.1.1.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ffvm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 136ea23868d99bf81db5b584ed5346ee99fbdcdd140b34f67472f07683bec7ef
MD5 074feff0158f1e6a6b46999759627418
BLAKE2b-256 57c22775625342c00e2da3bdf2c30c79099289391aed4e0a3ef9a4fdef596c1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffvm-0.1.1.tar.gz:

Publisher: publish.yml on birkdev/ffvm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ffvm-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ffvm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ffvm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9bb025cbf89bc4f9a308f5242e57d0eef90c968c2f18313273ea66cf7abc7f9
MD5 a91fd573563cd8c788b4afd7cd2a5d0c
BLAKE2b-256 e3266b229b99e30fb4ee488a0c6acf44e2dae284b3c1d58023aa0b2b9cb2f381

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffvm-0.1.1-py3-none-any.whl:

Publisher: publish.yml on birkdev/ffvm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page