How to Extract Dolby Atmos from TrueHD using FFmpeg
This article provides a straightforward guide on how to extract and demux a Dolby Atmos audio track from a Dolby TrueHD stream using FFmpeg. Since Dolby Atmos is stored as a set of spatial audio metadata extensions directly inside the TrueHD stream rather than as a separate physical track, preserving Atmos simply requires copying the TrueHD stream without re-encoding. Below, you will find the exact FFmpeg commands needed to identify and extract this audio track losslessly.
Understanding Dolby Atmos in TrueHD
Dolby Atmos on Blu-ray discs is not a standalone audio file. Instead, it is embedded as Joint Object Coding (JOC) metadata within a lossless Dolby TrueHD carrier track. To demux the “Atmos sub-stream,” you must extract the entire TrueHD track using stream copying. Re-encoding the audio will destroy the Atmos metadata, so the stream must be copied exactly as-is.
Step 1: Identify the TrueHD Audio Stream
Before extracting the audio, you need to find the stream index of the TrueHD track inside your source file (usually an MKV or MP4). Run the following command in your terminal:
ffmpeg -i input.mkvLook through the console output for the stream labeled
Audio: truehd. It will look something like this:
Stream #0:1: Audio: truehd (true), 48000 Hz, 7.1, s32p (default)
In this example, the TrueHD track is at index 0:1 (the
second stream of the first input file).
Step 2: Demux the TrueHD/Atmos Track
Once you know the stream index, use FFmpeg to copy the audio track
into a raw TrueHD (.thd) file.
Run the following command, replacing 0:1 with the stream
index of your TrueHD track:
ffmpeg -i input.mkv -map 0:1 -c:a copy output.thdCommand breakdown: * -i input.mkv:
Specifies the source video file. * -map 0:1: Selects the
specific TrueHD audio stream found in Step 1. * -c:a copy:
Tells FFmpeg to copy the audio stream bit-for-bit without re-encoding,
preserving the Dolby Atmos metadata. * output.thd:
Specifies the output file. TrueHD streams with Atmos should be saved
with the .thd extension.
Step 3: Extracting to an MKV Container (Optional)
If you prefer to keep the extracted Atmos track in a container rather
than a raw .thd file, you can demux it into an audio-only
MKV container:
ffmpeg -i input.mkv -map 0:1 -c:a copy output.mkvThe resulting file will contain only the lossless TrueHD audio track with all original Dolby Atmos spatial metadata fully intact.