Converting Blu-ray HD audio to FLAC

As I mentioned in my first look at ripping Blu-rays, converting uncompressed PCM and lossless Dolby TrueHD and DTS-HD Master Audio to FLAC for use in XBMC carries a number of benefits.

  • It’s also lossless, so no quality difference.
  • FLAC is an open, well-documented format and so you’re not reliant on reverse-engineered implementations.
  • XBMC can decode FLAC to PCM and output it over HDMI, whereas it currently can’t for DTS-HD.
  • Hard drive space savings can be significant, especially for PCM soundtracks.

There’s little penalty in terms of the time taken to rip the disc either, as it’s unlikely that your BD drive can copy data from the disc fast enough for the conversion process to become a bottleneck.

What you need

This process still uses MakeMKV, with the feature enabled in by checking the advanced options box in the settings. TrueHD decoding is built in, but you’ll need to find a separate DTS module and point MakeMKV to that.

MakeMKV

All you then need to do it choose the ‘FLAC’ preset when ripping a disc. Otherwise the process is identical.

File sizes

I picked three movies representing the three HD audio formats supported on BD. All were ripped to an MKV file containing only the main video, the lossless main audio track, and no subtitles; file size recorded; then passed through MakeMKV again to convert the audio to FLAC. After conversion, MediaInfo was used to verify that the number of channels, sampling rate and bit depth (some versions of the DTS decoder have a bug that will change 24-bit audio to 16-bit, hence the use of 24-bit audio tracks below) were unaffected.

Movie Audio Original size New size Delta
2001: A Space Odyssey PCM 5.1 (48kHz, 24-bit) 20.10GB 16.38GB 3.72GB (18.5%)
Blade Runner Dolby TrueHD 5.1 (48kHz, 24-bit) 18.22GB 18.08GB 0.14GB (0.8%)
The Bourne Identity DTS-HD Master Audio 5.1 (48kHz, 24-bit) 25.96GB 25.42GB 0.54GB (2.1%)

I noted a few more, with all the data recorded in this spreadsheet. The range of formats reflects the predominance of DTS-HD on Blu-ray these days, but there’s a clear 2-3% gain on substituting FLAC there. It doesn’t sound like much, but it’s half a gig when you’re talking about files of 20GB and up.

Conclusion

According to my unscientific tests, then, converting to FLAC delivers a saving in file size over the untouched original track across the board, with a minimal reduction for TrueHD and a handy half-gig saved on DTS-HD. Obviously, since the others are already losslessly compressed, the biggest gains come over PCM, where FLAC can shave 3.72GB off the size of the 2001 MKV – enough for another couple of DVD rips on my HTPC’s hard drive.

3 thoughts on “Converting Blu-ray HD audio to FLAC

  1. Thanks for the nice post!

    The hugest proc is that “XYZ can decode FLAC to PCM and output it over HDMI, whereas it currently can’t for DTS-HD”.

    I used to downconvert all DTS-HD MA to DTS-core stripping off the lossless MA part. Proper support of DTS-HD costs $$$ so I decided to save some space instead.

    I’m thinking of revising my collection now… 67 movies with downconverted DTS-HD. What a pain!

    P.S. If you post and compare lossy DTS-core as well in this nice spreadsheet, I will be so grateful!
    P.P.S. Do you know by a chance can Makemkv output only converted audio with no video stream?

  2. I’ve made some tests for DTS-HD MA samples and few movies. For Jungle Book with 2 MA streams it looks like the following:

    30G junglebook-ma.mkv
    29G junglebook-flac.mkv
    25G junglebook-core.mkv

    4.0G eng-7.1-ma.dts
    3.4G eng-7.1-ma-makemkv.flac
    3.4G eng-7.1-ma-ffmpeg.flac
    1.1G eng-5.1-core.dts

    3.1G ukr-5.1-ma.dts
    2.6G ukr-5.1-ma-makemkv.flac
    2.6G ukr-5.1-ma-ffmpeg.flac
    1.1G ukr-5.1-core.dts

    Quite often audio 16 bits streams are pumped up to 24 bits.

    Eac3to can track that and remove trailing zeros with no quality loss. This makes the size of lossless flac equal or smaller than lossy dts core :)

    eac3to v3.24
    command line: eac3to test.dtshd -analyzebitdepth
    ——————————————————————————
    DTS Master Audio, 5.1 channels, 24 bits, 48kHz
    (core: DTS, 5.1 channels, 24 bits, 1509kbps, 48kHz)
    Decoding with ArcSoft DTS Decoder…
    The original audio track has a constant bit depth of 16 bits.
    eac3to processing took 4 seconds.
    Done.
    ———————————————

    The original audio track has a constant bit depth of 16 bits.
    Superfluous zero bytes detected, will be stripped in 2nd pass.
    Starting 2nd pass…

    Unfortunately I can’t use eac3to, since it windows utility.
    Maybe you know how to achive same magic with ffmpeg?

    Thanks!

  3. Thanks for the contribution. I’ve been thinking of revisiting this post since my HTPC is getting a bit old and maybe I could do something different with the audio. I must say I’m glad I ripped them with lossless audio to begin with since I have 12TB of Blu-ray rips and really wouldn’t want to go through that again!

Leave a Reply

Your email address will not be published. Required fields are marked *