Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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


It 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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: