[FFmpeg-devel] [Patch] Scale filter should use multiples of 2
Daniel G. Taylor
Wed Jun 30 19:21:03 CEST 2010
On 06/29/2010 08:16 PM, Michael Niedermayer wrote:
> On Wed, Jun 30, 2010 at 01:04:36AM +0200, Stefano Sabatini wrote:
>> On date Tuesday 2010-06-29 12:56:17 -0700, Baptiste Coudurier encoded:
>>> On 6/29/10 12:02 PM, Daniel G. Taylor wrote:
>>>> 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:
>>> This depends on the output pixel format. For 420, indeed it would be useful.
>> Odd-size rescaling was a feature explicitely requested by Michael. I'm
>> not against adding an option to make it only issues even-sized image though.
> I insisted possibly on it being supported (that is important)
> but doing it by default with 420 seems odd
What about attached patch? It changes the behavior so that a width or
height of -1 remains the same as it is now while adding the ability to
use other negative values to mean "scale proportionately but clip to the
closest multiple of X," so e.g.
scale=320:-1 => 320x197
scale=320:-2 => 320x198
scale=320:-8 => 320x200
scale=320:-16 => 320x192
This can be useful for other codecs that wish to have dimensions as
multiples of 2, 8, 16, etc. In the future we could even auto-insert a
scaler to do this when needed by the chosen vcodec.
Thoughts? I tried to use FFALIGN but it seems to always round up.
Daniel G. Taylor
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1611 bytes
Desc: not available
More information about the ffmpeg-devel