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

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Use syntax $$latex$$ to insert LaTeX formulas.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.
  • Search Engines will index and follow ONLY links to allowed domains.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.