[Ffmpeg-devel] Re: crop & pad (again)

Luca Abeni lucabe72
Wed Apr 5 15:21:45 CEST 2006

Hi Baptiste,

while hacking the crop/pad filters, I tried not to change the current
behaviour as much as possible.

On Wed, 2006-04-05 at 15:11 +0200, Baptiste COUDURIER wrote:
> ffmpeg -y -i <file> -croptop 32 -padtop 32 only pads and increase final
> resolution.
I just tried something like
./output_example /tmp/out.yuv
./ffmpeg -i /tmp/in.y4m -croptop 50 -padtop 50 /tmp/out.y4m
and (unless I messed up something - in this case, I apologize) ffmpeg
produces the same results before and after applying the three patches I
posted: it crops the 50 lines on top of the image and fills them with
black. Isn't this the expexted result?

> Hasn't "-s" precedence over all picture transformation ? IMHO it should.
The "traditional" ffmpeg behaviour is: crop first, then rescale, and
then pad (specifying "-s" before "-crop*" always gave strange results...
I posted some questions about this some time ago, and this seems to be
expected). So, "-s" sets the image size after cropping but before

> -croptop 32 -padtop 32 -s 720x576 should crop by 32 pad those 32 and
> finally rescale to 720x576. Is that actual behaviour Luca ?
This used to generate a 720x608 picture (because it crops 32 lines, then
rescales to 720x576, and then pads 32 lines, so we obtain 576 + 32
lines). This seems to be the expected behaviour (at least, this is what
I've been told on this mailing list). My patches leave this behaviour
unchanged - modulo bugs :) I just tried, and the behaviour seems to be
If there is a general agreement that this behaviour is wrong, I can
provide a patch to change it to the desired one... But there must be an
agreement (I do not want to break someone' scripts introducing a new

If you find some differences between the behaviour before my patches and
after my patches, please let me know and I'll fix it.

Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !

More information about the ffmpeg-devel mailing list