How to pad videos using ffmpeg
You might need padding when you want to burn a video into a DVD widescreen format say 16:9 or any other video format, I am talking about the 2 black portions/bars (at top and bottom) on a DVD video. Just like cropping a video, padding is pretty easy too. Just a game of 4 options.
Now, lets consider the same scenario, convert a video into widescreen 16:9 format. Suppose the video format we have is 1280x720 and no we want to padd it with bars on top and bottom to get the final aspect ration of the video as 4:3 i.e. resolution is 1280x960. In order to achieve this we will have to increase the height of the video by 240 pixels. We will use the following command to do that.
[shredder12]$ ffmpeg -i input.avi -padtop 120 -padbottom 120 -padcolor 000000 output.avi
As it is already clear from the options, -padbottom means adding a 120px(height) bar at the bottom of the video and similarly we can use padleft and padright. Although there, the padding value will mean the width of the bar.
We can even select the colour of the bar using the option padcolor, the colour is specified in the same hexadecimal format used in HTML and CSS.
Note: The value for padding can't be an odd vlaue. So, you want to pad 90px of height, you should use padding values as 44 and 46 and not 45. They have to be even.



























Post new comment