On the fly audio conversion

Discussion of advanced MakeMKV functionality, expert mode, conversion profiles
mike admin
Posts: 3832
Joined: Wed Nov 26, 2008 2:26 am

On the fly audio conversion

Post by mike admin » Wed Mar 28, 2012 7:33 am

Starting with v 1.7.3 MakeMKV can convert certain audio tracks during processing. As audio conversion is fast, it should have no effect on the processing speed.

As of version 1.7.7 following conversions are supported:
DTS-HD decoding is supported on all platforms after one-time additional setup.

As MakeMKV is capable of reading MKV files, you can also transcode MKV files that have audio in WAV container into flac or raw LPCM.

As indicated in viewtopic.php?f=10&t=4385 , audio conversion is controlled by a conversion profile. Each track type can have assigned multiple output types. Output type "FLAC" forces conversion to FLAC, and output types LPCM-raw and LPCM-wavex will cause conversion to LPCM.

MakeMKV can't do audio decoding/encoding by itself, it needs an external program called ffmpeg to perform actual audio conversion. Starting with version 1.7.7 MakeMKV comes with a built-in ffmpeg executable (mmffmpeg) that supports FLAC-encoding for 24-bit audio. It is still possible to use custom ffmpeg executable, however there should be really no need to do so.

UPDATE: The text below is obsolete as of 1.7.7
You need to download and install ffmpeg binary and let MakeMKV know its location - this should be one-time setup. There are many ffmpeg versions floating on the net and there is a big chance that you already have one on your computer. If not, here is the list of popular sources to get ffmpeg:
- For Windows, download 32-bit or 64-bit static binaries from http://ffmpeg.zeranoe.com/builds/
- For Mac OS X, download the latest binary from http://ffmpeg.arrozcru.org/autobuilds/f ... 64/static/
- For Linux, there should be one in your distribution, the typical location is /usr/bin
- You can always build one by yourself from source code at http://ffmpeg.org/

Once you have ffmpeg binary, go to MakeMKV preferences and set location of ffmpeg binary in advanced tab. After that you may use the profile that forces LPCM or FLAC outputs. Attached is a profile that converts all LPCM and TrueHD audio tracks to FLAC. This profile uses best (and slowest) FLAC compression by default; but you may change these settings in profile. As any additional command-line arguments for ffmpeg may be specified in profile, at least in theory you may use any ffmpeg audio filters or conversion capabilities.

Known bugs and issues:

- This is the work in progress. While this functionality was excessively tested, always double-check the result of conversion. It's recommended to have "show debug messages" and "show AV sync issues" enabled in preferences. Also, all ffmpeg output is written to MakeMKV log file, so it's recommended to check this file as well.

- As of today, all versions of ffmpeg have FLAC encoder clipped to 16-bit samples. It means that if you're converting 24-bit LPCM or TrueHD, conversion will not be lossless. This is a bug in ffmpeg that should be addressed shortly. For now, you have to check that your audio tracks are 16-bit. To add to confusion, most TrueHD tracks are in fact 16-bit even they are encoded as 24-bit - only 16 bits are used for actual data. This only applies to "regular" ffmpeg. The ffmpeg executable that comes with MakeMKV starting with 1.7.7 encodes 24-bit audio correctly