[FFmpeg-devel] [Patch] Scale filter should use multiples of 2

Daniel G. Taylor dan
Tue Jun 29 21:02:20 CEST 2010


Attached is a small patch to make the vf_scale filter always produce 
multiples of 2 when the -1 option is used for either width or height to 
keep the aspect ratio. This lets you use it properly with some encoders, 
like libx264, that would otherwise fail, e.g:

     ffmpeg -i myfile.mp4 -vf scale=320:-1 -vcodec libx264 -vpre default 
-crf 21 test.mp4
     [scale @ 0xa43c580]w:390 h:240 fmt:yuv420p -> w:320 h:197 
fmt:yuv420p flags:0x2
     [libx264 @ 0xa43b200]width or height not divisible by 2 (320x197)
     Error while opening encoder for output stream #0.0 - maybe 
incorrect parameters such as bit_rate, rate, width or height

After the patch is applied it scaled to 320x198 and works perfectly.

Take care,
Daniel G. Taylor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scale_mod_2.diff
Type: text/x-diff
Size: 487 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100629/42a6344a/attachment.diff>

More information about the ffmpeg-devel mailing list