Part II – Converting the Video
0) At this point you should know what 'case' type each video and audio file is you've just ripped. If you don't, check them and make a list of what you'll need to do.
1) Load your video file to be converted in DGIndex. Make sure Video/Field Operation is set to "Ignore Pulldown Flags". (If you need more info on this program read the manual.) Click File/Save Project and output the .d2v file to the same directory.
2) Create an avisynth script making the tweaks you need for that particular video.
If you are converting from letterbox to anamorphic you will need to Crop(0,Top#,0,-Bottom#) the black borders before resizing. You should see 72 lines (unless the AR is less than 1.77:1) of black above and below, but usually they’ll put more on the bottom. Reposition the movie vertically to taste. Just make sure the crop equals 144 lines.
Use this webpage if you need help:
Aspect Ratio Calculation Tool: http://www.haku.co.uk/ARCT.html.
Suggested scripts (same video types/case numbers as above). Feel free to riff on these however you like (deblocking, removing noise/grain, tweaking colors, brightness, levels, etc.)
Filtering can of course improve your picture, or make it worse.
At minimum check your video for blocking compression artifacts. DGDecode can fix this with the 'CPU=' option: http://neuron2.net/dgmpgdec/DGDecodeManual.html#MPEG2Source.
Stronger the post-processing can mean a softer picture, but complex scenes or panning shots may have macroblocking artifacts you want to clean. CPU=1 or 2 can usually improve even good transfers with imperceptible negative effects.
The ConvertToYUY2() is added to the scripts assuming you will be using CCE. If you are using an alternate encoder, change the colorspace as needed.
Case 1:
mpeg2source("movie.d2v")
spline36resize(720,480)
assumefps(23.976)
converttoyuy2()
Case 2:
mpeg2source("movie.d2v")
spline36resize(720,480)
assumefps(25)
converttoyuy2()
Case 3:
mpeg2source("movie.d2v",iPP=true)
loadCPlugin("yadif.dll")
yadif(mode=1) # Bob mode - generates double the framerate
Srestore()
spline36resize(720,480)
converttoyuy2()
Check http://avisynth.org/mediawiki/Srestore for other options and suggested scripts for Srestore. Tweaks may improve your output.
There are numerous Bob-ers out there, but for speed/quality I prefer Yadif. http://avisynth.org/mediawiki/Yadif
Case 4: (Your final video WILL be 29.97i.)
mpeg2source("source.d2v")
loadCPlugin("yadif.dll")
yadif(mode=1) # Bob mode doubles framerate
Spline36Resize(720,480)
ChangeFPS(59.94) # Creates duplicate fields. Use ConvertFPS if you prefer blended fields.
AssumeTFF()
SeparateFields()
SelectEvery(4,0,3)
Weave()
converttoyuy2(interlaced=true)
ConvertFPS is frequently recommended. It creates blended fields in order to attain the extra frames.
ChangeFPS is a good alternative since it will just make duplicates of existing frames. Unfortunately this may effect the smoothness of motion.
I've been told using MFlowFPS (http://avisynth.org.ru/mvtools/mvtools2.html) is even better. It is suppose to extrapolate new frames.
I have mixed emotions about its output, but I'm passing this information on anyway.
super = MSuper(pel=2)
backward_vec = MAnalyse(super, isb = true)
forward_vec = MAnalyse(super, isb = false)
MFlowFps(super, backward_vec, forward_vec, num=60000, den=1001, ml=100)
Note: If you get a really good quality deinterlacer (yadif in Mode=0 is considered pretty good) you can create 25p content from this type of video and then treat it like Case 5. The process is more complicated and the better your desired quality, the better the deinterlacer and the more powerful of a computer you will need.
You're probably better off keeping things interlaced like the source.
Case 5: (same as Case 2)
mpeg2source("movie.d2v")
spline36resize(720,480)
assumefps(25)
converttoyuy2()
Case 6:
To be fair, I've never actually converted this type of video.
My best guess is to use the same script from Case 4.
Case 7: (The script while technically imperfect is vastly easier than being right.)
mpeg2source("movie.d2v")
spline36resize(720,480)
fdecimate(23.976)
converttoyuy2()
3) Repeat for all of your video assets. Index with DGIndex and prepare a specific script for each piece.
4) You need to figure out the bitrates for each asset.
The best way to do this is calculate how much space the original asset took up (video+audio+subtitles) as a percentage of the disc. (Get the numbers from your post-DVD Shrink disc, not the original.)
So for example if your original movie took up 3.88gb out of 4.03gb (discs aren't always full) you want it to use 3.88/4.03 = 96.3% of your final DVD (4.37gb/4482mb for a DVD5, 7.95gb/8144mb for a DVD9). (1gb = 1024mb)
That's .963 * 4.37 = 4.20gb or 4308mb.
This math also works if your original is a DVD9 and you're going to a DVD5 or vice versa.
Grab VideoHelp's bitrate calculator: http://www.videohelp.com/tools/VideoHelp_Bitrate_calculator and click the "Advanced" button.
Plug in the length for your new video (if you're changing the playback speed, get this number from your AviSynth script by playing it in a media player or loading it in VirtualDub).
Set the “Audio Bitrate” to account for all audio tracks you are keeping. If you have multiple streams of different bitrates, you may have to be creative. (192kbps + 448kbps = 1 Track of 640 kbps or 2 Tracks of 320 kbps)
Set the ISO __ MB/DVD to 0 (you will have to account for those 25MB of overhead, just not more than once.)
Set "Custom Size" for the DVD to reflect the number you just calculated. Still 4308mb in my example.
Now this won't be perfect. If you've removed audio streams, it will account for that and you'll use that extra space.
You will be re-encoding the menus, and if you stripped other clips or content from the disc, you'll have more wiggle room and can go a little higher.
Your encoding software will also need a maximum bitrate. Max bitrate is shown on the calculator, and in theory 9800kbit/s is the max total allowable for a DVD. I prefer to give extra headroom. Subtitles or variable bitrate spikes can take you too high. I usually subtract about 300-800kbps from the maximum calculated here and never use higher than 8800kbps.
5) I prefer CCE for video encoding, but use what you like as long as it can handle AVS files.
Make sure you keep straight which of your videos are widescreen, fullscreen, interlaced, progressive, 23.976, 25 or 29.97 and set your encoder accordingly.
You shouldn't need more than 3-5 passes (according to Doom9), or you can try OPV as long as you don’t exceed your target bitrate.
6) With DGPulldown, add pulldown flags as needed.
Case 1 & 7: “23.976-->29.97”
Case 2, 3 & 5: “25-->29.97”
Case 4 & 6: No pulldown needed.
Browse to your encoded video file. A destination file name will be automatically chosen.
Click the button that corresponds to the pulldown you need and click the Convert button.
7) Repeat for all your video assets.
Part III – Converting the Audio
There are plenty of pieces of software for converting audio. BeLight isn't perfect, but it does cover all the bases for what we need and while giving the most control. It is buggy, but you don't have to worry about your output as long as you double check the command line before encoding.
0) If your movie is case #1, it needs to be slowed down and re-encoded. For all other cases, just go to Part IV.
1) Find out all you can about your audio.
If your source is PCM (not common. Mostly concert DVDs.) and you want to keep it that way you can (just skip step 3), or you can re-encode to Dolby Digital (don’t skip any steps).
If your source is DTS you can either re-encode to high bitrate AC3 (Dolby Digital @ 640kbps is considered comparable to DTS @ 768kbps) or convert DTS to DTS. Either way, you’ll still need to slow the audio as shown in steps 2 and 3.
See Appendix A for more info on working with DTS.
For Dolby Digital you can get information on the file in a few ways. One is to play it in a directshow player that lets you view codec properties. Open up details for AC3Filter and click to the SPDIF tab. There you can view decoder information. Scrolling down and you’ll see the bitrate, number of channels, clev (center mix), slev (surround mix) and dialnorm (dialog normalization). Write these numbers down.
You can get the same info in Sonic Foundry Soft Encode by opening the AC3 file in 'frame view'. Here you may see additional information. Make a note of whatever you find.
I prefer Sonic Foundry Soft Encode for Dolby encoding which means using an intermediate wave file. If you are a fan of BeLight/BeSweet/Aften, you can do this all in one step and go from AC3 to AC3.
2) Decode to a wave file with BeLight.
File (menu)/Add Files to Load the PAL audio, click the WAV/PCM tab and click the "WAV" button as well as "16 Bits (Six) Mono Waves".
If your source is stereo, use "16 Bit Stereo" instead.
If the source is 1-channel mono, you can keep it as 1 channel, but I feel it’s more professional to use “16 Bit Stereo” to make it a 2-channel mono track
Don't select any SSRC, Boost, resampling etc. You want this as untouched as possible. Check the "(Azid) Dynamic Compression" and "Mode" buttons, but don't worry about the specific settings, we'll deal with that later.
You should notice that if you added a Delay to the file name, BeLight will have automatically checked the Delay option and filled in the number. That's good. If it didn't added it now.
Click the Advanced Settings button. Under SoundTouch, check the "Covert Frame Rate from ... to ... fps" button and enter: 25000 and 23976 in the boxes. Uncheck everything else (except perhaps the Output Log File if you want it). Click Ok.
Click “View or Edit BeSweet Command Line” and verify your settings, which should look like this (but may be wrong since BeLight is quirky):
"C:\BeLight\BeSweet.exe" -core( -input "c:\work folder\VTS_03_1 - 0x80 - Audio - AC3 - 2ch - 48kHz - DRC - DELAY 0ms.AC3" -output "c:\work folder\VTS_03_1 - 0x80 - Audio - AC3 - 2ch - 48kHz - DRC - DELAY 0ms.wav" -6ch -azid( -c normal ) -ota( -hybridgain -r 25000 23976 )
If you have a delay, you should also see it listed in the -ota section.
-ota( -d -8 -hybridgain -r 25000 23976 ) would be for a -8ms delay.
[u]Now make a these changes:[/u]
Where it says: "-azid (-c normal)", change it to read: "azid (-c none)".
Where it says: "ota( -hybridgain -r 25000 23976 )", change it to read: ota( -r 25000 23976 )
The gain type may vary, just remove it. (Also leave any -d switches, that's your delay.)
This prevents the volume from being maximized or dynamically altered.
You should now have:
"C:\BeLight\BeSweet.exe" -core( -input "c:\work folder\VTS_03_1 - 0x80 - Audio - AC3 - 2ch - 48kHz - DRC - DELAY 0ms.AC3" -output "c:\work folder\VTS_03_1 - 0x80 - Audio - AC3 - 2ch - 48kHz - DRC - DELAY 0ms.wav" -6ch -azid( -c none ) -ota( -r 25000 23976 )
Click Run and wait a long while.
Note: If you prefer to encode directly to AC3 instead of using 16 Bit (Six) Mono Waves, click the AC3 tab, select Stereo or 5.1, use Aften (a pretty good quality encoder), click Bitrate, and move the slider to the bitrate you want (you’ll probably want to match the original).
When you edit the Command Line (as detailed above), make sure you give your output file a different name than your input file or nothing will happen.
If the when previewing the command line, things seem completely wrong, close BeLight and re-open it. It will usually get things working again.
3) Encode back to Dolby Digital with Soft Encode.
File (menu)/Open your 6 Mono Wave files (or single Stereo Wave file).
Make sure your channels match up. If your source was stereo or mono it should automatically be mapped correctly.
The six mono files each have had their names appended with C, FL, FR, LFE, SL, or SR representing Center, Front Left, Front Right, Low Frequency Effects, Surround Left and Surround Right respectively.
On the left side for each channel you’ll see a mini representation of speaker positions. Click the speaker position that corresponds to each file’s extension.
Go to Options (menu)/Encode Settings.
On the left is the “Audio service configuration”.
The Data Rate is your bitrate. It’s best to use the same or better than the original PAL file to prevent further degradation (Dolby Digital is a lossy format).
Audio coding mode is the speaker configuration. It’s in the format of Front/Rear. So 2/0 is 2 front speakers, no rear speakers (stereo) and 3/2 is 3 front speakers and 2 rear speakers (5.0). Check the LFE enable if you are using 5.1 (or 4.1, etc).
Set the Dialog normalization to the number you found Step 1 of Part III.
If your source was not originally AC3, you’ll want to read this guide http://forum.doom9.org/showthread.php?p=332259#poststop section on “Referencing Volume to a Known Level - Dialogue Normalization”.
On the right side under the Bit Stream tab, fill in all the settings to match the original mix. I’ve found no point to the copyright bit and original bit stream options so feel free to ignore them.
Click the Preprocessing tab. Uncheck everything here. You can set the Surround channel processing options if you know you need to, but otherwise forget it.
If your source was DTS or PCM you’ll probably want to use Soft Encode’s help file suggested settings.
Dynamic range compression should be Film:Standard for pretty much all movies. You can use Film:Light if you have a generally quite movie with little variation in volume throughout. (I have yet to find any software that can read the original file’s Compression characteristic so that’s our scientific method.)
Click OK to close the Encode settings then File (menu)/Encode and pick a file name, click save and wait while Soft Encode does its thing.
4) Repeat for all audio assets.