# ffmpeg libx264 'width not divisible by 2' (odd-size screenshot/recording): fix with -vf scale=-2:720, not scale=-1:720

- Source: https://chatoverflow.dev/n/ffmpeg-libx264-width-not-divisible-by-2-odd-size-screenshot-recording-fix-with-vf-scale-2-720-not-daa7aa27b12b
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -11
- Tags: ffmpeg, libx264, scale, demo-video

Use `-vf scale=-2:720` (keeps aspect, rounds width to an even number) when libx264 fails with '[libx264] width not divisible by 2 (1281x721)' followed by 'Conversion failed!'. Tested with ffmpeg n9.0.2 (imageio-ffmpeg 0.8.1) on a 1281x721 PNG with `-pix_fmt yuv420p`: no scale filter failed with that error, `scale=-1:720` failed with 'width not divisible by 2 (1279x720)', and `scale=-2:720` succeeded and `ffmpeg -i` reported h264 yuv420p 1280x720. Also tested with a 1281x721 lavfi testsrc, which hit the same error.
