4 ms·
Some codecs, like h264, require the width and height be divisible by 2. Scaling with -1 will sometimes fail because of that. If you use -2 instead it will adju
by runlevel1 4y ago
Some codecs, like h264, require the width and height be divisible by 2. Scaling with -1 will sometimes fail because of that.
If you use -2 instead it will adjust so that it is even.[^1]
For example:
ffmpeg -i input.mp4 -vf scale=720:-2 output.mp4
[1]: https://trac.ffmpeg.org/wiki/Scaling#KeepingtheAspectRatio https://trac.ffmpeg.org/wiki/Scaling#KeepingtheAspectRatio
- hombre_fatal 4y agoIt reminds me of a similar quirk where scaling by a single pixel extra in either dimension can introduce disproportional blurriness, so one solution is to pad by a 1px wide border on the would-be odd dimension. This has saved me a lot: https://stackoverflow.com/a/53024964/511200 https://stackoverflow.com/a/53024964/511200