How to Convert TrueHD to FLAC with FFmpeg

This guide provides a straightforward tutorial on how to transcode a Dolby TrueHD audio track to the lossless FLAC format using the powerful command-line tool FFmpeg. You will learn the exact command-line syntax needed to perform this conversion while preserving the original audio quality and multi-channel configuration.

The Basic Conversion Command

To convert a TrueHD audio track from an input file (such as an MKV video or a standalone audio file) into a FLAC file, use the following basic FFmpeg command:

ffmpeg -i input.mkv -c:a flac output.flac

Command breakdown: * -i input.mkv: Specifies the path to your source file containing the TrueHD track. * -c:a flac: Tells FFmpeg to encode the audio stream using the lossless FLAC encoder. * output.flac: The name and format of the resulting output file.

Extracting and Converting a Specific Audio Stream

If your source file contains multiple audio tracks (for example, a stereo descriptive track and a 7.1 TrueHD track), you must map the correct stream to avoid converting the wrong audio.

First, identify the stream index of the TrueHD track by running:

ffmpeg -i input.mkv

Look for the stream labeled Audio: truehd. Once you know the stream index (for example, stream 0:1), use the -map option to select it:

ffmpeg -i input.mkv -map 0:1 -c:a flac output.flac

Preserving 24-bit Audio Depth

TrueHD tracks are often 24-bit. By default, FFmpeg’s FLAC encoder will automatically select the appropriate bit depth to match the source. However, you can explicitly force a 24-bit sample format to ensure no quality is lost during the transcoding process:

ffmpeg -i input.mkv -c:a flac -sample_fmt s24 output.flac

Remuxing FLAC Back into an MKV Container

If you want to replace the original TrueHD track with the new FLAC track inside the original video container (without re-encoding the video), run the following command:

ffmpeg -i input.mkv -map 0:v -map 0:a:0 -c:v copy -c:a flac output.mkv

This command copies the video stream (-c:v copy) without re-encoding it, while simultaneously converting the first audio stream (-map 0:a:0) to FLAC.