[Ffmpeg-devel] cropping + rescaling broken?
Tue Mar 7 11:54:11 CET 2006
Luca Abeni said:
> Hi again,
> On Tue, 2006-03-07 at 11:15 +0100, Luca Abeni wrote:
>> 4) ./ffmpeg -i /tmp/test.y4m -s 356x576 -croptop 144 -cropbottom 144 out.y4m
>> and look at the result... It's completely wrong! Why? Because this
>> time ffmpeg does both rescaling (output width = 356) and cropping.
>> -croptop and -cropbottom decrease the output size by 144 + 144 =
>> 288, so img_resample_full_init() is passed oheight = 288. But then it
>> computes s->pad_oheight = oheight - (padtop + padbottom) = 288 - 144 -
>> 144 =
>> = 0... So it tries to rescale to 0!!!
> Sorry, this is wrong; I got confused again...
> What happens is that
> s->v_incr = ((iheight - topBand - bottomBand) * POS_FRAC) / s->pad_oheight = 0
> Anyway, the result looks bogus again... But now I am beginning to
> understand... I was expecting ffmpeg to rescale first and crop after
> rescaling, but it looks like it does the opposite...
Cropping is supposed to happen first. After that, what remains should be
scaled to the requested size. Think about common usage. Typically, you
know how much of the source you want to crop (e.g. black borders), and you
know what final size you want.
mru at inprovide.com
More information about the ffmpeg-devel