[FFmpeg-user] Add black on both side with 1024x576
Werner Robitza
werner.robitza at gmail.com
Mon Feb 9 22:07:54 CET 2015
On Mon, Feb 9, 2015 at 10:05 PM, Werner Robitza
<werner.robitza at gmail.com> wrote:
> 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
>
This will not work when downscaling, though. In that case, you need a
more sophisticated filter:
ffmpeg -i in.mp4 -filter:v
"scale=iw*min($width/iw\,$height/ih):ih*min($width/iw\,$height/ih),
pad=$width:$height:($width-iw*min($width/iw\,$height/ih))/2:($height-ih*min($width/iw\,$height/ih))/2"
out.mp4
Define $width and $height or replace them with the desired values
directly. (Taken from http://superuser.com/a/547406)
More information about the ffmpeg-user
mailing list