Thursday, August 30, 2007

Decrypting and re-encoding DVD-Audio

DVD-Audio is a standard for storing high quality stereo or multi-channel audio content on a standard DVD disk. Supported sample rates range from 44.1KHz up to 192KHz, with bit depths of 16, 20 or 24 bits. A DVD-Audio contains both DVD-Audio content (in the AUDIO_TS folder) and DVD-Video content (in the VIDEO_TS folder) and has the DVD-Audio logo. The audio in the AUDIO_TS folder can be either Linear Pulse Compression Modification (abbreviated LPCM, which is uncompressed) or Meridian Lossless Packing (abbreviated MLP, which is losslessly compressed). Usually, a DVD-Audio contains 5.1ch MLP / 2.0ch MLP or 5.1ch MLP / 2.0ch LPCM. There is also audio present in the VIDEO_TS folder, but of lower quality (that is with a lower sample rate and a lower bit depth). More information can be found here.

A DVD-Audio can be encrypted. The encryption is called Content Protection for Prerecorded Media (CPPM), which uses a media key block (MKB) to authenticate DVD-Audio players. In order to decrypt the audio, players must obtain a media key from the MKB, which also is encrypted. The player must use its own unique key to decrypt the MKB. If a DVD-Audio player's decryption key is compromised, that key can be rendered useless for decrypting future DVD-Audio discs. DVD-Audio discs can also contain digital watermarking technology, typically embedded into the audio once every thirty seconds. If a DVD-Audio player encounters a watermark on a disc without a valid MKB, it will halt playback. quoted from wikipedia As of today, the encryption is broken, but it is not possible to remove the watermarks yet.

The purpose of this guide is the following:

  • It explains how to decrypt and re-encode the audio of your DVD-Audio to FLAC (which is an open source lossless audio codec). This enables you to play your re-encondings on your PC without any hassle (using open source tools).
  • The above will be done retaining higher quality than the audio counterpart that is located on the video section of the disc.

As of today, it is not possible to decode the MLP tracks of your DVD-Audio using open source (or even free) tools. So you need to get one of the following two tools:

  • The Sonic filters "Sonic HD Demuxer" and "Sonic Cinemaster@Audio Decoder 4.3.0". They are directshow filters contained in the package "Sonic.CinePlayer.HD.DVD.Decoder.v4.3.rar".
  • Surcode MLP.

If you want to use AviSynth (without creating intermediate WAV files) then you need to get the Sonic filters somewhere. As of today, 192kHz 24bit MLP tracks are not supported by the Sonic filters, so you are forced to use Surcode MLP in that case. The Sonic filters which support MLP decoding are the following:

  1. CinemasterAudio.dll v4.2.0.840, SonicHDDemuxer.dll v4.2.0.59
  2. CinemasterAudio.dll v4.3.0.151, SonicHDDemuxer.dll v4.3.0.73
  3. CinemasterAudio.dll v4.3.0.169, SonicHDDemuxer.dll v4.3.0.89