This guide will show you how to encode Divx/Xvid files with either AC3, DTS or MP3 audio to DVD format using Cinema Craft Encoder SP2 (CCE SP2) with AviSynth frame serving. Also additon of hardcoded subtitles to the video will be shown (if you need them).
Also there is an additional chapter for converting VODs to DVD format.
Table of Contents:
Forword: Why CCE with AviSynth?
Chapter A. DivX/Xvid to DVD.
1. Extracting the Audio from the AVI and preparing it for DVD Authoring.
- 1.1. The Audio is in AC3 format.
1.2. The Audio is in MP3 format (VBR or CBR).
1.3. The Audio is in DTS Format.
- 1.3.1. Keeping the original DTS Audio.
1.3.2. Transcoding the DTS Audio to Dolby Digital AC3 format.
2. Preparing the AviSynth Script.
- 2.1. Resizing the video with FitCD.
2.2. Adding hardcoded subtitles to the video. (Optional)
2.3. Script Preview.
3. Encoding with Cinema Craft Encoder.
4. Authoring. (Optional)
Chapter B. VOD to DVD.
1. Explenation of FLV/WMV/ASF/MP4 files.
2. Codec Preparation and Needed Programs.
- 2.1. Codecs Needed for FLV files.
2.2. Codecs Needed for MP4 files.
2.3. Codecs Needed for WMV/ASF files.
2.4. FFDshow Instalation.
2.5. Some Other Codes You Will Need and a Note for AVI files.
2.6. Programs for Cleaning Codec Messes or Setting Codec Merits.
3. Encoding Method.
3.1. Checking If the Codecs Needed Are Installed.
- 3.2. Noticing the Frame Rate.
3.3. Preparing the AviSynth Script.
3.3.1. Resizing the Video with FitCD.
3.3.2. Checking if Your Script and Codecs Work.
3.4. Extracting the Aduio and Reencoding It to AC3.
3.5. Encoding the Video with CCE.
3.6. Authoring (Optional).
Forword: Why CCE with AviSynth?
“Why using CCE with AviSynth instead of something like DVDShrink?”
Check out this comparison of the most popular video software encoders: http://forum.videohelp.com/topic367668.html
In a few words: CCE delivers the best video quality at the fastest encoding rate.
And about AviSynth, AviSynth is a powerful frameserving tool which gives you that ability of manipulating audio and video files in real time, offers scripting support and gives you a lot of options and flexibilty which other tools don’t.
But someone will ask “Hey but why do all manually instead of using some one-click application that supports CCE and AviSynth like Guardian Knot?”
Well, because they are all buggy and tend to create mess then rather simplificate the process + you will learn some basics you will find useful if you will do more video encoding later.
A. DivX/Xvid to DVD.
Programs needed:
a)Video: [list]
[*] Cinema Craft Encoder SP2 (if you are not going to hardencode subtitles SP1 is good too)
[*] AviSynth: http://avisynth.org/mediawiki/Main_Page
[*] FitCD: http://shildebrand.de/
[*] The XviD codec: http://www.koepi.info/xvid.html
b)Audio:
- AC3 Filter 1.46+ (ACM codec is included in the package since v1.45b): http://ac3filter.net/
- VirtualDub (preferably the newest): http://www.virtualdub.org/
- BeSplit for AC3 audio: http://besplit.doom9.org/
- SurCode Dolby Digital Encoder or Aften (http://aften.sourceforge.net/, note: aften is not available in compiled version at SourceForge if you type something like “aften-svn-r723-icl10_1-win32” into google you will stumble across sites which have compiled binaries, however I take no reponsibility if they contain viruses, trojans, malware or whatsoever and harm your computer in any way, so it is “Use at your own risk”.) for MP3 Audio.
- BeSplit, Tranzcode (http://tranzcode.byethost22.com/ )
and SurCode Dolby Digital Encoder for DTS Audio.
c)Subtitles:
- VSFilter: http://sourceforge.net/project/showfiles.php?group_id=205650&package_id=246121&release_id=541232
- Subrecync (from VobSub 2.23 package, http://www.softpedia.com/get/Multimedia/Video/Codec-Packs-Video-Codecs/VobSub.shtml)
d)Optional:
- GSpot (for video information): http://www.headbands.com/gspot/
- Media Player Classic (for AviSynth script preview): http://sourceforge.net/projects/guliverkli/
- TMPGEnc DVD Author (for authoring)
1. Extracting the Audio from the AVI and preparing it for DVD Authoring.
1.1. The Audio is in AC3 format.
If the audio is allready in AC3 format all we need to do is to extract it from the avi file. Open the avi file with VirtualDub, go to "Audio" menu and make sure that "Source Audio" and "Direct Stream Copy" are selected, then go to "File" and select "Save WAV".
![[image loading]](http://i28.tinypic.com/2baas3.png)
This will extract the AC3 track to a WAV file (the WAV format is a simple audio container) and write a WAV header to it, which will cause problems. To remove the WAV header from it launch BeSplit and run the following command :
BeSplit -core( -input track.wav -ouput track.ac3 -type ac3 -fix)
![[image loading]](http://i27.tinypic.com/ou6pe9.png)
This will remove the WAV header from the AC3 track and rename it to ".ac3". If the whole video consists of 2 or more avi files repeat the same for the rest and put the newly created ac3 files in a folder.
1.2. The Audio is in MP3 format (VBR or CBR).
If the Audio is in MP3 format it will need to get decompressed to a PCM WAV first. Open the avi file with VirtualDub, go to "Audio" menu and make sure that "Source Audio" and "Full processing mode" are selected, then go to "File" and select "Save WAV".
![[image loading]](http://i27.tinypic.com/jr5zb7.png)
Note: Dont try to use NanDub or VirtualDubMod for decompressing MP3 VBR audio, both of them cant do it correctly. Also older versions of VirtualDub have the same problem, a newer one is recommended.
The audio will get decompressed to Linear PCM and will be like 1GB+ in size. You can either leave it so and author it in LPCM format, which is a supported DVD format or transcode to a AC3 2.0 track with insignificant (and inaudiable) quality loss. The latter is better to allow higher video bitrate especially if the movie consists of 2 parts and you will burn it to a DVD5 (= 2/4.3GB for sound).
For high-quality transcoding use SurCode Dolby Digital or Nuendo with DD AC3 Plug-in. Both of them are made for professional DD encoding and are licensed by Dolby Laboratories. A good free alternative is Aften ( you can get it from http://aften.sourceforge.net/). Ffmpeggui is also free and is quite easy to use but it delivers not so good results. The standard bitrate for AC3 2.0 is 192kbps, if you think that its not good enough for you you can increase it to 224 or 256kbps. To do a simple AC3 2.0 192kbps encoding with Aften use this command:
aften -b 192 input.wav output.ac3
![[image loading]](http://i31.tinypic.com/10qzbxz.png)
For the transcoding you can use also the SurCode Dolby Digital Encoder, you can use it also to encode DTS to AC3 5.1 . This Encoder has 2 versions: Standalone, which unfortunatelly cant be used unless purchased, and a Plug-In version for Adobe Premiere Pro, which gives you 3 trial encodes and can be modified to encode after the trail encodes are over, so we will use the latter. To use it you just need Adobe Premiere Pro installed, the plug-in is pre-installed in it so nothing more is needed.
Start Adobe Premiere Pro and create a new project, then select from the "File" menu Import and point to the wav file we have created earlier. Then go to File->Export->Adobe Media Encoder. Select either MPEG2 or MPEG2-DVD In the "Format" menu, under "Summary" select "Audio" and unmark everything else, then select "Dolby" as Audio Format and “SurCode for Dolby Digital” as codec, finally select the desired AC3 format under "Audio Codec Mode", in our case 2/0.
![[image loading]](http://i27.tinypic.com/2a0hjjl.png)
Now click on the "Options" button to go to the encoder properties page. If you need to understand what all the options are for take a look at the Dolby Digital Professional Encoding Guidelines : http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf
![[image loading]](http://i27.tinypic.com/207s3de.png)
After the encoding process finishes you will have a DVD compilant AC3 track, which you can author directly in DVD format.
Note: Sometimes something can get wrong with the audio and it goes out of sync. If it happends try to decompress/extract the audio from the video file again to be sure. If its again out of sync you can use AC3 Audio Corrector (for AC3) or Wavelab/Sound Forge (for WAV) for syncing it. Also there are alot of other methods on the internet that might help.
1.3. The Audio is in DTS Format.
Sometimes you can stumble across video files with DTS audio. When you convert them to DVD format you have 2 choises: either preserve the original DTS audio and author the DVD with it or transcode it to AC3, for example to AC3 5.1, if you dont have the required hardware setup for DTS.
1.3.1. Keeping the original DTS Audio.
Again all we have to do is to extract the DTS audio from the avi and remove the WAV header with BeSplit. Open the avi file with VirtualDub, go to "Audio" menu and make sure that "Source Audio" and "Direct Stream Copy" are selected, then go to "File" and select "Save WAV". Then run in BeSplit :
BeSplit -core( -input track.wav -ouput track.dts -type dts -fix)
Now the DTS file is ready to be authored on a DVD. To author a DVD with DTS track you will need to use an advanced athoring software, because the most easy-to-use authoring programs dont support DTS. There are a few authoring programs that can do it, for example Scenarist NT, IFO Edit, DVDMaestro, DVD Lab. Google for tutorials on how work with them.
1.3.2. Transcoding the DTS Audio to Dolby Digital AC3 format.
For transcoding the audio to AC3 format we will use the SurCode Dolby Digital Encoder and more precisely its plug-in version for Adobe Premiere Pro (if you have the standalone version you can use it instead). First the DTS audio needs to be extracted from the avi, see 1.3.1.
Now we have to demux the DTS 6 audio channels to 6 48khz 32bit mono LPCM WAV files, which we will use for the transcoding. Start Tranzcode's GUI and select the input file and "6 Mono Wav" for ouput channels, this will extract the DTS tracks to 6 WAV files and tag them with: FL (Front Left), FR (Front Right), C (Center) , LFE (Low-Frequency Effects), SL (Left Surround) and RS (Right Surround).
![[image loading]](http://i30.tinypic.com/2znwzsj.png)
![[image loading]](http://i30.tinypic.com/5dmrz4.png)
Start Adobe Premiere Pro (im using here the 2.0 version) and create a new Project with 48Khz Audio (select either Standart or Widescreen 48Khz).
![[image loading]](http://i29.tinypic.com/s16v4k.png)
Delete the default Sequence (in the "Project" window, top-left) which is with Stereo audio and create a new one (File->New->Sequence).In the "New Sequence" window set "Video Tracks" to 1, "Master" in Audio to "5.1" and "Mono" to 6 (for the 6 mono WAV files), everything else should be set to 0.
![[image loading]](http://i32.tinypic.com/2pzn2br.png)
Now import the 6 tracks (File->Import) and slide each of them to a track field in the "Timeline" window at the bottom. Open the "Audio Mixer" Window (Window->Workspace->Audio) and move the black dot in the middle of the quadrat field under the audio channel name to the correct place for the channel type, as shown in the diagram, note that the dot in the LFE channel stays in the middle and you should move the knob above its Bass Clef icon (
![[image loading]](http://i28.tinypic.com/25aopao.png)
![[image loading]](http://i30.tinypic.com/2sajnv9.png)
![[image loading]](http://i29.tinypic.com/2cdxxxj.png)
Now select the Sequence name in the "Project" window and then go to File->Export->Adobe Media Encoder. Select "MPEG2-DVD" for Format, "Entire Sequnce" for Range, unmark "Export Video" and mark "Export Audio". Click at the "Audio" tab below and select "Dolby Digital" for Audio Format, "SurCode for Dolby Digital" should be used for Audio Codec, select 3/2 5.1 Surround (or something else if you wont transcode to 5.1) for Audio Coding Mode and mark "LFE On", then hit Options to go to the encoder properties window, 448kbps bitrate should be used for 5.1 Audio, for details on how to properly encode to AC3 see the Dolby Digital Professional Encoding Guidelines : http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf .
![[image loading]](http://i29.tinypic.com/rw7uc7.png)
After the encoding process finishes you will have an 5.1 AC3 file that will have lower sound levels then the original DTS file (consult the DD Encoding Guidelines for sound level if you need sound boosting) and can be authored directly to DVD.
Here is a comparison of the sound waves of the DTS source and the encoded AC3 5.1 track:
![[image loading]](http://i26.tinypic.com/m7x1k6.png)
2. Preparing the AviSynth Script.
AviSynth is a powerfull frame serving tool that takes a video as a source , modifies it using a file with commands and filters called "script" and then passes it to a video application that can read AviSynth Scripts, all this in real-time.
Install AviSynth and make a new txt file in the same folder as the avi files. Open the file with notepad and paste these sample lines (without the comments):
LoadPlugin("C:\WINDOWS\System32\VSFilter.dll" ) //loads the VSFilter plug-in for subtitles, optional for subtitles, more about the subtitles below
AviSource("movie.avi", false, fourCC="XVID" ) //loads the video source, false is an argument for no sound, fourCC says which codec should be used for decoding.
LanczosResize(720,272,0,0,656,272) //resizes the video, read below
AddBorders(0,104,0,104) //adds black bars to the video, read below
TextSub("subtitles.srt" ) //loads the given subtitles, optional
If you dont need subtitles remove the first and last line. Change the avi file name in the second line to match yours, save the changes and change the file extension from ".txt" to ".avs". To get the resizing values we will use FitCD.
2.1. Resizing the video with FitCD.
The videos encoded with Divx/Xvid use square pixels, TV sets use non-square ones, so if no resizing is done the video will deformate. The exact resizing values can be calculated manually but its not a very simple task, so its better to use FitCD, which does a pretty job. Launch FitCD and open your avi file, make sure 1:1 monitor is selected in "source", DVD720 in "destination", if your source was NTSC (23.976fps; check frame rate with Gspot ) the resolution should be 720x480, if it was PAL(25fps) 720x576, if the source is PAL both source and desination "PAL boxes" should be checked, finally make sure the "source" crop is set to "accurate". Now select the resizing algorithm (Bilinear, Bicubic, Bicubic precise or Lanczos) from the bottom right drop-down menu. If you will watch the movie on a wide-screen TV select "Anamorphic" in "destination". Finally, the "Real Aspect" value of the "destination" video should be as close as possible to that of the "source", sometimes FitCD doesnt choose the best rounding so try with different rounding values by moving the "round to" slider in "destination" field to see if you can get more accurate aspect ratio. When you are ready copy the marked lines from FitCD and replace with them the ones in the sample AviSynth script.
![[image loading]](http://i30.tinypic.com/29zs8s8.png)
If you dont trust FitCD you can start educating yourself on the resizing topic using this guide for starters: http://www.doom9.org/mpg/avistretching.htm . More "advanced" information is available on doom9 forums.
2.2. Adding hardcoded subtitles to the video. (Optional)
First you need to install VSFilter and Subrecync. To install VSFilter copy the VSFilter.dll to your Windows/System32 directory. Then run the follwing command to register it:
regsvr32 %Systemroot%\system32\VSFilter.dll
VSFilter will also load subtitles by default when you playback video files and it can get annoying if your video player adds subtitles too, to disable it when you dont use it run the above command with "/u" argument:
regsvr32 /u %Systemroot%\system32\VSFilter.dll .
To install Subrecync you need to install VobSub 2.23, you dont need to install the whole package, selecting Subrecync only is enough.
![[image loading]](http://i31.tinypic.com/xn54w4.png)
Now you need to create a ".style" file with the same name as the subtitles. This file contains information about the subtitle properties such as font, size, position on the screen, etc... . To do this open the subtitles with Sybresync then hit edit. Select font type, screen alignment, colours, etc... . Click on the font button to get the font properties, make sure to select the correct "Script" for your subtitles too. A good size is 14-18.
![[image loading]](http://i28.tinypic.com/2nvw9ad.png)
![[image loading]](http://i27.tinypic.com/9zn5zq.png)
If you want the subtitles to look the same as in your DirectShow player go to its subtitle properties page and see the exact settings. In Media Player Classic Right Click -> Subtitles-> Styles brings you the same properties window as in Subresync. When you are ready click "Save As" and replace the subtitle file, it wont change anything to the original one only add the .style file with the settings. If you will use the same settings again you dont need to do everything all over again, just make a copy if the style file and rename it as the subtitle file (ex. movie.srt -> movie.srt.style).
2.3. Script Preview.
Right-click on the .avs file, select "Open with" and then select a video player capable of opening AviSynth scripts (for example Media Player Classic).
If you have made some mistakes in the script you should recieve an error message telling you where the problem is, for example:
![[image loading]](http://i42.tinypic.com/1088hfm.png)
Your script and files should look like that:
![[image loading]](http://i25.tinypic.com/2hojy87.png)
Note: There is a bug with AviSynth that when you use subtitles with VSFilter and close the video application which loaded the AviSynth script it stays in the background and it loads 100% of the processor/core. For example MPC stays running and you need to go to Task Manager to close it.
3. Encoding with Cinema Craft Encoder.
We will use CCE SP2 mainly because of the subtitle bug with AviSynth, CCE stops resonding after it finishes encoding and you need to force it to close, both CCE SP1 and SP2 do this but SP1 corrupts frequently the last frame and SP2 doesnt. However if you wont use subtitles SP1 can be used too.
After you have previewed your AviSynth script and everything is how it should be launch CCE and add the avs file , then go to Settings. There uncheck "Audio File" since we wont use CCE for audio, check MPEG-2 for DVD as a format, select the same video frame rate as the avi file. If you have a wide-screen TV select 16 : 9 for Aspect Ratio (make sure to aslo had selected Anamorphic in FitCD before) , if not use 4:3. Finally choose the encoding mode, 1-pass CBR/VBR, Mutipass CBR/VBR etc... . Best is Mutipass VBR with 1 or 2 passes. Theoretically Mutipass VBR with 3 or 4 passes gives better quality but practically its undistinguishable from the 1/2 pass VBR mode (check doom9 forums for lenghty discussions). Anything beyond 4 passes VBR is pointless. I recommend using 2 passes VBR, if you have time to waste 3 passes. If you are in a hurry 1 pass VBR is best.
![[image loading]](http://i28.tinypic.com/f24ifl.png)
Next we have to calculate how much the video size should be. The size for all the video and audio files on a DVD5 should be maximum ~4.17GB (1GB=1024MB), thats around 4270MB. We have allready made the audio files so we can calculate the rest for the video, in my case the AC3 5.1 audio was 484MB total in size, which leaves 3786MB for the video. If there is only 1 video file for the whole DVD thats the video size , if there are 2 or more you can just divide by the number of files or calculate the original video size proportions and encode the files with the same size proportions as before. For example i have 2 videos files, using Gspot i can see that the video in avi number 1 was 467MB and in avi number 2 432MB, thats a total of 899MB of video. The proportion of the video in avi number 1 to the whole video size was 467/899 ~ 0,52. Now multiply that with 3786 (the rest of the DVD space for video) and you get 0,52*3876=1966MB for part 1, which leaves 3816-1966=1820MB for part2. So part1 should be encoded with a video size of 1966MB and part2 with 1820MB.
Depending on the video complexity CCE can encode the video with slightly lower or higher size as specified when you use VBR mode. Thats why its always a good idea to leave 10-20MB for buffer. Usually the 4.15-4.17GB mark is quite accurate.
After you have decided how much the video size should be select MiB (not MB, 1MB=1000KB=1000bytes in CCE) and write down the size, then hit encode. If you used subtitles CCE will stop responding after it encodes 100% of the video, just close it, the video wont get corrupt.
![[image loading]](http://i27.tinypic.com/2zr0xtx.png)
While CCE encodes dont do tasks that require alot of processing power (especially if you have single or dual core processor, CCE utilizes up to two cores) to aviod glitches in the video.
4. Authoring. (Optional)
I use TMPGEnc DVD Author 3 to finalize the DVD, its pretty easy to use and it accepts mosts of the DVD audio standarts (doesnt accept DTS). Just start it, select the correct format (NTSC or PAL) accoring to the video, move to the "Source" tab and select your video and audio files, check if the audio file information is correct (bitrate, number of channels, etc..), then go to the "Menu" tab and choose a menu if you need one, you can costumize it as you want. Next go to the "Simulation" and click start , here you can check if the audio is in-sync with the video, go to a few random scenes at the start, middle and end of the movie to check. Finally go to output and chooise a target size from the drop down menu, as mentioned before if you are going to burn the video to DVD5 the total size if your audio and video files should not exceed 4.17GB.
![[image loading]](http://i26.tinypic.com/207mg6h.png)
Check at the bottom if the purple line crosses the 4.7GB mark, if it does your video files are oversized and you should encode them again with smaller size.
![[image loading]](http://i28.tinypic.com/2nvbehi.png)
Finally lets compare a scene from the source video and the encoded DVD Video. The Source was a 2-part Xvid video with AC3 5.1 audio, the DVD Video was encoded using 2 pass VBR mode, the original AC3 5.1 audio was used and size 14 hardcoded subtitles were added.
Source:
![[image loading]](http://i28.tinypic.com/16h58qq.png)
Encoded Video:
![[image loading]](http://i26.tinypic.com/20sj2up.png)
Source (Full Screen):
![[image loading]](http://i29.tinypic.com/91m4ig.png)
Encoded Video (Full Screen):
![[image loading]](http://i27.tinypic.com/34qpg2a.png)
The last screenshot is a bit lighted-up because of the MPEG-2 codec that is used.
B. VOD to DVD.
1. Explenation of FLV/WMV/ASF/MP4 files.
Usually the SC VODs being uploaded are either FLV/WMV/ASF/MP4 or sometimes AVIs. All these are just containers. These only define how you store the data (like an archive) not which codecs are used to encode the audio/video (i.e what kind of data). This means that there can be different combinations of codecs used which in practice means that you can have for example 2 different MP4 files and be able to play the one of them (because you will have the right codecs to encode the video/audio) but not the other one (because you won’t have the needed codecs installed).
Further more the MP4 and the WMV/ASF files can contain either Constant Frame Rate (CFR, same constant video frame rate all over the entire video ) Video or Variable Frame Ratio (VFR, frame rate can vary from frame to frame, i.e. 30 fps, 35 fps) Video. VFR Videos are kind of hard to deal with and need more processing, luckly I haven’t stumbled yet across a vfr VOD uploaded here (or maybe I haven’t searched hard enough ?). You can identify VFR WMV/ASF files using WMVTIMES ( http://forum.doom9.org/showthread.php?p=827324#post827324 ) and VFR MP4 files using mp4dump from MPEG4ip package or simply enable the Detailed Frame Count information in Media Player Classic and observe the frame rate long enough . Since I don’t have enough free time right now for now I will discuss here only CFR video encoding and will add VFR chapter at some point later.
2. Codec Prepation and Needed Programs.
Programs needed (Do NOT] install anything from the codec department untill you read the whole paragraph and find out what you need and what not. Its not a bad idea to create a system restoration point.) :
a)Video:
- Cinema Craft Encoder SP2
- AviSynth: http://avisynth.org/mediawiki/Main_Page
- FitCD: http://shildebrand.de/
- FFDShow tryouts: http://ffdshow-tryout.sourceforge.net/
- VirtualDub (the newest version): http://www.virtualdub.org/
- GSpot (for video information): http://www.headbands.com/gspot/
- FLVSplitter 1.0.0.5 for FLV Files: http://sourceforge.net/project/showfiles.php?group_id=205650&package_id=246121
- Haali Media Splitter: http://haali.cs.msu.ru/mkv/
b)Audio:
- AC3 Filter 1.46+ (ACM codec is included in the package since v1.45b): http://ac3filter.net/
a new version of VirtualDub (preferably the newest): http://www.virtualdub.org/ - Aften (http://aften.sourceforge.net/, note: aften is not available in compiled version at SourceForge if you type something like “aften-svn-r723-icl10_1-win32” into google you will stumble across sites which have compiled binaries, however I take no reponsibility if they contain viruses, trojans, malware or whatsoever and harm your computer in any way, so it is “Use at your own risk”.).
d)Optional:
- FLV Plugin for VirtualDub: http://moitah.net/
- Media Player Classic (for AviSynth script preview): http://sourceforge.net/projects/guliverkli/
- TMPGEnc DVD Author (for authoring)
- MediaInfo (for finding out correct fps value): http://mediainfo.sourceforge.net
- RadLight Silver Manager for Codec Management (use with caution): http://www.videohelp.com/tools/RadLight_Filter_Manager
Before you proceed make sure that there is not a codec mess on your machine at the moment, especially when you do encodes from these types of files its creates a big headache.
2.1. Codecs Needed for FLV files.
For FLV files you will need the FLV splitter (installation is done buy putting the .ax files into your system32 folder, usually C:\Windows\System32 and registering them with this command:
regsvr32 C:\Windows\System32\Filename.ax
unregistering (i.e. uninstalling) is done video the same command with /u swtich:
regsvr32 /u C:\Windows\System32\Filename.ax
Also is good to install the FLV Plugin for VirtualDub (simply put it into VirtualDub’s plugin folder).
2.2. Codecs Needed for MP4 files.
For FLVs you will need to install the Haali Media Splitter, make sure to enable MP4 in the installation options.
2.3. Codecs Needed for WMV/ASF files.
Usually if you have updated Windows you should play these fine. But if they don’t open go to Video Decoder Options in FFDShow (accessible from the start menu) and enable libavcodec for the WMV1, WMV2, WMV3 formats.
2.4. FFDshow Instalation.
Regardless if you will you will use all of its encoding abilities you will need FFDshow so install it, you can the codecs you don’t want it to handle. Also go to the folder where you installed ffdshow and copy FFDShow.ax to you your system32 folder (usually C:\Windows\System32) and register it (see above in 2.1. how to regisger/unregister codecs).
2.5. Some Other Codes You Will Need and a Note for AVI files.
- AC3Filter: for the different music files.
- FFDShow tryouts: For the rest audio/video codecs that is not covered from the above points, for example H.264/AVC video or AAC audio, quite a lot of VODs are using them. Also set "Raw Video" to all supported.
If you love FFDShow a lot you can use it only combined with Haali’s Media Splitter and the FLV Plugin, make sure to enable the different formats in the Audio and Video Encoding Options
like: FLV1, VP3, VP5, VP6, VP6F (all used in FLV files), WMV1, WMV2, WMV3 (WMV/ASF files) , H264/AVC (MP4).
To determine which codec do you need open the file with Gspot and look in the video audio codec information:
Then enable the corresponding format in the audio/video encoding options of ffdhow. - If you have trouble playing some of the AVI files check the codec required to play with Gspot, and enable them in both VFW Configuration and Video Configuration options of ffdshow. VFW are a type of AVI files.
2.6. Programs for Cleaning Codec Messes or Setting Codec Merits.
- Gspot: Go to System -> List Codecs and Other Filters. You can set merits there and register, unregister filters. Never unregister quartz.dll!!!
- Radlight Filter Manager: Go to DirectShow Filters. Use it VERY carefully only do 1 change at a time and notice your changes.
3. Encoding Method.
3.1. Checking If the Codecs Needed Are Installed.
Enable the codecs used if needed.
![[image loading]](http://i42.tinypic.com/2sb92k3.png)
3.2. Noticing the Frame Rate.
To check the frame rate run Gspot, if it’s not displayed open Media Player Classic and enable the Detailed Information, then aboserve the frame count and calculate how much it adds per second.
You can also use MediaInfo: http://mediainfo.sourceforge.net .
Usually the VODs are either with frame rate close to 30fps like 29.97, 29.971 or something simular or with some higher frame rate like 35. We will be converting everything to it’s closest frame rate, usually 29.97 since the VODs are usually 30fps+.
The Video conversion is the same in all cases but if the vods have some wicked frame rate like 33 fps the audio file will get desynced. What you will need to do is called TimeStreching which means you will have to stretch you file to match you video file duration so you don’t experience video desync. To do this you need to import the extracted WAV file into some audio processing software like Adobe Audition, and strech the audio by the same % as you have “stretched” the video: For example if you have converted a VOD from 33 to 29.97 fps that’s (29,97/33) * 100 = 90.81% stretch, also make sure to select the option for preserving the original pitch. I will cover this issues later too since I don’t have time right now.
3.3. Preparing the AviSynth Script.
Make a new txt file in the same folder as the vod file. Open the file with notepad and paste these sample lines (without the comments):
DirectShowSource("movie.extension", fps=30) //loads the video source, sets the correct fps, use the fps value you got in 3.1
LanczosResize(720,272,0,0,656,272) //resizes the video, read below
AddBorders(0,104,0,104) //adds black bars to the video, read below
ConvertToYUY2() // converts to colorspace to a type that CCE accepts
Change the avi file name in the second line to match yours, save the changes and change the file extension from ".txt" to ".avs". To get the resizing values we will use FitCD.
3.3.1. Resizing the Video with FitCD.
Same as as paragraph 2.1. in the Divx/Xvid to DVD Section. Scroll up to find it. From there you only need the resizing values, put them in your AviSynth script.
3.3.2. Checking if Your Script and Codecs Work.
The best way to check is to load the original Media Player that comes with WindowsXP (note that this is note the flashy MP you know) as it a primite player that uses the default DirectShow filters. Simply put the *.avs file in it, if the audio and video play without a problem then everything is ok, however if there is a problem you need to see which codec(s) cause it (probably duplicated codecs or missing ones) and fix it before you proceed. You can run the original Media Player by typing “mplayer2” in Start->Run.
![[image loading]](http://i43.tinypic.com/ok5w7n.jpg )
3.4. Extracting the Aduio and Reencoding It to AC3.
After you made sure that you are your codecs and script is correct open VirtualDub then open the *.avs file with it. Note that you can’t open the MP4/WMV/ASF directly with VD because its made only for AVI files, if you have installed the FLV Plugin you can open FLV files with it directly. That’s why we are using the AviSynth script.
Most of the VODs (if not all) are with MP3 or equavalent stereo aduio, if you stumble on enything more extravagant check the audio encoding sections in DivX/XviD to DVD chapter.
We will simply extract the audio in a WAV format first and then reencode it with Aften at 192 kbps bitrate (64 kps per channel) , more then enough for this kind of audio quality.
Go to the Audio Menu in VirtualDub and select “Full Processing Mode”, then select “Save WAV” from the File menu.
Then run Aften using these command to produce an 192 kbps AC3 2.0 stream:
aften -b 192 input.wav output.ac3
![[image loading]](http://i40.tinypic.com/9km32u.png )
3.5. Encoding the Video with CCE.
Launch CCE and add the avs file , then go to Settings. (if CCE crashes when adding the avs file that’s because of a codec problem you haven’t solved) . There uncheck "Audio File" since we wont use CCE for audio, check MPEG-2 for DVD as a format, select the same video frame rate as the avi file. If you have a wide-screen TV select 16 : 9 for Aspect Ratio (make sure to aslo had selected Anamorphic in FitCD before) , if not use 4:3. Finally choose the encoding mode, 1-pass CBR/VBR, Mutipass CBR/VBR etc... . Best is Mutipass VBR with 1 or 2 passes. Make sure to select MiB as a file size (that’s the equivalent of the Window’s MB in CCE) so you can calculate correctly, then select some maximum size you think is enough (you don’t want to fill the entire DVD with 1 VOD) I would say multiply the VOD’s original size by 1.5 and set such size as maximum. Also make sure to have select the correct frame rate. Then hit Encode and wait for it to finish. CCE uses up to 2 cores/processors, don’t use do any CPU intensive activities while you are encoding so you don’t get a glitched video.
![[image loading]](http://i44.tinypic.com/142vrsp.png)
Here is a comparison if the end result and an original VOD:
Source:
![[image loading]](http://i40.tinypic.com/2nqr1ci.jpg)
Encoded Video:
![[image loading]](http://i44.tinypic.com/qrnq53.jpg )
3.6. Authoring (Optional).
I use TMPGEnc DVD Author 3 to finalize the DVD, its pretty easy to use and it accepts mosts of the DVD audio standarts (doesnt accept DTS). Just start it, select the correct format (NTSC or PAL, this depends on the resolution you used in your FitCD script and also in CCE encoding options , 720×480 = NTSC, 720×576 = PAL) accoring to the video, move to the "Source" tab and select your video and audio files, check if the audio file information is correct (bitrate, number of channels, etc..), the cool thing here is that you can add a 2nd (or 3rd, etc…) audio track to the clip with commentaries or something else. Ignore any “Bitrate is too high” kind of warnings TMPG cant recognize good Variable Bitrate Video.
![[image loading]](http://i40.tinypic.com/qpl3dx.png)
![[image loading]](http://i43.tinypic.com/doaout.png)
Then go to the "Menu" tab and choose a menu if you need one, you can costumize it as you want with some default templates or you can create a custom ones.
![[image loading]](http://i42.tinypic.com/2pobckp.png)
Next go to the "Simulation" and click start , here you can check if the audio is in-sync with the video. To do so go to the open the VOD go to some points at the beginning and the end of the video where there are moments you can notice if the sound is in sync, for example at beginning when the observer player opens the player dialog and clicks on the buttons or at the end when someone says “gg”. For example notice how much time is there in the original VOD between the “gg” message and the message sound, check if there is the same time difference in the encoded video. Note that since you have changed the video frame rate the same scene may not be at the same time spot
![[image loading]](http://i40.tinypic.com/fabdps.png )
. Finally go to output and chooise a target size from the drop down menu, as mentioned before if you are going to burn the video to DVD5 the total size if your audio and video files should not exceed 4.17GB.
![[image loading]](http://i41.tinypic.com/302o2uo.png)
I’m planning to write the paragraphs for VFR Videos and for the TimeStretching of the Audio when I got time.