[FFmpeg-user] Add black on both side with 1024x576

Werner Robitza werner.robitza at gmail.com
Mon Feb 9 22:05:28 CET 2015

On Mon, Feb 9, 2015 at 3:32 PM, thibault75 <thibault at capitalvision.fr> wrote:
> I've got some video in 4/3 and other one in 16/9.
> I want to transcode this video to 1024x576 which is 16/9 ratio.
> If it's a 4/3 i want black to be add on each side of the video and if it's a
> 16/9 i just want video to be resized.

ffmpeg -i input.mp4 -vf "scale=-2:576,
pad=1024:576:(ow-iw)/2:(oh-ih)/2" output.mp4

The -2 takes care of upscaling at multiples of 2, and 576 is the
desired output height. It will not change the aspect ratio. The pad
filter will pad the video to a full size of 1024x576, placing the
video at the exact center (which is output width - input width divided
by two, same goes for height).

More information about the ffmpeg-user mailing list