|
Overview
This section covers preparing AVI files (most likely
Anime) for encoding. We are also going to encode the AVI file to
MPEG-2 using an AVS
script, and CCE SP 2.5. Once
the file is encoded we will run it through pulldown
to get the proper framerate.
Section 1 - Removing letterboxing
Before we try to determine the settings needed
to encode our AVI file we need to load up the file in VirtualdubMod
to check if there is any letterboxing
in the file. Letterboxing is the black bars you see on widescreen
DVD's that are used to fill in the remaining vertical space. Most
of the time the letterboxing has been removed, if thats the case
you can skip to the next section.
To check for and remove letterboxing using VirtualDubMod
do the following:
- File -> Open Video File
- Video -> Filters
- Click the Add
- Select Null transform
- Now select cropping
- Move the slider along to see if there is any
letterboxing throughout the clip
- If there is letterboxing we need to crop the
image. If there is no letterboxing skip to the next section below
- Use the x and y offsets and set it up until
you cover the black letterboxing
- Make sure your offsets are always even numbers
- Click OK, and OK again
- File -> Save as -> Choose a name for your file
and click save
Section 2 - Determining Aspect
Ratio and FPS
To figure out the right settings for encoding we
are going to load our AVI file up in GSpot.
The only settings we are interested are the following:
- Image Aspect Ratio
- FPS
In this example the areas of interest are highlighted
in red, on the pic below
- Image Aspect Ratio: 4:3
- FPS: 23.97
The image aspect ratio was cut out of the pic,
otherwise it would display 4:3. Even if you didn't see 4:3 you can
easily figure out the ratio by using the following.
- 640/480 = 1.333
- 1.333 = 4/3
If GSpot reports an aspect ratio other then 4:3,
or 16:9 then do the following. First
divide the resolutions width, by the resolutions height, in this
case that would be 640 / 480 which gives you a decimal number of
1.333. (If you look beside the resolution in GSpot it already does
this part for you :) ). Note, the number GSpot reports must be one
of the following four. If the number is a bit off then use the closest
number from below.
AVI aspect ratio's
| 4:3 = 1.33 |
| 16:9 = 1.77 |
| x/y = 1.85 |
| x/y = 2.35 |
Write down the settings for these two items, and
close GSpot.
Section 3 - Writing the AVS
script
Avisynth is a frameserver
that acts as a middle-man between your AVI file, and the encoder
(CCE in this case). What this means is that your AVI file gets filtered
by the AVS script, and outputted a frame at a time to the encoder
(CCE) to encode. The script is used for resizing to different resolutions,
adding letterboxing, and other various options and filters that
are not present in CCE, and much more.
The first thing we need to do is setup our AVS
script. To do this open up notepad, or any text editor. I am going
to provide a few example scripts, and go through them. At the end
of this section you should be able to create scripts to deal with
all resolutions, add letterboxing, and convert color to YUY2. Once
you understand this, you can go to http://www.avisynth.org/
for a list of all commands, and filters for more advanced editing
techniques.
If you have an athlon processer,
and are using CCE SP 2.5 and below you will need to create a plugin
to get CCE to open the AVS file correctly.
To create the plugin to get CCE to open up AVS
files on Athlon systems do the following:
- Open up notepad
- Copy and paste the following:
function AddAudio(clip v1) {
v2 = Blankclip()
v1 = AudioDub(v1,v2)
return v1
}
- file -> save as -> save as type: all files;
file name: addaudio.avsi
- place this file in your avisynth\plugins directory
Creating an AVS Script
For what we are doing our AVS script will be quite
simple, and will likely be only 4 or 5 lines long. Below is an explanation
of each line
AVISource("1.avi", False)
just opens up the AVI file for filtering
AddBorders(0,60,0,60)
adds letterboxing. In this case 60 on the top,
and 60 on the bottom
Vertical resolution + top and
bottom border must always = 480.
Ex: 360 + 60 + 60 = 480
LanczosResize(720,360)
Resizes the AVI from it's current resolution to
720x360 (see TMPGenc section for resolutions and letterboxing)
Quicktip - If you need help
determining which resolution to resize to see the TMPGenc
section.
AddAudio()
Calling AddAudio plugin. This is only for users
with athlon processer systems who are using CCE 2.5 and below
ConvertToYUY2()
Converts pixels to YUY2.
Below are four different examples of an AVS script.
Example Script #1:
AVISource("1.avi", False)
LanczosResize(720,480)
AddAudio()
ConvertToYUY2()
Example Script #2:
AVISource("2.avi", False)
AddBorders(0,60,0,60)
LanczosResize(720,360)
AddAudio()
ConvertToYUY2()
Example Script #3:
AVISource("3.avi", False)
AddBorders(0,66,0,66)
LanczosResize(720,348)
AddAudio()
ConvertToYUY2()
Example Script #4:
AVISource("4.avi", False)
AddBorders(0,104,0,104)
LanczosResize(720,272)
AddAudio()
ConvertToYUY2()
Once you setup the script save it as an AVS file
- file -> save as -> save as type: all files;
file name: episode#.avs
Now make sure the AVS script is in the same directory
as your AVI file. You are now ready to setup CCE.
Section 4 - Setting up CCE SP
2.5
Load up CCE SP 2.5, and click on the template
menu, and select standard. If nothing
happens just click on standard again. A new window like the one
below should popup.
Title: Anime Multipass
(VBR) 1 pass 4:3
Whatever you type in this field will be the name
of your template
Video files: checked
Output Video files (m2v, etc)
Video Information file:
checked
File created for VBR (Variable Bitrate) encoding.
When you use a 1 pass VBR as your video encoding method the first
pass creates a file that makes note of how many bits to use for
each frame. The more passes you use the more refined the bit allocation
in the video information file will be.
Audio file: unchecked
Outputs audio files
ES/PS: ES
ES stands for Elementary Stream which is a separate
stream (video only). PS is a Program Stream (Video + Audio). Since
we are encoding the video separate always use ES.
CBR: unchecked
CBR (Constant Bitrate) is a video encoding method
that makes every frame have the same bitrate. Using this makes encodes
take up much more space, with similar, or worse quality then VBR.
One Pass VBR: unchecked
One pass VBR (Variable bitrate) encoding method.
The first pass determines the bitrate for each frame and stores
it in the video information file then the second pass encodes using
the information in the video information file.
Multipass VBR: checked
Multipass VBR (Variable bitrate) can be up to 9
passes. I personally only use 1 pass (which is equivalent to TMPGencs
2 pass). If you choose 9 passes it will actually do 10 passes, 9
for the video information file, and one to encode the file based
on the video information file. Note the more passes you take the
longer it will take to encode, and I can't see any difference in
quality between 1 and 3+ passes, so it's up to you.
MPEG-2/MPEG-1: MPEG-2
DVD supports both, but MPEG-2 supports higher resolutions,
and some other stuff that makes it superior to MPEG-1
Passes: 1
To me anymore then 1 pass (equivalent to 2 passes
in TMPGenc) is a waste of time, and CPU cycles.
Avg: Use a bitrate
calculator to determine this amount
This setting refers to your average bitrate amount.
The higher the value the larger your encode file will be. I recommend
you use at least 4500.
Min: 0
This is the minimum number of bits used in a frame.
For some frames that contain just black you don't want to use too
many bits on a frame like that, so specify a minimum of 0. I doubt
the encoder will ever use zero but this gives it a large range to
work from. (TMPGenc users should use a minimum of 2000, no idea
why it just needs it)
Max: 9800
This the maximum number of bits used in a frame.
The max number of bits a DVD can use is 9800, so you might as well
let the encoder go as high as it can in complicated scenes.
If you are using subtitles, and
multiple audio tracks you might have to lower this value to get
it to work in some DVD authoring programs
Now click on the Video button, and a new window
will popup like the one below
Add sequence end code:
checked
Upper field first:
unchecked
This setting is for interlaced
sources. It just makes the upper field display first.
Half horizontal resolution:
unchecked
This setting is for half-D1
resolutions (352x240).
Half vertical resolution:
unchecked
This setting is for half-D1
resolutions (352x240).
Progressive Frames:
checked
If your source is progressive
use this setting.
Linear quantizer scale:
unchecked
I have no idea what this
setting does. Some people say it gives better quality when checked.
I personally have not noticed any difference, so I leave it unchecked.
Zigzag scanning order:
checked
This setting is used in conjuction
with the Progressive Frames setting.
Quick Compression:
unchecked
I'm not exactly sure what
this setting compresses, but it's not needed, so just leave it unchecked.
DVD Compliant: unchecked
Makes the DVD compliant.
I don't like using this setting because it can do some funky things,
so I leave it off.
Luminance Level: 0-255
This gives you the full color
range, so your encodes don't get washed out colors.
Intra DC Percision:
9
I actually have no idea what
this setting does. Some people say that it's related to your average
bitrate. Personally I have always used 10 with no image quality
problems, but I think I'll switch to 9 since so many people recommend
it.
Aspect Ratio: 4:3
or 16:9
Use the value you recorded
earlier from GSpot. (If your value is >= 1.77 then use 16:9).
Time Code: 00: 00:
00: 00
Leave this setting as default.
I am not sure what the time code refers to, so don't screw around
with it.
Click on the GOP tab, and
fill in the following settings
M=: 3
This refers to the number
of B-pictures
N/M=: 4
This refers to the number
of P-pictures
GOP header: 1
Leave this seeting at 1
SEQ header: 1
Leave this seeting at 1
Restrict Auto I frame
insertion: unchecked
Leave this unchecked
Close all GOP's: unchecked
If your authoring program
has difficulty loading up the encoded file then check this option
Now go to the Quality settings,
and fill in the following settings
Image Quality Priority:
30
For anime I would recommend
between 25-35 just because anime is not as complex as actual movie
footage, and has a lot of flat colours
Anti Noise Filter:
unchecked
Only use this if your source
file has noise in it
Once your finished with the
settings click on the add button, and it will create a new template
based on the settings you just setup. The name of the template is
derived from the title field at the top.
Now go to your Options Menu,
and click on Extensions. Where it says MPEG-2 Video Elementary Stream:
type in m2v.
Section
5 - Encoding
Once your template is setup
right click anywhere on the white background, and click add. Search
for your AVS file, and load it up. Once you have loaded up your
file ensure that you are using the right template, and the settings
are how you want them. You can do all that by right clicking on
the file, and selecting edit. Once you have verified everythings
good to go click on the encode button. I suggest you don't use your
computer, or have any programs running in the background while the
encoding is taking place. A good time to encode it before you go
to sleep, and let the computer encode all night. If you want to
encode more then one file then just load more files up, and select
them all and then hit encode.
Below is an example of having
four different AVS files loaded up ready for encoding.
Once the CCE has finished
encoding your files they should be in m2v format. Now we need to
use a program called pulldown.exe. We need to use this because the
source file being Anime (film) needs to run at 29.97 FPS for NTSC
televisions, but the framerate of our encode is 23.47.
Section
6 - Pulldown
To use pulldown.exe you have
copy it to the directory containing your m2v files. Once it's in
your directory you have to go to the command prompt, and navigate
to the directory containing your m2v files. Now you need to know
a bit of DOS to go to the directory. If your completely DOS illiterate
then move your m2v file to the root of your drive, and follow the
example below substituting D: with the drive letter your m2v files
are on.
DOS example:
- Start -> run
- type cmd
- (You should be in Windows
DOS now)
- type cd\
- type D: (Or whatever drive
your using)
Once your in the directory
containing your m2v files, and pulldown.exe you can run the program.
To run the program you first need to type the following command
pulldown.exe 1.m2v 1-pull.m2v
prog_seq [i] prog_frames [p]
pulldown.exe- is the program
1.m2v- is the input file (the one from encoding)
1-pull.m2v- is the output file (the one with the fixed framerate)
prog_seq [i]- optional. it sets the progressive sequence to interlace
prog_frames [p]- optional. it sets each frame as progressive
If your unsure whether to
use the prog options then don't bother. Your file will be exactly
the same these two settings just change the flags in the M2V file
to the "proper" settings. I'm not even sure what the benefit is.
To speed things up create
a batch file like the one below. Make sure your batch file is in
the same directory as your m2v, and pulldown.exe files.
Here is an example of a batch
file I made that does the pulldown for 6 episodes.
Your video files are now
ready, so you can now start with the audio encoding.
>>
Part 5. Audio Encoding
|