In some cases you may need to encode a video with strictly defined width or height, while preserving the source video aspect ratio. We usually handle this automatically, with the keep aspect ratio option via our web UI or flagging it in XML
<?xml version="1.0"?> <query> <format> <keep_aspect_ratio>yes</keep_aspect_ratio> </format> </query>
If you turn it off, it will stretch the video image to fill whatever output framesize you have chosen. With it on, if source and output framesizes have different dimensions, it will letterbox or pillarbox the output. Apple has an excellent article that explains this at
http://support.apple.com/kb/HT2320
Floating Output Framesize
Let's say you know you want your video to exactly match your source aspect ratio but wish to lock the vertical resolution to 320 pixels. You can use a zero value to float the horizontal, using a value of 0x360 for the output size. The same can be done in reverse. If you used a value of 640×0, it would lock the width to 640 pixels wide and float the height of the output video.
<?xml version="1.0"?> <query> <format> <size>0x320</size><!--locking height to 320--> <size>640x0</size><!--locking width to 640--> </format> </query>
Manual Override For Output Aspect Ratio
Setting correct aspect ratio is a big deal, since many broadcast formats use proprietary aspect ratio flags which often are not recognized by third-party systems. QuickTime flags like PAR (pixel aspect ratio) and DAR (display aspect ratio) have been the primary offenders, since most professional editing systems use various QuickTime codecs as their edit format. This setting allows you to lock the output aspect ratio to achieve the best results. NOTE: You will probably want to turn keep aspect ratio off, so you scale the entire video image.
In the web UI, choose a value for set aspect ratio as follows:
For NTSC Standard Definition, use 4:3 or 1.33
For HD or Widescreen Video, use 16:9 or 1.77
For XML to our API, these are good examples:
<?xml version="1.0"?> <query> <format> <set_aspect_ratio>4:3</set_aspect_ratio> <set_aspect_ratio>1.33</set_aspect_ratio> <set_aspect_ratio>16:9</set_aspect_ratio> <set_aspect_ratio>1.77</set_aspect_ratio> <keep_aspect_ratio>no</keep_aspect_ratio><!-- OPTIONAL to prevent letterboxing --> </format> </query>
For more detailed information regarding aspect ratios, please see wiki at http://en.wikipedia.org/wiki/Aspect_ratio_%28image%29