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 libsvtav1 --crf 28 --preset 5 --extra "-svtav1-params tune=0:enable-qm=1:qm-min=0" --extra "-write_tmcd 0"
Options:
--vcodec— Video codec:copy,libx264,libx265,libsvtav1,libvpx-vp9,libaom-av1,librav1e(default:libx264)--crf— Constant Rate Factor (default:23)--preset— Encoder preset, e.g.5--extra— Extra ffmpeg arguments (repeatable), e.g.--extra "-svtav1-params tune=0"--acodec— Audio codec:copy,aac,libopus,libvorbis,flac,pcm_s16le,libmp3lame(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
- Extracts 1-7 short segments (scaled by video length) from the middle 80% of the video
- Binary searches through the CRF range, encoding and VMAF-scoring each segment per iteration
- Converges when
crf_max - crf_min <= 1 - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ffvm-0.2.3.tar.gz.
File metadata
- Download URL: ffvm-0.2.3.tar.gz
- Upload date:
- Size: 97.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6a70ed88728fb4960b4d267551f5de0ba0d46d4b4f71201e0cc5530db682222
|
|
| MD5 |
c0a687a953cfcfaba6f6c5dc70bef7c3
|
|
| BLAKE2b-256 |
573b5cbd1eb5c1d9844460e1733fa0eb693ed9e523a7f117cbcc0c651a18154d
|
Provenance
The following attestation bundles were made for ffvm-0.2.3.tar.gz:
Publisher:
publish.yml on birkdev/ffvm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ffvm-0.2.3.tar.gz -
Subject digest:
c6a70ed88728fb4960b4d267551f5de0ba0d46d4b4f71201e0cc5530db682222 - Sigstore transparency entry: 1171859871
- Sigstore integration time:
-
Permalink:
birkdev/ffvm@cdd33136c38e0fae58846f11d457eab5a57fd903 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/birkdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cdd33136c38e0fae58846f11d457eab5a57fd903 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ffvm-0.2.3-py3-none-any.whl.
File metadata
- Download URL: ffvm-0.2.3-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b3a834177c4891204fc2a2ac49dd9b5cb7c164b5466fdb534a4baf269e66fc7
|
|
| MD5 |
6b719db276c27a95873701da046d4d36
|
|
| BLAKE2b-256 |
79ef419f8512fc95fea6522dad8467da501a70f1d46c3f78938a9b72374d0769
|
Provenance
The following attestation bundles were made for ffvm-0.2.3-py3-none-any.whl:
Publisher:
publish.yml on birkdev/ffvm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ffvm-0.2.3-py3-none-any.whl -
Subject digest:
3b3a834177c4891204fc2a2ac49dd9b5cb7c164b5466fdb534a4baf269e66fc7 - Sigstore transparency entry: 1171859874
- Sigstore integration time:
-
Permalink:
birkdev/ffvm@cdd33136c38e0fae58846f11d457eab5a57fd903 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/birkdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cdd33136c38e0fae58846f11d457eab5a57fd903 -
Trigger Event:
release
-
Statement type: