View comments | RSS feed

Encoding video with non-square pixels

Most static computer graphics use square pixels, which have a width-to-height ratio of 1:1. When working with digital video, pixels often have a different width-to height ratio and are referred to as rectangular pixels. The reason for this behavior is to allow analog video (e.g. broadcast television) and digital video (e.g. DVD video) to coexist. When encoding video formats with non-square pixels (also known as anamorphic video), you need to resample the video image to the correct Display Aspect Ratio (DAR).

For example, standard NTSC digital video (DV), has a frame size of 720 x 480 pixels, and it's usually displayed at an aspect ratio of 4:3. This means that each pixel is rectangular, with a pixel aspect ratio (PAR) of 10:11 (a tall, narrow pixel). Both MPEG 1 and 2 video are also produced in various sizes (720 x 480 or 480 x 480 are common) even though they are typically displayed with either a 4:3 or 16:9 (wide screen) aspect ratio.

To calculate the image frame size to use when encoding video using non-square pixels, you must first decide which dimension--width or height--is the preferred master dimension, and then compute the other dimension as follows:

If height is the master dimension, calculate the width using the following formula:

For example, if your video uses an aspect ratio of 4:3 the equation would appear as:

If width is the master dimension, calculate the height using the following formula:

For example, if your video uses an aspect ratio of 4:3 the equation would appear as:

As an example, if you are encoding a video whose frame size is 720 x 480 pixels, and you want to encode it with a 4:3 aspect ratio, you must determine the width at which to encode the video frame in pixels:

The result is a video image height of 640 pixels.

Thus, you need to encode the 720 x 480 image to 640 x 480, a standard 4:3 aspect ratio.

To correct the image size when encoding using Flash Video Encoder, deselect the Maintain Aspect Ratio option on the Crop and Resize tab of the Flash Video Encoding Settings dialog box, and enter the corrected dimensions at which to encode the video. For more information, see Customizing video encoding settings.


Flash CS3


Comments


No screen name said on Jun 15, 2007 at 3:09 PM :
The information on this page is an example of 2 wrongs make a right.

The technically correct Pixel Aspect Ratio (PAR) for NTSC D1 and DV
video is indeed 10:11. However, most applications (including Adobe
After Effects and Premiere Pro) use 9:10. They arrive at this number by
incorrectly applying the math on this page to a professional D1-standard
720x486 pixel video frame. (D1 frames have a touch of additional
"overscan" on the left and right so that common processing, such as
blurs, would be less likely to drag edge artifacts into the actual image
area. Including this overscan into the PAR calculation is what gives the
incorrect 9:10 result that everyone uses.)

An NTSC DV frame is a subset of a D1 frame: You take 6 lines off a
720x486 D1 frame (usually 4 from the top, 2 from the bottom) to create a
720x480 pixel DV frame. Both standards have the same PAR.

As the vast majority of applications use a PAR of 9:10 for NTSC D1 and
DV frames, it is probably best to do so in Flash Video as well, for
consistency and compatibility with other applications. If converting from a
square-pixel 4:3 source to a DV output, you would then trim the
remaining pixels off the top and bottom to get a 720x480 output. You
would not need to do any trimming to create 720x486 output.
No screen name said on Jan 14, 2009 at 12:04 PM :
The above was a confusing explanation for me. I had some 4:3 video and some 16:9 video that I wanted to put together in one project. I envisioned the 4:3 content having black vertical columns next to it, and any 16:9 stuff just taking up the whole screen. Here's what I did: output my project as an AVI from Premiere Pro CS3 as NTSC Widescreen (1.2 pixel aspect ratio).

I soon encountered a problem: Flash CS3 in the File > Import Video dialog that I use to import my video doesn't seem to offer a 16:9 conversion. However, you can resize the video in the Encoding step in the Resize section. (uncheck the "Maintain Aspect" ratio button and enter above a pixel dimension that will be 16:9). But how do you ensure the resulting dimensions of the image are not too stretchy or squishy?

How many pixels wide do you want your 16:9 video to be? If you know how wide you want the final video to be,
Divide 9 by 16 to get 0.5625. Multiply your width number of pixels (in my case 444) by 0.5625 and you get 249.75. Round it up to 250 pixels...that's close enough...and you're set. Put those numbers in the height and width box, maybe drop your frame rate to 15 fps instead of Same as Source, just to reduce file size. (Look in the Video section of the Encoding step...it's a couple of tabs to the left of the Resize box.)

If you know how tall your want your video display to be in pixels, divide 16 by 9 to get 1.7777778. This is your multiplier ratio. Now, take the height you want the final video to be in pixels (let's say it's 250) and multiply that by 1.77. The result tells you your video needs to be 442.5 pixels wide to maintain your correct 16:9 aspect ratio. Round 442.5 up to 443 and you're set. Put those number in the height and width resize box, and click next to encode.

(Remember, in my scenario I exported the video from Premiere as a NTSC Widescreen 1.2 AVI file.)

Anyhow, this worked for me. Hope it helps!

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/flvencoder/FLV_11.html