iPod Video Conversion Part II: Subtitles & AviSynth

Written by rob on February 12, 2006 – 7:43 pm -

Note: A reader, cghera, pointed out that the program called Handbrake can automate this entire process. I recommend you give it a try. You can download the program here, and you can find the documentation here.

I have successfully figured out how to convert a video to iPod format and still keep the subtitles! I figured I would share this golden information with everyone else, since it took me so long to figure it out. I have been trying to do this ever since I got a PSP, and then a Video iPod. Neither device can understand subtitles in any format, so in order to have them you must embed them into the video itself. You see, DVDs have subtitles in a separate layer, completely separate from the video itself. That is why you can turn them on or off, or pick which language you want. Some movies have what are called “built-in subtitles”. For example, in Lord of the Rings the Elfish is translated to English at the bottom of the screen, whether you have subtitles on or not. If you were to convert your Lord of the Rings DVD to iPod version, those Elfish subtitles would still be there. So, the trick is making ALL the subtitles “built-in”. The key? A little program called AviSynth.

If you have a good memory, you will remember that when you installed the Videora iPod Converter it also installed something called AviSynth. That was one of the checkboxes you could turn on or off during the install. AviSynth is essentially a scripting language that you can use to edit videos. You use Notepad or any other text editor to edit these scripts, and then you use a separate program to actually interpret the script. MANY video programs today support AviSynth, as it is pretty much the most flexible and powerful video scripting platform available. Videora happens to also support it. You can write your script in notepad, save it as a .avs file, and then open that file in Videora as opposed to a video file (.avi, .vob, etc.). Videora automatically interprets the file, and then converts its output as if it was any other video.

Enough of the background information. Time to begin. You are going to need a few programs to follow this howto. For the sake of ease, you should probably just download them all now.

  1. Videora iPod Converter – This will install AviSynth as well as let you convert files to iPod format.
  2. SubRip – This will allow you to rip subtitle files out of .VOB files.
  3. DVD Decrypter – This is necessary to rip DVDs to your hard drive in the form of .VOB files.
  4. DGIndex – AviSynth unfortunately does not support .VOB files directly. You must run them through this first in order to make them compatible.
  5. BeLight – Necessary to convert .ac3 DVD audio files to .wav files readable by AviSynth, and makes sure they stay in sync.
  6. DirectVobSub – Used by AviSynth to actually show the subtitles.

Before we begin, open up My Computer and click on “Local Disk (C:)”. Now, right-click anywhere in the window that comes up and go to New, and then Folder. Name the folder “temp”. This will be the temporary folder we use to store all the in-between files that come before we can actually convert the video to iPod format.

The first thing you want to do is download and install DVD Decrypter. After it is installed, run it. In the menu bar, go to Mode and then IFO. Then go to Tools, Settings. In the box that comes up, go to the IFO Mode tab and where it says File Splitting, select None. Press OK to return to the program. Go to the Stream Processing tab, and enable Stream Processing. Uncheck all of the boxes except the main movie (should be the longest video there), the English language audio file (if there is more than one, go with the one that says 2ch). Now, here is the important part. Make sure you select the Subtitles stream you want (the language)! After these three things are selected, click the little folder under Destination. Browse to C:, and then the “temp” folder you created above. Now you can press the green arrow to begin. This will take about 8-25 minutes depending on the length of the movie and the speed of your CD drive.

Once the ripping process is complete, exit DVD Decrypter. Now it is time to download DGIndex. This program doesn’t actually have an installer program, so just decompress the ZIP file and run DGIndex.exe that is within the folder. In the menu bar, go to File, Open. Browse to C:, and then “temp”. You should see the ripped DVD file, which should be a single VOB file. Double-click it to open it. In the box that comes up, simply press OK. Now all you need to do in this program is go to Video, Field Operation, Forced Film. After that, just go to File, Save Project. It should already be in your temp folder, but if it is not you can browse to it now. Once you are in the right folder just press Save. DGIndex will then create a .d2v file which is able to be read from within AviSynth. This should take about three minutes.

DGIndex also separates the audio from the video and most of the time puts it in an .ac3 file. Open up My Computer and then browse to your C:/temp folder. There will be a file called something along the lines of “VTS_01_PGC_01_1 T01 48K 16bit 2ch”. It can be a variety of different things, but what you are really looking for is either an .ac3 or a .wav file. If it is .wav, you can skip to the next paragraph as you are ready to proceed. Otherwise, you have an .ac3 file. AviSynth unfortunately cannot read that, so we need to convert it. This is where BeLight comes in, so download that. Just like DGIndex, it has no install program so just uncompress and run the BeLight.exe. Press the Input button and browse to C:, and then temp. Select your .ac3 file. Select the WAV/PCM tab below the Output button. Make sure WAV, and 16-bits Stereo Wave are selected. You don’t have to change anything else, so just press the Start button. A black box with white text will come up that says transcoding… preceded by the current location in the movie. This process usually doesn’t take longer than five minutes. After it is done, close BeLight. You now have a video file and audio file compatible with AviSynth.

The next step is to actually get the subtitles out of the .VOB file. SubRip is the tool necessary to do this, so download that. Again, this has no installer, so uncompress and run SubRip.exe. Go to File, Open VOB(s). Press the Open IFO button. Browse to your temp directory and select the only file that will show up. This is the IFO file that is automatically made by DVD Decrypter (goes with VOB files). Open that up. Now, make sure that your desired language is selected under Language Stream. Now press Start. What SubRip will now do is what is called Optical Character Recognition (OCR). DVDs store subtitles as images, and not text. OCR converts the images to text so then you can specify your own font, etc. Just know that this will turn out much smoother than doing things any other way. The OCR will highly a letter (or multiple letters), and you need to type what they are. It is a lot of typing in the beginning. Make sure you type the right thing,or your subtitles will be messed up. After awhile, it will have all the information it needs and will finish OCRing the file. If you made a mistake, you can correct it by going to Character Matrix, Edit/View Characters Matrix. Anyway, when it is done I always like to go to Character Matrix, Save Character Matrix and save it to my temp folder. This is not necessary, but it ensures you’ll never have to redo the OCR process if something goes wrong later. To save the actual subtitle file we will use in AviSynth, goto File, Save As on the bottom (not the top window, but the bottom with black background and white text) menu bar. It will ask you the Font and Font Size. I keep the defaults, since Tahoma 10-point is nonobtrusive but easy to read. After you are satisfied with the font settings, press the Save button. Call the file subs, and make sure you save it in your temp folder. You can name it whatever you want, but you will have to change the AviSynth script to reflect the changes, so I don’t recommend it.

Now you have all three things you need to make the video: the video itself, the audio, and the subtitles. Now would be the time to install DirectVobSub. This program does have an installer, so just follow the steps until it is finished. It doesn’t install an actual program, but instead a plug-in for AviSynth we will soon use. So, now you can download and install Videora iPod Converter. Make sure you uncheck “Launch at startup”, and make sure that Avisynth is checked! That is the brains behind this entire operation. After it is installed, there is one last thing we need to do before we are ready to actually write the AviSynth script. Go into the folder where you uncompressed DGIndex (it is probably called DGMPGDec). There will be a file called DGDecode.dll. This is an AviSynth plug-in that we need to use. Right-click it, and select Copy. Now go to My Computer, C:, Program Files, and finally DirectVobSub. Right-click anywhere and select Paste. You should now see both DGDecode.dll and VSFilter.dll in this folder, in addition to the Uninstall program. We are now ready to write the script. I am going to take this time to say that AviSynth can do pretty much anything you can imagine – crop, resize, deinterlace, do your homework (Ok, maybe not that), etc. Futhermore, there are hundreds of plug-ins for AviSynth that increase its powers.
Anyway, open up Notepad. Paste the following into Notepad:

LoadPlugin("C:Program FilesDirectVobSubDGDecode.dll")
LoadPlugin("C:Program FilesDirectVobSubVSFilter.dll")

video = mpeg2source("C:tempVTS_01_PGC_01_1.d2v")
audio = WavSource("C:tempVTS_01_PGC_01_1 T01 2_0ch 192Kbps DELAY 0ms.wav")
AudioDub(video, audio)


EDIT (08-08-2006): Kudos to Sneaker for helping me realize that the quotes in the AVS script were converted to “fancy quotes” by WordPress. This made the script fail to work if copied and pasted right from the site. It should now work!

You will need to go to your C:/temp folder now. Find your .d2v file. Right-click it and go to properties. In the box that comes up, select the file name in the top box, right-click and go to Copy. Then, paste the filename in the mpeg2source part of the script, replacing my “VTS_01_PGC_01_1.d2v” filename but leaving the C:\temp. Do the same thing with the .wav file, but this time paste in the WavSource part instead of mpeg2source. If you followed my instructions, your subtitles file should be called subs.srt, but if it isn’t you should change that as well. The plug-ins should be specified correctly as well. When you think the script looks good, save it in your temp folder as “script.avs”. The .avs part is very important, as it is what tells Videora to use AviSynth with it.

After your script is saved, you are pretty much done. The last thing to do is actually convert the file, so open up Videora iPod Converter. Before we do anything, we need to set up the Profile. Go to the Setup item in the side bar and click it. Then go to the Profiles tab. You need to pick an “Existing Quality Profile” to modify. Choose whichever one you have found works well for you. If you are unsure which to use, just use “MPEG-4/320×240/768kbps Stereo/128kbps”, as it is one of the best quality profiles but still makes a reasonable file size (only about 700MB for a two-hour movie). In the Profile Name box put whatever you want. I named mine “Subtitles Preset”. Now there are two key things we need to set. The first one is the resolution. Click in the Resolution box and set it to 368×208. This is to make the video widescreen, so the iPod doesn’t stretch it and make it look bad. The next thing to set is Framerate. Choose 29.97 fps. After that, you can tweak anything else you like but I don’t recommend it. Press Apply when you are finished. (Note: Don’t mess with the AviSynth script area. It may look tempting, but believe it or not we don’t use that.) Anyway, now head over to the Convert section of the program. Click Transcode New Video, and browse to your temp directory. Select the script.avs file you created in the previous paragraph (NOT THE VOB FILE). Select the quality profile you just created (e.g. Subtitle Preset in my case). Press the Start button. This will generally take about half the time of the movie (e.g. a two-hour movie will take one hour).

When it is done, you have an iPod-friendly video that contains subtitles! Add it to iTunes by dragging it to the Library item on iTune’s sidebar. Plug in your iPod, and now you can watch a subtitled video on your iPod! Using the SubRip method described above, the subtitles will be very easily readable on the 2.5″ screen. You can safely delete you temp folder after the video is successfully converted (make sure you test it first so as to not waste all your hard work!).

The above instructions may seem complex due to their verboseness. However, what you are actually doing is very simple. It is just a matter of making sure you remember to go through each program in the right order. Furthermore, you won’t have to make a quality profile every time. You can just use the one you created the first time. Also, you can use the same exact script with little to no modification each time (so make sure to save it somewhere other than your temp folder so you don’t accidentally delete it). Have fun making subtitle enabled videos for your iPod. The next edition will probably focus on converting videos specifically to view on an HDTV, something I am still struggling with.

Posted in Howto's, Tech | 46 Comments »

Ripping DVDs

Written by rob on February 10, 2006 – 8:46 pm -

Bill wanted to know how to convert DVDs to iPod-friendly format. The process is pretty much the same as converting any other iPod video, but you must first do what is called “ripping” the DVD. Hollywood DVDs (i.e. the ones you buy from a store) are all encrypted. Therefore, if you just copy the video object files (.VOB) from the DVD to your hard drive, you won’t be able to play them. However, awhile ago some brilliant computer hacker found a way to crack the encryption, and the technique has subsequently been mass-produced. Now there are hundreds of programs that can rip DVDs, and they all have their strengths. The best one by far, though, is called DVD Decrypter.

Rather than reinvent the wheel and describe how to rip a DVD here, I will instead just link to a very easy-to-follow guide written by the same people who created the Videora iPod Converter. Click here to go to the guide on their site. Follow steps one through six. Once you get to six, you will have one large .VOB file somewhere on your hard drive.

Then, head over to my previous iPod Conversion howto and follow that guide. DVD conversion works exactly the same way as any other video once you have it on your hard drive and unencrypted. Just load the .VOB file into Videora when you get to the part of pressing “Browse” to find the video to convert. The one thing to keep in mind here, though, is that you definitely want to follow the note at the very bottom of the post that describes widescreen video. Not doing that will result in stretched videos, both on the iPod’s screen and the TV if you plan on outputting it.

If you have any specific issues, the forum would be a good place to ask it. I am going to make a Howto on subtitles soon, as soon as I actually figure out how to do it.

Posted in Howto's, Tech | Comments Off on Ripping DVDs

iPod Video Conversion Part I: Basic Conversion

Written by rob on February 5, 2006 – 12:40 pm -

There are many different programs and methods available to convert videos to iPod format, but I use a program called Videora iPod Converter because it is free and converts files quickly. Get the program here, and then install it. During installation, uncheck the box that says “Launch at Startup”, but keep “AViSynth” checked. Launching it at startup is not necessary and will just slow down your computer.

After it is installed, run the program. In this main screen, look in the left side bar. Press Convert. That is where you will do most of the work. Press the button that says “Transcode New Video”. Browse to the location where your video file is stored and open it. The file name will now appear in the Title box under “New Transcoding Job”.

The last thing you need to concern yourself with is the part that will require the most thought. You need to choose the Quality Profile. You need to take three things into consideration when you pick a profile:

  1. The file size of the video.
  2. The quality of the output video.
  3. The time it takes to convert the video.

It is balancing these three things that gets somewhat difficult. If you make the best possible quality video file, the file size for a 2 hour movie will be about 1500MB. Also, the more quality you have the longer it will take to convert the file. So, I tend to convert files with medium settings, since that will give you a nice balance between size and quality. I prefer MPEG-4 over H264, since it is generally a smaller file with better quality, but it really depends on what kind of movie you are converting.

In order to figure out what Profile to use, go back over to the left side bar and click Setup. On the top of the new screen will be four tabs. Choose Profile Picker. In the dropdown box next to One-Click Profile, there are MANY options available , so just look through a bunch of them until you find one that looks good. The key things to pay attention to is the quality of video and audio at the top, and then the file size near the bottom of the screen. Depending on how many movies you intend to carry on your iPod, you should definitely not go for the best. To get the best results, experiment. I use MPEG-4/320×240/512kbps Stereo/96kbps as my main profile for most files, since it perfectly balances quality with file size. A 2-hour movie will only be around 580MB.

I only use the best profiles when I’m converting a movie I know I will keep for a long time and watch many times, though I really can’t see a quality difference between the medium and best profiles.

Once you have selected the profile you want, click on Convert again. Choose your profile from the “Quality Profile” dropdown box. You are now ready to convert the video. Now press the Start button, and your video will begin to be converted. This part is where Videora really shines. It is pretty fast. It takes about half the amount of time as the source file. So, if you are converting a two hour movie, it will take about an hour. TV shows which are usually 43 minutes without commercials take around 25 minutes. Compare this to Quicktime Pro, the program that Apple wants you to use (and which costs $29.95), where it takes about an hour and a half to convert a 20 minute file!

Anyway, once your video is done transcoding, it will say “Transcoding Complete”. The converted file will be located in C:/Program Files/Videora iPod Converter/Videos. After you go there the first time, you can right-click on the Videos folder, go to Send To, and then “Desktop – Create Shortcut” to make a desktop shortcut for easy subsequent access. Once you have the Videos folder open, open up iTunes. Once it comes up, just drag the video you converted from the open folder to the Library item on the side bar. Next, open up the Videos item, and you should see the video you converted listed. If you want, you can right-click on the video and go to Get Info and change the name of the video, artist, etc. just as if it was a song. Anyway, now you just need to plug in your iPod to copy over the file, and it should be ready to watch on the iPod’s screen.

There are many more programs available now since the iPod Video has been out for a few months that I have not yet tried, but I see no reason to switch from Videora iPod Converter. It converts quickly, it’s free, and it gives you plenty of options. A widescreen movie converted using the medium settings above looks pretty good on a 50″ television, and looks incredible on the iPod’s 2.5″ screen.

One last thing I would like to note is widescreen video. If the video you are converting is widescreen, and not a square, then no matter what setting you use in the program it will look stretched. It isn’t that bad, but it could be annoying if you want the best possible quality from your files. In order to make a widescreen video that will play on your iPod with no stretching, follow the below steps.

Open up Videora iPod Converter and go to Setup. Then go to the Profiles tab (not Profile Picker). In the screen that comes up, select a profile that you found works good for you from the top dropdown box that says “Existing Quality Profiles”. If you don’t know what to choose, just use my recommended one above. Press the “New Profile” button. After this, first change the “Profile Name” to something like “Widescreen Video”. You could also append the 512kbps, etc. if you plan on making more than one Widescreen profile. Now, the only thing you need to change is “Resolution”. Type 368×208 into the box. Now press Apply. This will save the profile and you can now use it within the Convert window to make non-stretched iPod videos. This is the ideal resolution setting to convert DVD-ripped videos to iPod.

Posted in Howto's | 16 Comments »