FFMPEG - How can I add black bars to top and bottom of my video?
Adding Bars

You can do it with a combination of the crop &amp; pad video filters:

-filter:v crop="in_w:in_h-60:0:30",pad="in_w:in_h+60:0:-30"


Both filters use the same format: width:height:x-offset:y-offset

In the crop filter, you want width to be same as the video's input width (you can use the variable in_w). You want to crop 60 pixels (30*2) from the input height (in_h-60). X offset stays at zero so nothing is changed horizontally. And set the Y offset to 30 so that 30 pixels are cropped from the top &amp; bottom each. Otherwise, it will just crop 60 pixels from the bottom.

In the pad filter, the in_w &amp; in_h variables will be whatever is output from the crop filter (you can just replace these with the actual video dimensions if you prefer). Use in_w again to preserve horizontal dimension. Add 60 black pixels back to the vertial dimension (in_h+60). Leave the X offset at 0 &amp; set Y offset to -30 so pixels are added at top &amp; bottom. Otherwise, it will just add 60 pixels to bottom.

The other option, as I think @Quertiy was pointing out, is to create a PNG image the same dimensions as your video with black bars at the top &amp; bottom, &amp; transparent in the middle, then overlay it onto the image:

ffmpeg -i video.mp4 -i overlay.png -filter_complex "overlay" -c:v libx264 "out.mp4"


It may be wise to list the streams in the filter arguments: -filter_complex "[0:0][1:0]overlay"



Multiple Files

If you were using a Unix shell (I believe this is what MacOS uses), you could use a for loop to convert all videos in a directory:

for V in *; do ffmpeg -i "$V" -c:v libx264 -filter:v crop="in_w:in_h-60:0:30",pad="in_w:in_h+60:0:-30" "padded-$V"; done


But I'm not sure what the equivalent is using the Windows command prompt.

Edit: Windows command prompt has a for loop as well. So it should be something like:

for %V in (*) do ffmpeg -i "%V" -c:v libx264 -filter:v crop="in_w:in_h-60:0:30",pad="in_w:in_h+60:0:-30" "padded-%V"


But, I haven't tested it.

Note: Use %%V within batch files, %V if using the command prompt directly.

Edit: According to this article, you should be able to do it in Windows PowerShell like this:

foreach ($V in Get-ChildItem .\) {ffmpeg -i "$V" -c:v libx264 -filter:v crop="in_w:in_h-60:0:30",pad="in_w:in_h+60:0:-30" "padded-$V"}


Again, I haven't fully tested it.