Before you start
FFmpeg upstream lists releases dated December 1, 2026. Codecs vary by build, and neither of these presets is guaranteed to win or to be equivalent to the other.
- What you’ll make
- Two small MP4s, matched still frames, probe JSON and SSIM logs against a common master.
- What you’ll need
- Local FFmpeg with libx264, libsvtav1 and the ssim filter; ffprobe; a Bash shell; SDR footage or the provided synthetic fixture.
Step by step
Check codecs and create one reference
Ensure your FFmpeg build has both encoders and the SSIM filter. Create a short fixture or choose a licensed 4-second SDR segment, keeping the same raster, frame rate and decoded frame range.
Encode matching candidates
Encode both candidates with the same geometry and sample format. Use the two CRF values as starting points, not as equivalent settings. The example SVT-AV1 lp argument is a thread-limit hint for builds that recognize it; omit it if unsupported and your machine can handle the default.
Measure decoded frames and compare stills
Check actual decoded frames, dimensions and timing with ffprobe. Measure each file against the same reference after aligning timestamps, and compare stills from the same moment. Do not interpret SSIM when frame counts or sizes do not match.
Decide without overgeneralizing
The generated 640 × 360, 30 fps fixture yields 120 frames in both files; H.264 was 398,912 bytes at SSIM 0.970110 and AV1 was 403,471 bytes at SSIM 0.969442 for the illustrated settings. Use your actual result; keep a compatible H.264 fallback and verify device playback before adopting a web AV1 variant.
Commands
# Run in a new, empty output directory.
ffmpeg -version
ffmpeg -hide_banner -encoders
ffmpeg -hide_banner -h filter=ssim
ffmpeg -v error -n -f lavfi -i testsrc2=size=640x360:rate=30:duration=4 -c:v ffv1 reference.mkv
ffmpeg -v error -n -i reference.mkv -an -c:v libx264 -threads 2 -preset medium -crf 23 -pix_fmt yuv420p -movflags +faststart h264.mp4
ffmpeg -v error -n -i reference.mkv -an -c:v libsvtav1 -preset 9 -crf 33 -pix_fmt yuv420p -svtav1-params lp=2 -movflags +faststart av1.mp4
for f in h264 av1; do
ffmpeg -hide_banner -i "$f.mp4" -i reference.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[enc];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[enc][ref]ssim=stats_file=$f.ssim" -f null - 2>"$f.measure.log"
ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=codec_name,width,height,pix_fmt,r_frame_rate,nb_read_frames:format=duration,size -of json "$f.mp4" >"$f.probe.json"
ffmpeg -v error -n -ss 1 -i "$f.mp4" -frames:v 1 "$f.png"
doneSign-in & permissions
No sign-in, payment, upload, API or MCP. Use existing approved tools. A device playback check is optional and separate from the local comparison.
No agent plugin, registered skill, or MCP connector is required for this workflow.
Prompt for your agent
Use with: A terminal-enabled agent such as Codex or Claude Code, using a local POSIX shell or translating quoting for PowerShell.
Copy the whole prompt into a supported agent. After any manual step, tell the same agent to continue from that step.
Use a clean project folder for this workflow: Compare AV1 and H.264 on the same source. Supported setup: A terminal-enabled agent such as Codex or Claude Code, using a local POSIX shell or translating quoting for PowerShell.. Start from the original documentation: https://ffmpeg.org/ffmpeg-codecs.html#libsvtav1.
1. SET UP
Check both encoders and the SSIM filter before processing; stop rather than substituting a different encoder silently. Use a new folder and local inputs only.
Documented commands or code reference (respect the comments and replace placeholders before running individual commands):
# Run in a new, empty output directory.
ffmpeg -version
ffmpeg -hide_banner -encoders
ffmpeg -hide_banner -h filter=ssim
ffmpeg -v error -n -f lavfi -i testsrc2=size=640x360:rate=30:duration=4 -c:v ffv1 reference.mkv
ffmpeg -v error -n -i reference.mkv -an -c:v libx264 -threads 2 -preset medium -crf 23 -pix_fmt yuv420p -movflags +faststart h264.mp4
ffmpeg -v error -n -i reference.mkv -an -c:v libsvtav1 -preset 9 -crf 33 -pix_fmt yuv420p -svtav1-params lp=2 -movflags +faststart av1.mp4
for f in h264 av1; do
ffmpeg -hide_banner -i "$f.mp4" -i reference.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[enc];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[enc][ref]ssim=stats_file=$f.ssim" -f null - 2>"$f.measure.log"
ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=codec_name,width,height,pix_fmt,r_frame_rate,nb_read_frames:format=duration,size -of json "$f.mp4" >"$f.probe.json"
ffmpeg -v error -n -ss 1 -i "$f.mp4" -frames:v 1 "$f.png"
done
2. PAUSE FOR ME IF NEEDED
For a host install, sign-in, permission screen, or model download that needs my consent, stop and tell me the exact app, control and what will be authorized. Do not enter passwords, OTPs or secrets in chat. Resume after I confirm.
3. BUILD THE FIRST RESULT
Use the exact same licensed SDR input, or a four-second generated testsrc2 fixture without audio. Check capabilities, encode H.264 and AV1 on the same timeline, probe both outputs, compare same-time frames, record byte counts and SSIM, and say which file better meets the brief without generalizing. Return both MP4s and the measurement files. Do not publish.
4. CHECK THE RESULT
Require both expected codecs and matching geometry, sample format, rate and decoded frame count. Return independent SSIM logs and report bytes, not assumed efficiency. Give me the actual file paths and anything that still needs a manual action. Do not publish or make a purchase.
