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.








Friday, June 27, 2008

The funniest scam spam email yet:

I just have to wonder: how could anybody have the absolute gall to think anybody would ever, in a million years, believe this (contact info obscured with *********s). This is definitely a spammer who is taking the "more is more" approach. I was originally going to take this on line by line, but I think you should just read the whole damn thing first. Trust me.


From: "United Nations" *********************
----------------------------------------------------------------
Chairman Committee On Foreign
Contract And Inheritance fund Payment Notification
From United Nations And USA Government
Sir. Eric Ben.

Attn: Beneficiary,

U.S.A Government, World Bank And United Nations Organization Official Has Approved To Pay You Part Payment Of Your Inheritance Fund And Lottery/Award Winning Payment Valued Of USD8.5m.

The British Prime Minister in conjunction with U.S.A GOVERNMENT, WORLD BANK AND UNITED NATIONS ORGANIZATION do hereby give this irrevocable approval order with This Release Code: GNC/3480/02/08 In Your Favor For Your Contract Entitlement And Your Inheritance Fund Which You Have Not Received Yet, Now It Was Approved By The World Bank, That Your Contract/Inheritance Fund should be released through UNITED NATIONS ORGANIZATION. So You Are Advised To Present Any Of Your Choice Among This Two Option Of The Payment, On How You Want To Receive Your Fund, Either By WIRE TRANSFER OR IN CASH THROUGH OUR DIPLOMATIC COURIER SERVICES, AS YOUR INHERITANCE PAYMENT, So In Regards To The Transfer You Will Provide Any Of Your BANK ACCOUNT DETAILS For The Transfer Of Your Fund With Out Delay. Anyway, I Am Contacting You In Regards To The Instruction Given By United Nations, Please I Will Urge You To Try And Indicate On How You Want Your Fund To Be Released To You From The Two Options Above.

Now your new Payment, United nations Approval No; UN5685P, White House Approved No: WH44CV, Reference No.-35460021, Allocation No: 674632 Password No: 339331, Pin Code No: 55674 and your Certificate of Merit Payment No: 103, Released Code No: 0763; Immediate Citibank Telex confirmation No: -1114433; Secret Code No: XXTN013, Having received these vital payment number, therefore You are qualified now to received and confirm Your payment with the United Nation immediately within the next 72hrs.

As a matter of fact, you are required to Deal and Communicate only with MR. ROBERT BISCHOFF, HEAD OF INTERNATIONAL REMMITTANCE CITIBANK, UNITED KINGDOM, with the help of monitory team from the CITIBANK OF NEW YORK which is our official remitting bank, Committee On Foreign Payment Matters in United Nations, has look up to make sure you receive your Fund. So contact: MR ROBERT BISCHOFF on his contact information, Direct Citibank Telephone No +****************, Cell/mobile +****************** or cell/mobile +******************** Fax Number: +**********************
, Telephone Number: +*********************, Email: *********************, For immediate release of your contract/inheritance/Award Winning claim be informed that you are not allowed to correspond with any person or office anymore, you are required to send bellow information for your transfer.

1) YOUR FULL NAME:
2) ADDRESS, CITY, STATE AND COUNTRY:
3) PERSONAL CELL PHONE, FAX AND MOBILE:
4) COMPANY NAME (IF ANY) POSITION AND ADDRESS:
5) BANK NAME:
6) BANK ADDRESS:
7) ACCOUNT NUMBER:
8) ROUTING NUMBER OR SWIFT CODE NO:
9) OCCUPATION, AGE AND MARITAL STATUS:
10) COPY OF YOUR INT'L PASSPORT/DRIVERS LICENSE:

Note: Your Personal Contact/Communication Code With Citibank Is (011), You Are Advised To Send Your Full Banking Information To The Citibank London, International Remittance Director Headed By Mr. Robert Bischoff And Make Sure You Speak With Him, With Your New Payment Code For The Release Of Your Payment And Send To Him All Your Banking Information Now.

Contact Person: Mr. Robert Bischoff
Position: Head Of International Remittance Citibank Of London.
Telephone Office/Bank: *******************************
Fax Number: ***************************************
Cell/Mobile, ************************************
Email: *************@hotmail.com,

Chairman Committee On Foreign Contract And Inheritance fund Payment Notification from United Nations And USA Government.
Sir. Eric Ben.


Wow. I'm speechless.

Sunday, June 22, 2008

Post-Production Woes

When I set out to build a system for HD video editing, I was limited by a few factors:
  1. I needed to edit in 1080i (rather than 720p)
  2. I needed to be able to color correct accurately
  3. I needed to mix the sound up to broadcast standards
  4. I didn't want to use any more power than I absolutely needed
  5. I needed the computer parts to be no more than around $3000
So, like so many independent video folks do, I began my quest to build the perfect cheap HD editing system. At the price point, I couldn't afford the hardware to do uncompressed HD editing, and I wasn't about to get into the mess of natively editing HDV MPEG-2 files. This means that I would have to convert the HDV footage into some other compressed codec first before editing.

Since I needed to do accurate color correction, didn't have a $2,000+ broadcast-quality LCD monitor, and did have a professional NTSC video monitor, I opted for the Blackmagic Intensity Pro card, a $250 wonder that uses HDMI to input HD, then your captured/edited HD can be viewed over an HDMI-equipped HDTV/monitor or analog component video-equipped TV/monitor. Using the latter, it worked just fine, since my monitor can do pseudo-HD (Only 800 lines, but enough for color correction).

If you're wondering what any of that has to do with a codec, here's the catch: In order to use the video output features of the Intensity Pro, I would have to use one of the Blackmagic codecs to edit in. Two of the codecs were uncompressed (8-bit and 10-bit HD), so that left an MJPEG variant. The upside of "Online JPEG" (as they named it) was that the storage requirements (both disk space and throughput) are about 1/10th the size they would be for uncompressed 8-bit HD. The downside (I found out) is that it's a processor-intensive codec to use.

In order to get the most bang for my buck (remember, this is towards the start of 2008), I decided on an Intel Core 2 Quad 6600 CPU. All the video benchmarks I could find put it way ahead of equivalent (and even more expensive) CPUs in video encoding benchmarks. I didn't want to fork over the insane cash to get a Quad-core Xeon, or I would've used that.

To make a long story short, I use Premiere Pro CS3 to edit, and I started to notice that just playing back the footage on the editing timeline was eating up 40-60% of my total processing power. That's a little worrying, but it's nothing compared to trying to use more than one video layer unrendered. All of a sudden, attempting to play back a simple transition or still made the CPU jump to around 95% usage, which means frames were being dropped in playback. Sometimes it would crash Premiere Pro entirely. Add to this other problems, including Premiere Pro randomly refusing to render (or even pre-render) footage, and I began to realize I had a problem.

After checking out help files and forums, I upgraded the following programs/drivers (in more or less this order):

  • Premiere Pro CS3
  • Intensity Pro (including a new firmware)
  • NVIDIA Geforce 8800GT
In the case of the first two upgrades, this seemed to help things a little bit... for a while, but only with rendering/pre-rendering. CPU usage was still ridiculously high, and so what I've had to do for the stuff I've done so far (Trailers and a rough cut) is upconvert segments of edited DV footage, and use only minimal titles and transitions. The crazy multi-layered timelines I used to do (in DV) wouldn't work here, so it's looking more and more like I'll need to do all my still usage in After Effects somehow, either by rendering out cut sequences (messy and storage-intensive) or by importing the timelines into After Effects (messier - I have to re-create all my titles, filters, and audio level work).

Update - I finally found a way to design titles and put in pictures, as well as edit DV footage natively. I recieved some XDCAM EX footage, and in the process of converting/importing it, I noticed it ran smoothly and stable (as well as using about 1/3 the processor power). Then I had an idea. I took my existing MJPEG project and imported it into a new XDCAM EX project. The source files were still MJPEG, and I can't do too much preview rendering, but I can now work unrendered with everything. Even Magic Bullet doesn't crash the system unless I have too much open. So, problem solved, but man, what a stupid work-around.

Update 2 - Turns it this didn't solve the full problem after all. During rendering a whole rough cut, Premiere Pro kept crashing on the end credits. Turns out, the titler was doing most of the crashing. The solution? The Windows XP "/3GB" switch in boot.ini, which basically allows individual programs to access more of the total system memory. Now, the titler doesn't crash, and not even the multi-layer Magic Bullet "misfire" effects crash Premiere Pro. The downside? Slower overall file access. I can live with that, though.

I also tried re-importing my XDCAM edit of the project back into an MJPEG project, but unrendered stuff still wouldn't play back well (although it didn't crash), so I;m going to continue to work with the XDCAM project until I'm ready to release the final cut.

Update 3 - Looks like either the /3GB switch causes some sort of memory leak if you try to run several programs in succession, or I have some odd other problem. If I use the computer for an extended period of time (say over 6 hours) or use other programs in the background while Premiere Pro is open, it starts to getting buggier and less responsive, until it needs a forced reboot. I'm going to look into this some more.

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 ...