HD-DVD Backup to XBox Compatible WMV-HD
jamesp — Tue, 05/27/2008 - 19:20
Use
I am an early adopter. When the High Definition DVD format war was launched, I planned to lay low and let the dust settle, or go for whichever format produced the Star Wars Trilogy first. But, Microsoft chose a side and dangled a juicy, delicious carrot in front of me--the XBox 360 HD-DVD Add-on. We got one and remained an HD-DVD household until we purchased a PS3 this March.
I am an advocate for Fair Use rights, and this page merely represents the method I use to convert a HD-DVD movie into WMV-HD playable movie, using the maximum quality settings that an XBox 360 can handle in streamed videos. For some reason, both the XBox 360 and Playstation 3 do not play Hi-Def movies from HD-DVD at native bitrates smoothly. I have attempted to simply re-mux an HD-DVD movie with existing VC-1 (WMV9 advanced profile) with transcoded surround audio, and the XBox struggled with the full HD-DVD bitrate that it played flawlessly when played from the HD-DVD add-on. A similar test was made for the rare HD-DVD that was encoded in H.264 (aka MPEG-4/AVC), along with audio encoded to AC3 and placed into a M2TS file on the PS3 resulted in it choking on the bitrate, but I'm sure a BluRay disk with those parameters would work fine.
So, I've found that a lowering of bitrate is required, similar to how I used to backup my DVD's onto single layer disks. There is a way to requantize or re-encode at a lower bitrate without much noticeable quality loss.
At this point, I should point out that I do not endorse piracy. I am not a lawyer, but due to Fair Use established in the Betamax case, as well as the "Interoperability" clause in the DMCA, I feel I can explain how to backup this media for personal use. Other countries have other rules, so basically I submit this as entertainment only and you should make sure you are following your country's laws if you plan to do this.
Microsoft is not very forthcoming with releasing their codecs or tools for use in Linux, so this will require a properly licensed copy of Microsoft Windows. We actually have a few copies around our house: a copy of XP Home on a laptop, a copy of Vista Home Premium on a laptop and a purchased copy of Windows Media Center 2005. With the heavy dose of DRM cruft embedded into Vista, I haven't even attempted this on that platform, nor do I recommend it.
Software Used (w)indows, (l)inux or (c)hoice of either:
- DumpHD (I use with Sun's Java on Linux)(c)
- UDF 2.5 kernel patch (l) or the UDF driver (w)
- aacskeys (c) or a keydb.cfg (na) with your movie's VUK (google is your friend)
- evodemux (w)
- Windows Media Encoder 9 (w)
- eac3to (w)
- ffmpeg (l)
- vc12avi (w)
- vc1conv (w)
- ffdshow (w)
- VirtualDubMod (w)
- Either Windows Media Player 11 (w) or Windows Media Format 11 (w)
- optional mplayer (l)
Recipe
Normally, I don't discuss the installation or configuration, but here is a note. For ffdshow, you want to go ahead and let Windows handle the VC-1 codec. ffdshow can overlay permanent subtitles into the stream. At this point, I've only experimented with that in the past on some foreign language DVDs I've had, so I'll write up an addendum on how to embed subtitles later. In short, you'll have the option to pull them out, if you do, you'll need to run something like Subtitle Workshop to convert them from sup into srt (using OCR), then ffdshow can be told to overlay them in streams pulled through it.
First, we rip the HD-DVD to harddrive, decrypting it along the way. I'm assuming proper hardware-I use the XBox Add-On connected to my computer to do this. At the time of this writing you are required to patch and roll your own kernel in most distros--how to do that is beyond the scope of this document. If you aren't a guru in Linux, you have to have Windows anyway, so just find the UDF driver for Windows which will allow it to see the HD-DVD media and run DumpHD from there. In Linux, once booted with your UDF-2.5 enabled kernel, this disk will likely automount. Now, in Linux, you can only access the UDF-2.5 as root, You will need to either make sure your HD-DVD is listed in the KEYDB.CFG file you have for DumpHD or find a linux binary of aacskeys. If using the latter, run:
aacskeys <mountpoint of HD-DVD> v
This will spit out a bunch of information. You are interested in the Volume Unique Key (VUK) and Disc ID. Append them to your KEYDB.CFG, following the format of the other lines: the Disc ID is the first long string, the last long string is the VUK. You can then fire off DumpHD:
cd <location to dump_hd>
java -jar DumpHD.jar
Select your mountpoint and it should recognize the disk. Pick a destination and start the dump. Wait awhile, for this is going through about 30 GB of data. At this point, you have a Fair Use backup, and have decrypted the HD-DVD for interoperability with Linux. You can play the /HVDVD_TS/FEATURE_1.EVO file with a cutting edge version of mplayer. If, however, "interoperability" means playing on your XBox 360, read on.
Typically, movies are split into multiple EVO files, usually named FEATURE_1, FEATURE_2, etc. The other things on the disc, such as extra features are in the other EVO files. EVODemux will take the FEATURE_* files and construct a single file for easier Linux watching or demuxing into complete video, audio and subtitle tracks for further processing. Somehow make the HVDVD_TS directory available to your Windows box. A network share is enough on my gigabit network, but you may want to use "sneaker net" with an external drive. Fire up EVODemux and pick FEATURE_1.EVO (probably, or whatever is the feature you want--preview them in mplayer if it is a multi-episode disc, like Heroes). Check the options and make sure that "Continue to next file" is checked. Click "Read EVO" and it will scan the EVOs. Once this is done, go through the tabs to select your video, audio and subtitle tracks, if any, then pick an output directory. You should take note of the extensions EVODemux will create and adjust if you'd like (if demuxing). Click Demux if you are processing for XBox, or just Rebuild to turn two FEATURE EVO files into one (for direct viewing). If I am creating for direct viewing, I only pick one audio track (the first). If I am demuxing, I do all of the tracks, including subtitles. It takes a while to do this, so might as well get everything. Nothing sucks worse than doing this and finding out you got the Russian audio and having to go pull the rest of the audio anyway.
Next, you need to will take one of two paths. HD-DVD video could come compressed in one of three codecs: MPEG-2, VC-1 or H.264/AVC. I have yet to run across MPEG-2, so you'll have to figure that out on your own if you are converting that, but likely you can find a way to process that into AVC using one of my guides for AVC for PS3 if you can't get it here. For now, we'll discuss if your video is in H.264 format. You need to take that Video stream and put it back into an avi for ffdshow to parse. This is best done with the command line tool, ffmpeg. So if you are sneaker net, lace 'em up and trot the data back over to Linux:
ffmpeg -r 24000/1001 -i <video file from EVODemux> video-indexed.avi
If you have VC-1 video, you have different steps to prep your video for Windows Media Encoder. You need to strip out the pulldown flag:
vc1conv <output video from evodemux> video-conv.avi
Then, you need to convert the elementary stream into an avi using vc12avi. It's a GUI program, so open it, pick video-conv.avi, then pick video-vc1 for output and click Convert. It will create a series of 2GB files, which we put back together with VirtualDubMod. Open the first video-vc1.00.avi file. Make sure that "Direct stream copy" is selected under "Video". Go to File->Append segment. Pick video-vc1.01.avi and check "Autodetect additional segments by filename". Save it as video-indexed.avi.
Now, we need to go ahead and extract the audio from Dolby Digital Plus or TrueHD into 6 discrete wavs. We must convert 7.1 down to 5.1 as this is the maximum supported in streamed files. Make sure eac3to is in the directory that evodemux dumped to (or your path), and get back into that command line:
eac3to <audio track from evodemux> audio.wavs -libav -down6
This creates 6 audio files named using "audio" as a mask, ie "audio_sl.wav" for the surround left.
Finally, we are ready to mash it into an XBox 360 file. Open up Windows Media Encoder. Choose a custom session. Under Source, make sure "Both Device and File" is selected. Under video, choose Browse for file, then video-indexed.avi. ffdshow will properly decode the AVC. Under audio choose "Multichannel WAV", then click the configure next to that. Pick your wav files. "_L" and "_R" are the front-left and front-right, respectively. The rest you can figure out. Under the Output tab, you want to uncheck the box about server, which changes the last choice to "Encode to file". Give it a file name such as "Movie.wmv". I actually use names like "Movie.HDDVD.1080p.15m.wmv" so I know the source (HD-DVD), resolution and bitrate. I also convert some HD television shows, and thus would replace HDDVD with ATSC. Next, under Compression, you want to choose "Hardware profiles" under the first drop-down and then click edit. I have a profile (attached) which works for 1080p film video. Just click Import, then import that file-it will setup the proper settings. Apply the settings and move right to "Start Encode" (or you can put a name in the file under attributes). You might want to turn on the input preview video to confirm it is able to open the avi file. This will take a LONG time, but when it completes you'll have a WMV-HD, playable on the Xbox 360! At my house, they end up in the Purl Media Cache, which ushare streams out to the Xbox 360.