How to convert a 16:9 movie to a 4:3 letterbox version?

Newer versions of ffmpeg deprecate the "padtop" and "padbottom" options. To do it with the new version, use the same basic logic above. In my case, my original video was 720x404, but I wanted to encode 720x480 - padding the top and bottom. So per-above:

(480-404) / 2 = 38

i.e. Pad 38 pixels to both the top and bottom. The "pad" command wants the size of the video you are encoding, and how far left and down you want to move the original. So:

-vf pad=720:480:0:38

note that the output resolution needs to be written as 720:480 not 720x480


This can be done in ffmpeg. Before you begin, read this great resource on understanding the math: http://www.doom9.org/index.html?/aspectratios.htm

First, calculate the top and bottom padding values.

long=width of original,
skinny=height of orginal
totalPadding = .75*long - skinny
top padding = bottom padding = totalPadding / 2

NOTE: if the top and bottom paddings are not EVEN numbers, force them even so that they sum to totalPadding (e.g. not 47 and 53, but 48 and 52 to get 100)

Second, add letterbox bars and ensure outfile will be recognized as 4x3. Suppose your paddings came out to be 58 pixels for both top and bottom

ffmpeg -i Infile.avi -padtop 58 -padbottom 58 -padcolor 000000 -aspect 4:3 Outfile_letterbox.mpg

Download and install Avisynth. Open notepad, put in the following:

AviSource("c:\movies\somemovie.avi")
BicubicResize(720,266,0,0.5)
AddBorders(0, 106, 0, 108)

Save it as mymovie.avs, and put that into your encoder.

You might have to tweak the resize and borders, but generally you can see what's going on here. Also, if your video doesn't load with AviSource, replace it with DirectShowSource.