"height not divisible by 2" with "min"
5,902
Here is what I came up with:
-vf 'scale=-2:min(1080\,trunc(ih/2)*2)'
http://trac.ffmpeg.org/ticket/309
Or:
-vf 'scale=-2:min(1080\,bitand(ih\,-2))'
Or:
-vf 'scale=-2:min(1080\,ih-mod(ih\,2))'
Related videos on Youtube
Author by
Zombo
Updated on September 18, 2022Comments
-
Zombo almost 2 years
Using this command:
ffmpeg -loop 1 -r 1 -i q.jpg -t 5 -pix_fmt yuv420p -vf 'scale=-2:min(1080\,ih)' z.mp4
I get this message:
[libx264 @ 00000000004d0ec0] height not divisible by 2 (954x953)
I can avoid the error like this:
ffmpeg -loop 1 -r 1 -i q.jpg -t 5 -pix_fmt yuv420p -vf scale=-2:1080 z.mp4
However this is not ideal because it is upscaling the image. How can I scale the image only if the height is greater than 1080, while keeping the pixel format as I have it?
-
Admin over 5 yearsThis didn't work for me. For example: ffmpeg -r 30 -f image2 -i fft_%05d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p fft_.mp4 -vf 'scale=-2:min(1080\,trunc(ih/2)*2)' still gives "width not divisible by 2 (2265x2209)".