There are two types of aspect ratios involved in video editing. One is display aspect ratio or DAR; this is the ratio most commonly referred to by the term "aspect ratio", and is the ratio of the video frame's physical (displayed) width to its height, regardless of the number of pixels used to represent the video image. The other, pixel aspect ratio or PAR (also known as "sample aspect ratio" or SAR), is the ratio of the width to the height of a single pixel in the video image. These two aspect ratios are related to each other and the number of pixels in the video frame as follows:
DAR width --- = ------ PAR height
When transcoding video between different frame sizes, it is important to take both of these aspect ratios into account. The PAR may be determined by the display hardware; for example, most LCD televisions and monitors have a PAR of 1:1. (CRT monitors and televisions are able to change their PAR on the fly, because the analog signals which they use do not have the concept of "pixels".) The DAR, on the other hand, is an inherent attribute of the video stream; if the DAR changes, the video will look "stretched" either horizontally or vertically.
If you know the DAR of your input video, the PAR of the device you're going to display it on, and the target width or height, you can determine the other size value (height or width) using the formula above:
height = width * PAR / DARor
width = height * DAR / PARFor example, if you're transcoding a 720x576, DAR 4:3 video for display on a computer monitor (PAR 1:1), and you decide to keep the height the same (576), then the new width would be:
width = 576 * (4/3) / (1/1) = 576 * 4/3 = 768
As another example, suppose you have a 672x272 video file on your computer that you want to transcode to an NTSC (720x480) DVD. If you don't know the DAR, but you assume the intended PAR is 1:1 (standard for computer monitors), you can calculate the DAR as:
DAR = PAR * width / height = (1/1) * 672 / 272 = 42:17or about 2.47:1. Now, we know that the width and height must fit within the DVD frame size, so we calculate using both the width and the height:
width = 720 height = width * PAR / DAR = 720 * (1/1) / (42/17) = 291 (291.428) height = 480 width = height * DAR / PAR = 480 * (42/17) / (1/1) = 1186 (1185.882)giving us possible frame sizes of either 720x291 or 1186x480. The latter is obviously too big for DVD video, so we use the former, and add black bars to the top and bottom with the -Y option to transcode:
transcode -Z 720x291 -Y -94,0,-95,0 (other options)
Note that when the --export prof, --export asr, and -Z options are used with Transcode, all geometry calculations are done automagically for you, assuming that Transcode is able to probe the input files successfully. In that case the -Z option should be set to the default for the output format, and the fast flag should always be used.
For example, to create an NTSC DVD compatible mpg you would use -Z 720x480,fast. The appropriate geometry calculations will then be done by Transcode. For some reason this only works when the fast flag is used, even if the source geometry is incompatible with the fast flag!