Tag Archives: MakeMKV

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.

Some notes on ripping Blu-rays

Owing to my current HTPC project, about which a more comprehensive post is on the way, I’ve spent many hours over the last week delving into the murky, unexplored realm of ripping Blu-rays. This being a more niche format, requiring more unusual hardware and scads of hard drive space, the tools required aren’t quite as polished and straightforward as ripping a DVD, but a bit of trial and error has taught me a few tricks.

Tools

The most important tool is MakeMKV, which is free while it’s in beta. It’s a great app that does one thing and does it very well: rips DVDs and Blu-rays from the disc to an MKV file. No conversion or compression – except for one exception, which I’ll come to shortly. DVDs get run through HandBrake since a heavily compressed source isn’t going to suffer too much and the file size can be cut by ~60%, but I want my BDs in their full glory.

MakeMKV

File sizes that this approach result in range wildly, but a single file with one HD audio track results in a 20-40GB file. Hope you have a lot of HDD space.

As far as Blu-ray hardware goes, I spent £39 on a Panasonic UJ-260 on eBay, which is a USB drive that can read and write Blu-rays all the way up to the 100GB BD-R XL discs. It can rip most movies in 40 minutes or so. A very decent no-frills BD drive that works fine on both my Mac and the HTPC.

Handling HD audio

One minefield in putting together an HTPC is that the capabilities of HDMI hardware vary wildly depending on hardware and driver support. A particular difficulty comes in the ability (or not) to output Dolby TrueHD and DTS-HD Master Audio as a bitstream, which allows an AV receiver to handle the decoding and processing. Most HTPC software can decode internally to some extent, however, but my choice uses a reverse-engineered open-source implementation, and I can’t help but suspect that it’s not going to do as good a job as my Denon.

As it happens, bitstreaming HD audio on AMD hardware in Linux is a new addition and doesn’t yet work reliably on my setup. TrueHD can be decoded to uncompressed PCM in XBMC, but DTS-HD leaves me only with the compressed DTS ‘core’, which is barely better than DVD. That won’t do.

Thankfully MakeMKV has the ability to convert the HD formats to the open-source FLAC, which is open and far better documented. What’s more, it actually creates smaller files, while still remaining lossless. And it’s a handy option for those releases with only PCM audio, as that can account for 8GB of audio alone.

There’s a separate post coming on this issue, complete with file size comparisons.

Subtitles

BD handles these slightly differently to DVD. Whereas DVD would have a separate, hidden subtitles for ‘forced’ subs (e.g. scenes in a foreign language in otherwise English movies), BD simply marks the appropriate lines in the main subtitle track as forced, meaning they should be shown even if subtitles are turned off.

MakeMKV has the ability to only add these forced subs to the output, but you still need to work out which track is the correct one – a movie can have separate English subtitle tracks for closed captions, commentaries, dubs vs original tracks (e.g. a direct transcription of the English dub and a more literal translation of the original audio, as on some anime releases), trivia, and more.

Handily, the community as AVS Forum has put together a spreadsheet that lists the correct subtitle tracks for various releases. It’s not comprehensive, but it has a lot of common movies. Worth bookmarking if you’re going to be doing a lot of this. Simply tick the ‘forced only’ box for the one you need.

More to come…

These are the results of my early experimentations. I’ve got a spreadsheet – when I say I’m experimenting, I mean it – on the go with the compression rates achieved by the above FLAC conversions and will share that data when I’ve converted my initial batch. Also, once this whole HTPC project is in a stable state, I’ll put together my tips on how one can be assembled for around £200. In the meantime, get a load of this…

XBMC movie library

Isn’t it beautiful?