Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add black borders to video

Tags:

console

ffmpeg

So I'm using ffmpeg to convert a video to 1920*1080 px, I found two ways to do so, the first one would be to stretch the video to 1920*1080, but then it looks kinda stretched. I used this command for this:

./ffmpeg_darwin -i SRC -vf scale=1920:1080,setdar=16:9 DEST

The other option is the same without setdar but this just adapts the resolution to the one it started from (1728*1080).

I would like to fill the 192 pixels of the width with a black border. Is there some kind of option to do so? Or is there maybe another command line that could achieve this?

Thanks for your help :)

like image 363
Arnaud Rochez Avatar asked Oct 10 '17 16:10

Arnaud Rochez


1 Answers

Use

-vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1"

The scale will ensure that its output fits within 1920x1080. The pad then fills that out.

like image 98
Gyan Avatar answered Sep 28 '22 17:09

Gyan