Wednesday, October 1, 2008

How to convert DVD-Video to something professional (sort of)

There are about a thousand programs out there for converting DVD-Video into something you could view on you iPod, PSP, Xbox 360 or cellphone. This works well because you're converting to a lower resolution, which helps to mask the loss in quality that comes from recompression. However, If you want to convert a DVD into an editable format that will end up being used in a higher quality format (or even back to DVD), the result are less than stellar, and worse, difficult to attain without paying for some professional program. 

You can convert the seperate .VOB files into one .MPG file or an .M2V and a .WAV file, but native MPEG-2 editing is a royal pain in the ass. You have major limitations on where you can cut without recompressing around the cut, and that's if you can get the right form of .MPG file together in the first place. If you don't understand what I just said, don't worry, i'm about to explain. If you do, skip ahead four paragraphs.



Video DVDs actually just contain a group of video files in folders, both very specifically formatted and named. The video is compressed using a codec called MPEG-2, and the audio is compressed using Dolby Digital AC3 (technically, you can also use other formats, such as uncompressed PCM audio, MPEG audio, or DTS, but the first two are not very common, and the latter is usually a secondary audio track on the DVD, and so not nessicary for this guide). The video and audio are stored in .VOB files in a folder called VIDEO_TS. For some arcane reason, you also need an AUDIO_TS folder, but I can't remember any files ever being in it. Chapter info and menu navigation data are handled in a .IFO file in VIDEO_TS.

Note: By default, many Windows installations come with file extensions hidden. If you don't see a .VOB after the filename of the DVD video files, don't panic, The files that start with VTS are what you want. You also will not see the .bat extention (shortcut that can do special things) or .WAV (audio file), but their icons will be different than the video files.

Commercial DVDs are often copy-protected via region locking (basically, the disc can only play in a DVD player sold in the same country or group of countries) Macrovision video protection (so you can't copy the DVD by plugging your player into some video recorder), and the biggie: the Content Scrambling System (so you can't just copy video files off the DVD in your computer). All of these can be circumvented via a ripping program or special driver, and no, I'm not going to tell you how (but it's pretty easy to find out).

A few years back I ran into a tutorial on how to do something similar to the the process I'm about to show you, in fact, I think it was this one. That was a tutorial for people who wanted to take a DVD and convert it to a higher compression format (smaller filesize). Since I wanted to convert to a higher quality format (lower compression), there was a bit of changing and fiddling to be done. Obviously, a higher quality format does not change the source footage, so if you have a crappy DVD, you'll still end up with crappy video, just crappy video that's easier to edit.


Disclaimer: You are hereby warned that although I have personally tested this technique, it may still do nasty things to your system (although it's unlikely). Installing any software can potentially do this; please don't sue me if this happens, I did warn you.


So, without further ado, here' s how you do this in Windows (XP, and presumably Vista, though not personally tested since I don't run Vista). Mac users, you should probably just get the MPEG-2 plugin for Quicktime Pro and MPEG Streamclip. There may be a free tool (or set of tools) available, but I haven't checked recently since I run a PC.

The best solution if you want to actually edit the video properly will still lose quality (since you have to recompress twice), but has the distinct advantage of being much easier to work with. The key here is to compress into an editable codec that is higher quality than DVD. If you have a ton of hard drive space (say 106GB/ hour or so) and a speedy enough drive, feel free to use uncompressed video. Otherwise, you'll probably want to use DV, since a whole mess of programs handle it well, and it's only 13GB/ hour.


You will need the following tools:

-If the DVD is encrypted, you will need either a ripping program or a driver that will decrypt the DVD on the fly. Unfortunately, since this is a legal grey area, I can't tell you where to get these programs, but they are very easy to find with a simple Google search.


You'd think with a name like DVD2AVI, that this would be all you need. Alas, it is not so. DVD2AVI cannot properly handle AC3 audio.

-VFAPI Codec 1.05 (This is the english version, which is the easiest to work with unless you can read Hiragana and Kanji).

This is where the mojo comes in. VFAPI is a sort of a video codec like DivX or XVID, except it doesn't actually contain any video itself, it just allows your DVD files to be read like they are standard Windows video files (puts an .AVI "wrapper" around them, in technical jargon). You can't do everything you could with a regular .AVI, but it works wonders in combination with:


A Swiss Army Knife for video processing if there ever was one. This is the program you will use to finish converting the video.

-If you're going with DV, you'll need a DV video codec that shows up in Virtualdub. Because of the way Windows handles video codecs, there are some codecs that play back (decode) video, but not encode it. Others do both, but only inside certain programs (like Premiere Pro, After Effects, et cetera). You may already have a suitable DV codec installed, but if not, Cedocida is a free DV codec that works with Virtualdub (as well as just about every other program that handles video in Windows).

So, after you've gathered your tools:


  1. Either copy the VIDEO_TS folder over from your (non-encrypted) DVD, or install DVD ripping software and rip your encrypted (commercial) DVD into files, not ISO images. Either way, you want to end up with a VIDEO_TS folder (you can delete the AUDIO_TS folder if you ripped it or copied it over). Make sure the video files are subsequently (or put directly) into a folder you can get to easily.
  2. Extract DVD2AVI into a new folder (DVD2AVI is a good name to use). I personally put this folder into Program Files just for consistency, but you can just as easily put it on your desktop.
  3. Same advice goes for VFAPI Codec. Once it's in place, double-click on "vifpset.bat". You've now installed the mojo.
  4. Step 2 goes for VirtualDub as well. It's not a bad idea to run VirtualDub once extracted and placed just to make sure you don't get an initial introduction screen with a checkbox somewhere saying something to the effect of "click here to not show this again". If you do get this, check the box, click okay, close VirtualDub.
  5. Open DVD2AVI. Under the File menu, click on Open. Find your VIDEO_TS folder using this open window. Open the VIDEO_TS folder in said window, select the VTS_01_1.VOB. Click the Open button. You may now see that VTS_01_2.VOB and so on have been selected automatically. This is normal (since DVDs split movies into smaller files), and in fact you may now add VTS_02_1.VOB, etc. using the helpful "Add" button if you wish. Please note, however, that sometimes these additional VOBs are for special features or alternate versions of a movie. If you're unsure, just click OK for now, since you can always add the other .VOBs later by repeating the step (which will take you straight to this window).






  6. Once all that is sorted, the DVD2AVI window will resize to the resolution of your footage, and you'll want to make sure the following settings are set properly:









    This last setting refers to the audio track you want to use. If you need to copy a 5.1 surround sound (6-channel) track instead of a stereo (2-channel track), you'll also need to set these options, which convert the 5.1 to a stereo track, otherwise you will have a (very) hard time getting the audio to work:





  7. For the final step on our DVD2AVI tour, please go to the file menu and select "Save Project" (or you could just hit the "F4" key). It's perfectly fine to save this project file in the VIDEO_TS folder, but anywhere will work. Now DVD2AVI will go through your video footage, save some relevant information, and decode the audio into a .WAV file.




  8. Now for the VFAPI magic. Go to where you put VFAPICodecV105en and double-click on VFAPIConvEN. Then click on "add file" (you might have to do this twice, due to some wonky design in the interface) and select the .d2v file you just created, then click "open", then "convert", then when it's done, "quit".






  9. Okay, you've now got a file that can play your DVD files back, except it's not tied to the audio file. Being that we'll be using Virtualdub to do the final step of conversion anyway, we can address the audio there as well. Open Virtualdub. Open your new .AVI file. Select "WAV Audio" from the Audio menu and select your audio file. Click "open".





    Open your video file.



    Set the following setting:



    Choose your DV codec (yours may be different than mine, remember):





    Click OK.

    Under the Audio menu, choose Direct stream copy, then WAV audio.



    Select your .WAV file from the same directory you saved the video files to.



    Now save the new video file to an appropriate directory, wait for the rendering window to go away (which may take a while), and you're done.








No comments:

Which deinterlacing algorithm is the best? Part 1 - HD interlaced footage

Before I began, I'd like to give a special thanks to Aleksander Kozak for his help in testing and providing the HD footage used in this ...