[FFmpeg-user] Video scaling, padding and cropping together question

TPCffmpeg at mklab.ph.rhul.ac.uk TPCffmpeg at mklab.ph.rhul.ac.uk
Sat Jan 6 19:52:53 EET 2018

I am attempting to down-convert HD video (1280x720 with 16:9 aspect ratio) 
to 720x576 for use on an old PAL 4x3 display.  I found two days of doing 
this, using,

(1) -filter:v scale=iw*min(720/iw\,576/ih):ih*min(720/iw\,576/ih), pad=720:576:(720-iw*min(720/iw\,576/ih))/2:(576-ih*min(720/iw\,576/ih))/2 -target pal-dvd
(2) -filter:v 'crop=ih/3*4:ih' -target pal-dvd

Method 1 scales and pads to letterbox format, so I get the whole of the 
original picture width with bars above and below.  Method 2 scales and 
crops, so I get to use the whole 4x3 display screen height (better 
resolution) but lose the LH & RH picture edges via the cropping.

The thing I am trying to achieve is a compromise between these two 
extremes, eg. a method which gives less cropping at the LH & RH picture 
edges for the price of a little padding above and below the picture.  I'm 
presuming this (ideally) involves scaling, padding and cropping together 
in a single filter.

Could anyone show how to do this or point me in the right direction?

Many thanks
Tom Crane

Tom Crane, Dept. Physics, Royal Holloway, University of London, Egham Hill,
Egham, Surrey, TW20 0EX, England.
Email:  T.Crane at rhul.ac.uk
Fax:    +44 (0) 1784 472794

More information about the ffmpeg-user mailing list