FFmpeg libx264 Error: height/width not divisible by 2

H.264 `yuv420p` chroma subsampling requires even pixel dimensions.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: FFmpeg libx264 Error Platform: Media
Common Root Causes:
  • H.264 `yuv420p` chroma subsampling requires even pixel dimensions.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Use scale filter `-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"` or `scale=-2:1080`.
Safe Diagnostic Command:
ffprobe -v error -select_streams v:0 -show_entries stream=width,height <in>
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

H.264 `yuv420p` chroma subsampling requires even pixel dimensions. Recommended diagnostic: `ffprobe -v error -select_streams v:0 -show_entries stream=width,height <in>`. Remediation: Use scale filter `-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"` or `scale=-2:1080`.

Worked Examples

  • Run `ffprobe -v error -select_streams v:0 -show_entries stream=width,height <in>` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-ffmpeg-height-not-divisible-by-2 · Independently verified: 2026-11-25

Related Resources