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) = 292 (291.428) height = 480 width = height * DAR / PAR = 480 * (42/17) / (1/1) = 1186 (1185.882)giving us possible frame sizes of either 720x292(*) 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 720x292 -Y -94,0 (other options)
(*) 291.428 is rounded up to 292 because the most common video image format, YUV 4:2:0, encodes pixels in 2x2 groups, so width and height values must always be even.
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!