AfterDawn.com

Resizing DVD-Video To Square Pixels For MPEG-4


With the popularity of MPEG-4 (DivX, XviD, 3ivx, etc, ...) among home theater enthusiasts has come the gradual development of standalone DVD players that can deliver it to your TV. Some models have certifications from specific software vendors, such as DivX or Nero Digital, but most are capable of playing back majority of the MPEG-4 files created within the last several years.

When deciding on settings for encoding MPEG-4 video with any tool, one of the most misunderstood subjects is resizing. For many people the easy solution is to rely on their video encoder to select the best settings, but you can't necessarily count on the software's decision making. While more advanced open source tools tend to do well on resizing decisions, common (and generally high quality) commercial tools used by many consumers don't seem to do as well. Although it's a bit more work to figure out the best settings for your own encodes, once you do the work once you should have a system you can apply to all your encodes to obtain maximum quality.

Pixel Shape

Although pixels technically don't have a shape, being just points on a grid, they do have a Pixel Aspect Ratio, or PAR, that we refer to as their shape. This refers to the shape they should be when displayed. For DVD the pixels hava a rectangular PAR for display on either a NTSC or PAL analog TV. There are two potential issues with this. The first is for the TVs themselves. While slightly fewer than the 720 horizontal pixels on each line are actually included in the actual visible portion of each TV scanline (horizontal line), the number is still significantly higher than any standard (4:3) analog TV can reproduce. Since DVD standards were designed with widescreen HDTVs in mind as well, widescreen movies are generally encoded in such a way that they must be either shrunk vertically for a 4:3 TV or stretched horizontally for a 16:9 display. Every DVD player is capable of this, and newer upscaling models can even upscale to HD resolutions, but if you're already encoding to MPEG-4 there are good reasons you might want to scale the image at the same time.

The images below show the standard PAL and NTSC pixel shapes compared to a square pixel.



Square Pixel Displays

Being designed around particular digital resolutions, rather than an analog TV signal, both computer monitors and HDTVs use square pixels. While the presence of Aspect Ratio information in your video file should allow either to scale as necessary to maintain the correct AR, you may find that the results are better when the scaling is done before encoding. Among other things, this allows slower than realtime processing, which isn't possible during playback. With the reduced size inherent to all MPEG-4 video compared to MPEG-2 (DVD) with equivalent quality, you may even find it worth upscaling to HD resolutions like 720p, although with a high quality upscaling player this generally just wastes disc space and encoding time.

AvsP

The hands-on examples of resizing will all be done using AvsP as a frontend for AviSynth. This is both because it's my AviSynth editor of choice, and because it's the easiest to use with very little understanding of AviSynth. While it's not required, it tends to make understanding the processes involved easier and is recommended. You can find our guide on AvsP, including instructions for most of the operations you'll need for the examples in this guide, in our guide on AvsP - AviSynth Made Easy.

Understanding Resolution

Rather than include in-depth coverage of resolution itself, this guide uses certain conclusions, both from personal observation and evaluation of video technology. It's not necessary to know all the technical background involved, but if you'd like to learn more you can read our Digital Video Fundamentals guides, including one on Resolution and Aspect Ratio.



Required Software:


AvsP
AviSynth

Optional Software

ffdshow
Haali Media Splitter
VirtualDub
HuffYUV
AVS2AVI

Next: The basics of resizing




table of contents

  1. 1. Introduction
  2. 2. Basic Resizing
  3. 3. Step By Step
  4. 4. Square Pixels For NTSC TVs
  5. 5. Resizing For SDTV
Written by: Rich "vurbal" Fiscus
Last updated: 25 March 2008