AMV Post Production - Resizing

This is the last stage of the post-production process. With any luck you'll have an avisynth script that imports your exported avi, deinterlaced (if required) and filtered.

Now it's time to choose your resolution. First off, if you edited something that's a movie and was letterboxed, you may want to crop out any black bars it has before encoding it for the internet. You may also want to crop off any unwanted borders that a source may have as this can hurt compressibility.

Mostly, you won't need to crop for convention encodes as they are likely to need DVD resolution. However you can always crop and then add the same amount of black border in order to clean up any nasty edges your source may have.

Cropping

I would suggest opening up your script in VirtualDubMod, going Video->Filters->Add->null transform and then clicking the "Cropping button" to bring up the cropping screen. This will give you a nice GUI with which you can figure out how much you need to crop. Write down the values and then add the following line to your AVISynth script:

Crop(left,top,-right,-bottom)

where the 4 values there are the number of pixels you're cropping off from each edge. Note that you want to make the last two numbers negative! If you don't, it interprets the last two numbers as being destination resolutions, for instance the following lines performed on a 720x480 clip:

Crop(8,60,-8,-60) or Crop(8,60,704,360)

will both produce the same result, however the first syntax is easier to read and corresponds to the values you can see in VirtualDubMod's cropping GUI.

What size to choose

This all depends on your distribution. However, there is one universal piece of knowledge you need - many codecs will make bad encodes unless your resolution is a multiple of 16.

Internet Encodes

For 4:3 encodes, choose between 320x240, 480x352, 512x384 and 640x480. Higher is better quality but larger filesize. I tend to use 512x384 unless the source is very compressible (or I want to show off the quality) in which case I will make a 640x480 encode.

For 16:9 encodes, choose between 480x256, 512x288 and 640x352. Notice that not all these resolutions are exactly 16:9 - this is because of the need to create multiples of 16. The aspect ratio difference is small, however.

Convention Encodes

For 4:3 NTSC encodes you should choose 720x480 without exception.

For 4:3 PAL encodes you should chooose 720x576 without exception.

For 16:9 encodes you should always convert your footage to a letterbox format. For NTSC, first resize to 640x360 and then use Addborders(0,60,0,60). For PAL footage first resize to 720,432 and then use AddBorders(0,72,0,72).

Resizing Algorithms

Now you should decide which resizing method to use. There are three different algorithms you can use: BilinearResize, BicubicResize and finally LanczosResize. They differ in how sharp the image is when resized. Sharper is much better quality visually but it is also harder to compress so you need to balance the sharpness with the final file size you want. However, a less sharp resize can hide imperfections in the video.

BilinearResize will give you smaller filesizes and on older anime that was shot on Film it is most likely the better choice. It does a little blurring so this makes it the ideal choice if you want to get as small an avi file as possible. If (like me) you find Bilinear to be too blurry, then you'll want to choose something sharper...

BicubicResize actually comes in various forms as you can specify the amount of sharpening performed. The most common varieties of Bicubic are Soft, Natural and Sharp. Soft Bicubic is sharper than bilinear but not as costly to compression as Neutral or Sharp Bicubic. Of course, if you want and even clearer sharper picture then Lanczos is the algorithm you want.

LanczosResize - excellent detail, but the sharpness comes at a price in terms of compressibility. However, with some filtering on your amv they can nicely balance each other out - I frequently use this option on my music videos after filtering to get really clean encodes. This is not always recommended for internet file encoding (without filtering at least) but great for other purposes (like resizing for cons etc). In fact there is an even more accurate version of this called Lanczos4Resize which you can use for maximum quality.

To perform a Bilinear resize, add the following line to your avisynth script, replacing "width" and "height" with the numbers you want.

BilinearResize(width,height)

For a softer Bicubic, add:

BicubicResize(width,height,0,0.5)
The last two parameters are changing the strength of the algorithm and what give it its "softer" touch. Normal Bicubic is 0.75 and produces a much sharper, more difficult to compress picture.

So, to resize your video to 480x352 using the soft bicubic method, add this line:

BicubicResize(480,352,0,0.5)

If you're encoding to DVD-quality MPEG2, you'll want your resize to be a precise as it can be so use

Lanczos4Resize(720,480)

Lanczos4resize will not be detected by VirtualDubMod, but it should work well.

Personally I use the regular LanczosResize command even on my internet distributions as it doesn't hurt compressiblity that much provided you have filtered the footage beforehand. Give the different resizers a try and see what suits you.

Adding Black Bars

Don't forget that if you are letterboxing your video for a convention then you will need to add borders after your resize, like so:

Lanczos4Resize(720,360)
Addborders(0,60,0,60)

Remember: Resizing like this should only be done on PROGRESSIVE footage. If you want to resize interlaced footage you either have to limit your resizing to being horizontal or you have to separate the fields, resize those and then weave them together. Here's an example script for letterboxing an interlaced anamorphic source:

AssumeFrameBased()
SeparateFields
()
Lanczos4Resize(720,180)
Weave()
Addborders(0,60,0,60)

Notice that the vertical resoluton on the resize is half what it would normally be - this is because we are resizing one field at a time. When the fields are re-combined with Weave() the frame will have the correct size.