iPod Video Conversion Part II: Subtitles & AviSynth

Note: A reader, cghera, pointed out that the program called 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 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.