DVD-to-Creative Zen Conversion (Handbrake)

If you’re reading this post then you either don’t like my AviSynth/DGIndex method or you don’t like scripting in general. Either way, welcome. This method has much more mass appeal. It’s simplicity is almost ridiculous. Will I stop using the scripting method? Not on your life.

Shall we?

Preparation
Not really anything to prepare.

Software
Handbrake

Download and install Handbrake. Nothing groundbreaking here. It’s lightweight and easy on the eyes. After it’s installed, run it.

1. Click Browse and select the folder that contains the ‘AUDIO_TS’ and ‘VIDEO_TS’ folders of your DVD rip.
2. Select the Title. (Hint: look at the length of each one listed if there is more than one)
3. Click Browse and select a destination folder for the file-to-be. Make sure to select ‘AVI’ in the bottom drop-down of that Browse dialog window.
4. Pull down the Encoder menu and select XviD.
5. Pull down the Audio Encoder menu and select MP3.
6. Pull down the Crop Select Option menu and select No Crop. (I don’t trust ‘Automatic’ here)
7. Under Size, type ‘320′ in the Width field. Height will be filled in automatically.

Click on the Video tab and follow the next screen shot.

8. Under Advanced Encoding Settings, populate the check box if you want to enable 2-Pass Encoding. Personally, I don’t feel it’s necessary but to each his own.
9. Under Quality in the Avg. Bitrate field, put in anything between 300 and 700. You can go lower or higher, but again to each his own. Zen supports up to a combined audio/video bitrate of 1.0 Mbps so use your best judgment.
10. Under Framerate, select what corresponds with your DVD rip. Generally, movies are 23.976 and most TV shows and television-based material is 29.97.

Click on the Audio & Subtitles tab and follow the last screen shot below.

11. Under Audio Tracks, pull down the Track 1 menu and choose your preferred audio stream. Note: If there’s more than one, look for English (AC3) (Dolby Surround) and select it if available. If you don’t see that option, no biggie.
12. Pull down the Track 1 Mix menu and select Stereo.
13. Under Audio Quality, choose your preferred Bitrate and Sample Rate with the pull-down menus.

Click Start in the upper-left corner and go have a beer. You’ve earned it.

DVD-to-Creative Zen Conversion Tutorial (WMV)

If you’ve seen my previous post about encoding your DVD rips to Xvid with MeGUI than the battle for WMV conversion is 90% done. This post replaces the “Encoding with MeGUI” section of that guide. Encoding to WMV will utilize the same AviSynth script that we created there and that’s where this guide begins.

Windows Media Encoder going forward will be referred to as WME.

Preparation
Windows Media Encoder
Windows Media Player 11 (if you haven’t already upgraded)

If you don’t want to install Windows Media Player 11, you’ll still need the upgraded codecs that come bundled with it. You can download a standalone distribution here.
Windows Media 11 Format Runtime

WMCmd.vbs is a very small file that is included in the WME download and in fact the command-line version of WME. Officially, WME does not accept AviSynth scripts as input. However, a very generous Microsoft employee has (legally) taken it upon himself to “hack” this file to do so. Grab the file here. After you’ve done that, go to the install path of WME and find WMCmd.vbs that’s already there. Rename it anyway that you want - just don’t delete it. Then replace it with the hacked file.

Yay. We’re on our way.

Procedure
We’re going to create a batch file…well…because it’s easier than typing all of the command-line arguments directly into a non-point ‘n’ click world. It allows for easier entry and editing of said arguments. Start by opening up Notepad or your favorite plain text editor. Then copy and paste the following:

“C:\WINDOWS\system32\CScript.exe” “C:\…\WMCmd.vbs” -input “C:\…\my-script.avs” -output “C:\…\my-video.wmv” -v_codec wmv9 -v_mode 0 -v_buffer 5000 -v_bitrate 500000 -v_keydist 30 -v_quality 10 -v_performance 20 -pixelformat yv12 -v_profile sp -a_codec wmastd -a_setting 96_44_2 -a_mode 0

A few things to consider about all of that:

1. The path to WMCmd.vbs is relative because you could’ve installed WME wherever you wanted to so you’ll have to fill that in. The same goes for the path to your script and your output file.
2. -v_bitrate is video bit rate in bits/second. Don’t be too liberal here. I would stay in the range of 300 kbps to 700 kbps.
3. -a_setting is audio parameters - example 96_44_2 is 96 kbps, 44.1 kHz, 2-channel stereo. All of these can vary if you wish but again I wouldn’t stray too far off.

Save the text file and give it a bat file extension, foregoing the usual txt extension.

Got it? Good. We move on.

Before we dive in to command-line stuff, let’s make it easy to start up a command-line window for WME quickly and efficiently. Open up the folder where WME was installed and then open up a second window and navigate to the C:\Windows\system32 folder. In that second folder hit the letter ‘C’ on your keyboard and scroll down until you find cmd.exe. Right-click on it and select Copy. Then switch to the first window, right-click on an empty space and select Paste. Close the second window. In the first window, right-click and drag cmd.exe to your Desktop. On the context menu that appears, select Create Shortcuts Here. Double-click your new shiny shortcut.

My God we’re good. :-)

To call up our batch file for WME all that we have to do is type in the full path location and file name of the batch file itself.

Click Enter and watch video conversion magic happen right before your eyes. When the encoding is finished you will have a WMV file that will seamlessly and quickly sync to your Zen.

DVD-to-Creative Zen Conversion Tutorial (XviD)

This is what the Zen looks like

Preparation
You will need to download and install some free and legal software for this guide.

DVDFab HD Decrypter
DGMPGDec
AviSynth
VirtualDub
NicAudio (plug-in for AviSynth)
TDeint (plug-in for AviSynth)
MeGUI

Rip DVD
Launch DVDFab HD Decrypter and then insert the DVD into your DVD-ROM drive.

dvdfab-main

1. Switch to Main Movie mode. We don’t need to unnecessarily rip special features and other extra content.
2. Choose a destination folder for the ripped files.
3. Select the main movie title VOB from the list (Hint: look at the Play Time column to determine this).
4. Select the audio track that you would like to include.
5. Click the Start button to begin the rip.

Index MPEG-2 Stream
Next we’ll need to index our MPEG-2 stream so that AviSynth can properly send it through to the XviD encoder. We want to open the folder that contains our newly-ripped DVD files and launch DGIndex also, found in the install path of DGMPGDec.

rip folder main

Sort the files so that the VOB files are grouped together and sequential. You can ignore the IFO and BUP files. Also, pay no attention to the fact that I switched movies amongst my screenshots. ;-) They serve merely illustrative purposes, but the idea remains.

With your mouse and CTRL key, select all of the VOB files and drag them to DGIndex.

dgindex-main

Pull-down the Audio menu and select Output Method - Demux All Tracks

dgindex-audio

Now pull down the Video menu and select Field Operation - Forced Film

dgindex-video

Note: This step assumes that the content on your DVD is film-based (23.976 FPS). Leave comments for this post and let me know if you need to know what to do in other cases.

With all of that done, all that’s left is to pull down the File menu and select Save Project. Select a destination folder and let it go. DGIndex will scan the entire length of the movie quicker than real time; it should only take a few minutes. When it’s finished, you will have a D2V file and an AC-3 file.

AviSynth Script
Open up notepad, or your favorite plain text editor, and copy the following lines into it:

loadplugin(”…\Program Files\AviSynth\plugins\…\dgdecode.dll”)
loadplugin(”…\Program Files\AviSynth\plugins\…\nicaudio.dll”)
loadplugin(”…\Program Files\AviSynth\plugins\…\tdeint.dll”)
v=mpeg2source(”…\movie.d2v”).lanczosresize(320,240).tdeint()
a=nicmpg123source(”…\movie.ac3″).ssrc(44100)
clip=audiodub(v,a)
return clip

Of course, it’s up to you to complete the file paths and names in each line. The text above would never work as is - remember- illustrative purposes only. Once that is done, save it with a *.avs extension and open it in VirtualDub. You should be able to scrub through the film.

vdub-main

Encoding with MeGUI
Since the AviSynth script works in VirtualDub, it will work in MeGUI.

megui-videosteps

1. Click the Open button and select your script.
2. Click the Open button and choose your destination and filename.
3. Pull down the Codec menu, choose XviD, and then pull down the File Format menu and choose AVI.
4. Pull down the Video Profile menu and choose “XviD ‘>90% comp. check’(HQ)”.
5. Click on the Config button.

megui-xvid-config

1. Pull down the Mode menu and choose CBR - constant bit rate.
2. In the bit rate field, type 500.
3. Pull down the Motion Search Precision menu and choose 6 - Ultra High.
4. Pull down the VHQ Mode menu and choose 4 - Wide Search and then click OK.

Now we move on to Audio.

megui-audiosteps

1. Click the Open button and choose your script again.
2. Choose your destination and filename.
3. Pull down the Codec menu and choose LAME MP3.
4. Pull down the Audio Profile menu.
5. Click on the Config button.

megui-mp3-config

I recommend switching Encoding Mode to CBR, ensuring that the Bitrate is at 128, and then making these settings a New profile by clicking on New and giving it a name. Click OK when you’re done here.

megui-enquque-001

Back at the main window, click on both Enqueue buttons. This will add both Video and Audio conversion processes to the Queue tab. Be patient after clicking Enqueue for Video encoding. It seems to run a quick 3-5 second “invisible” analysis.

megui-queue-003.png

Here, all that needs to be done is click Start. Depending on your processor speed/type/quality etc. you may now have some real time on your hands. Chill. It’s Miller Time! When MeGUI is finished you will have an AVI file with no sound and an MP3 file.

megui-muxer-menu-001.png

The two files need to be “merged” together, or “muxed”, into one AVI file. Pull down the Tools menu and select Muxer - AVI Muxer.

megui-muxer-003.png

1. Click on the Open button and select your newly-encoded AVI file.
2. Click on the Open button and select your newly-encoded MP3 file.
3. You can either keep the appended filename and location or click the Open button and change it.
4. When you’re done click the Queue button.

megui-mux-job-waiting.png

Back on the Queue tab, you will now see the Mux process waiting to be…well processed. Click the Start button to begin muxing. This is a very quick process. When muxing finishes you are done! All that’s left to do is sync that bad boy to your Zen and enjoy!

DVD-to-Zune Conversion

Disclaimer - The process of using DVDFab HD Decrypter will not be covered here to avoid legal issues. :-)

Software
DVDFab HD Decrypter
DGMPGDec
AviSynth
AviSynth plugin - dgdecode.dll (included with DGMPGDec)
AviSynth plugin - nicaudio
VirtualDubMOD
Windows Media Encoder
Windows Media Encoder Command Line Script Utility

Procedure
Install everything above and reboot your PC about 9 times. :-) Of course, the first thing you want to do is “backup” your legally purchased DVD to your hard drive. I use one of two different apps depending on the DVD. Sony’s ARcoSS protection found on newer Sony releases can choke DVD Decrypter as it’s no longer being developed.
After the DVD rip has finished, launch DGIndex from the DGMPGDec download. Open the folder where the rip is located and identify the larger VOB files. This part will require some trial-and-error, especially if the DVD’s special features were also backed up. In my example below the movie-only content, excluding special features and menus, is the VOB’s that are circled.

Select the VOB’s and drag-and-drop them into DGIndex. Hit F6 on your keyboard. The movie will begin playing and you will see an information window attached to the right side of the main window. What’s most important here is Frame Size, Aspect Ratio, Frame Rate, Video Type, and Frame Type. Write all of this down or memorize it. After a couple of minutes, hit ESC on your keyboard.

In DGIndex’s main window, pull down the Audio menu and select Demux All Tracks unless you are absolutely certain you know which one you want to use, in which case select Demux Tracks and then Select Tracks. Next, pull down the Video menu and select Field Operation. Here we’ll reference what we found earlier. If the Video Type and Frame Rate are Film and Progressive, we’ll select Forced Film. This will be typical for standard-issue Hollywood DVD releases. Alternative findings will be on episodic TV show DVD’s, where sometimes the Frame Rate will be 29.97, Video Type will be Video, and Frame Type will be Interlaced. Frame Size will not change in order to comply with NTSC standards. Actually, all of this is to comply with the NTSC. Anywho…I digress. Next, pull down the File menu and select Save Project. Give the D2V file a name and a location and a-way we go! DGIndex will scan the entire movie in just a few minutes. When it’s done close DGIndex. You now have a D2V file.

Next, you’ll need an AviSynth script (AVS). Open a new Notepad file and save it as “my_movie.avs” without the quote marks. You can name it anything you’d like. Your AVS will look like an uncompressed AVI to Windows Media Encoder but to you and me it’s just a text file created in Notepad. A sample AVS will look like this:

loadplugin(”c:\..dgdecode.dll”)
loadplugin(”c:\..nicaudio.dll”)
v=mpeg2source(”c:\..my_movie.d2v”).lanczosresize(320,240)
a=nicac3source(”c:\..my_movie.ac3″,2).ssrc(44100)
audiodub(v,a)

This is as basic as it gets. The script above - provided you put in the correct paths to your D2V and AC3 files - will produce a passable WMV for your Zune. AviSynth is a fruitful landscape. There are a ton of filters to enhance your results i.e. sharpening filters, color correction, etc. There is little that AviSynth cannot do, but the learning curve is steep. I will not go through all of that now. Check out http://www.avisynth.org/mediawiki/Main_Page

Test your script. Open in either Windows Media Player, VirtualDubMOD, or Media Player Classic. If all is well, it will play the movie at a 320×240 resolution. If you get an error, take note. AviSynth is very good about telling you exactly which line and column of the script the error occurs in. Usually, it’s just a spelling or syntax error.

Now it’s time to create a batch file. This is an optional step, but I find that using a batch file makes it alot easier to layout and edit your command-line arguments before letting the encoder loose on it. Open another new Notepad file and save it as “batch_file.bat” without the quote marks. Again, you can name it whatever you want to. Take from the example below.

cscript wmcmd.vbs -input e:\scripts\my_movie.avs -a_codec wmastd -a_setting 48_44_2 -a_mode 0 -v_codec wmv9 -v_bitrate 500000 -v_buffer 5000 -v_mode 0 -v_complexity 2 -output e:\test\video\my_movie.wmv

The command-line interface is invoked with “cscript” and the encoder is invoked with “wmcmd.vbs”. If these two files are not in the same directory then you’ll need to provide the full path to each. But as I remember they are both together after a normal installation of the encoder; typically C:\Program Files\Windows Media Components\Encoder. Everything else in the batch file can be in any order. Notice that the INPUT file is our AVS, not the DVD VOB’s. “-v_” indicates a video stream argument. “-a_” indicates an audio stream argument. The “-a_setting” argument variables are bitrate_samplingrate_channels; in our example that would be a bitrate of 48kbps, a sampling frequency of 44.1 kHz, and stereo (2 channels). The “-v_bitrate” parameter is another that you can alter for desired results. The best balance between quality and battery life is anywhere between 400000 and 800000; notated as bits per second. After the parameters are set, save the changes (CTRL-S), open a DOS box (cmd.exe) and navigate to the Windows Media Encoder folder (usually C:\Program Files\Windows Media Components\Encoder). Now just simply invoke your batch file by typing the full path and filename of the batch file. Windows Media Encoder will begin reading your batch file and invoke the encoding process. If you get an error, it’s most likely due to an incorrect path to a file somewhere, either in the AVS or the batch file. If the AVS plays fine in Media Player then look at your batch file and double-check all the arguments and paths.

Just remember to change directory paths to your particular system. The examples are paths on my machine. I’ll be in the ZuneScene forums or VideoHelp forums for additional help.



DVD-to-Mobile Phone Conversion

Many co-workers have asked me how to get a movie from a DVD onto their mobile device, usually a mobile phone. Some may say, “Wow Kevo! That’s an awfully tiny screen to stare at for an hour and a half!” Yes. This is mainly going to appeal to Smartphone and Pocket PC users. A slight bit of trickery - and law-breaking - is necessary. Why should I have to purchase a movie more than one time to enjoy it on the go? Soapbox alert!!! Please be forewarned that this is not for the squeamish! I do not subscribe to the many “one-click” solutions that are scattered all over the Internet. I have a need to be in control every step of the way. If you like getting your hands dirty than let’s get to it. A few things to keep in mind:

– The websites listed below are not mine, nor do I know the people administering them. If a link is broken or a download doesn’t work…sorry. Keep trying.
– This guide will not go into specifics on each application. This is a general breakdown of how I do it.
–There are about a bagillion cell phones, smartphones, and PDA’s in the US market right now. I don’t know which one you have and they don’t all playback the same audio and video formats. This guide is for general reference.

Software
DVDFab HD Decrypter or DVD Decrypter (Google is your friend)
DGMPGDec (a.k.a. DGIndex or DGDecode)
AviSynth
ffmpeg
(will require a freeware zip utility called 7-Zip)
VirtualDubMod
NicAudio (AviSynth plugin)
LAME [ACM] (MP3 encoder)
Xvid Codec
The Core Pocket Media Player

Procedure
First thing to do is to make a backup copy of a move that you have purchased legitamately and get it onto your PC’s hard drive with DVDFab HD Decrypter or DVD Decrypter.

Next, the movie must be indexed. Launch DGIndex and drag and drop only the VOB files that are the movie (no extras or special features) to DGIndex’s main window. Choose Audio menu - Output Method - Demux All Tracks. Then click the Video menu - Field Operation - Forced Film. Last, pulldown the File menu and Save Project. Give it a name and away we go. DGIndex will scan the entire movie. Depending on the length of the movie and the speed of your PC this will take a few minutes. When it finished close DGIndex.

Now we need to create an AviSynth script so that we can feed of movie into an encoder. The reason I use frameserving is for the ultimate in flexibility. Ya see, a frameserver allows us to “trick” the encoder into thinking our movie is something it’s currently not. Open a new Notepad document and immediately save it with a *.avs extension. A script can look like this:

loadplugin(”c:\…\dgdecode.dll”)
loadplugin(”c:\…\asharp.dll”)
v=mpeg2source(”c:\…\filename.d2v”).lanczosresize(320,240).asharp()
a=nicac3source(”c:\…\filename.ac3″)
audiodub(v,a)

This simple script will look like a video file to both ffmpeg and VirtualDubMOD, thanks to the AVS file extension. Take a close look at line 3. The lanczosresize command is all that was needed to get our movie down to mobile device size. That’s 320 pixels wide by 240 pixels high. Some mobile phones will need this changed to 176,144. I added the asharp filter as personal taste. Of course, it hasn’t really been down yet; it’s just a text file! AviSynth will do the resizing one frame at a time when the encoder starts running. Pretty cool, huh?

All that needs to be done now is to feed the AVS file into either ffmpeg or VirtualDubMOD, set your parameters that will comply with your mobile device, and you’ve done it.