[Updated 02/21/2017] Please see the updated Alternative Solutions below. These don’t require Cubase.
For those of us who are hobbiest home audio engineers, here’s a tip that might come in handy when trying to extract 5.1 (6 channel) audio from DTS/AC3 to individual WAV (or more specifically, WAV 64) files. This technique may or may not work for 7.1 (8 channel) audio. Let’s explore.
What You Will Need
First Step – TSMuxer GUI
Extract the DTS/AC3 stream from video container using TSMuxer Gui. To do this…
- Load the *.m2ts, *.vob, *.mkv, etc file into TSMuxer Gui using File=>Open.
- Once the file is loaded, uncheck all other streams except the audio stream (DTS or AC3)
- Choose ‘Demux’ as the Output type
- Choose ‘Browse’ if you want to place the output file somewhere other than where the app has chosen
- Click ‘Start Demuxing’
- When completed, you will have a *.dts or *.ac3 file as output.
This step demuxes the audio from the full movie container.
Second Step – FFMpeg
Extract the DTS 5.1 audio to single 6 channel WAV file via FFMpeg using the following:
This will create a 6 channel w64 (wave 64) file. You’ll want to use *.w64 because of the 4GB max size of standard *.wav files. If you know your output file will be sized smaller than 4GB, you can use *.wav instead. Also, if you want to master in 32 bit or higher, you can choose the pcm output version that corresponds to the bit size you want to use. I’m using 24 bits for my remastering efforts. The larger amount of bits you use for mastering, the more likely you will need to use w64.
Third Step – Cubase
- File=>Import to input output-file.w64 into Cubase
- When the small panel appears asking how you would like to import, choose Split Channels. You can number them if you like.
- It may take a little while to split them all out.
Note, this is the part that I do not know if Audacity supports. It may be able to perform Split Channels like Cubase, but you would need to test Audacity to find out whether it can and how. Cubase can definitely split the channels, though.
Fourth Step – Exporting WAV / W64 files
- From here, you can continue to use Cubase or Audacity to produce a remastered audio file or …
- You can save each individual channel as a separate WAV file for some other use. Note, you should use *.w64 (wave 64) if the files are expected to be larger than 4GB in size.
Using ffmpeg only.
Note, you will need to install the latest version of ffmpeg to ensure compatibility with this solution.
I have since found you can accomplish the extraction to individual WAVes using ffmpeg only. You won’t need Cubase or tsmuxer for this alternative solution. You extract your WAVes by setting up channel mappings, then assigning those mappings to each output file. Though, this solution is just a tad bit more complicated in that you need to know what channels your input audio offers, which channels to extract and what the two letter abbreviation for the channel is within ffmpeg.
For extracting 5.1, use the following command (Linux line break style shown):
To extract 7.1, use the following command:
Where infile is your source file. The input can be a video file (i.e., vob, m2ts, mkv, etc) or a multitrack audio file (i.e., AC3, DTS, etc). If you are running Windows using a CMD command shell, you will need to type the command in without the line breaks shown above. So, copy and paste won’t directly work on Windows. You’ll need to use an editor to make the command Windows friendly.
Note that there are a lot of different possible mappings for various types of audio input files. Since there are now many formats of soundtrack audio available such as Dolby Atmos, Dolby DTS, AC3 and various others, you should first determine the format of the input audio with ffprobe (see below) to better understand how to map and extract the audio. The channels available for possible extraction in ffmpeg include the following:
To determine the audio channels available to extract from your infile, use ffprobe as follows:
Linux / MacOS X
The output will look something like
The stream marked in red is the stream you will need to examine. In the output example above, this audio contains 5.1(side) audio using the DTS format. For 5.1(side) extraction, the command would look like the following:
Audio Output Format
If you don’t specify an audio output format, ffmpeg defaults to using pcm_s16le which creates a 16 bit WAV file for each channel. If you want to preserve the bit rate of the original audio, then you’ll want to specify the output format to be the same as the input for each WAV. This means that you can, if you want, specify 16 bit for some channels and 24 bit for others. For 24 bits, specify -acodec pcm_s24le just before each -map flag (see example above). For 32 bits, specify -acodec pcm_s32le.
Also note that while you can select the individual audio track within the a movie container, you don’t really need to. Ffmpeg automatically selects the best quality audio stream available in the container. However, if there are multiple 5.1 or 7.1 audio streams containing equal quality or there are multiple separate programs, you will need to tell ffmpeg to choose which stream to decode into WAV files. Note that if you need the syntax for selecting a specific audio stream using ffmpeg, please leave a comment below and I’ll write up an example for you.
Below is a list of PCM output formats available in ffmpeg version 3.2.4:
You’ll need to prefix pcm_ to the name of the format to use it on the command line. For example, if you want to use u16be, then you would specify that as -acodec pcm_u16be.
Windows Only (eac3t0)
Tool required: eac3to
Here is the command to use to extract all of the waves with eac3to:
You’ll want to choose the proper drive for each of the paths instead of C:\. Also note, the .wavs (with the ‘s’) extension is important so that all of the WAVes will be exported from this tool.
Thanks go to Eli for the eac3to solution. If you are running Windows in your audio workflow, then this tool seems to be a fast one-step alternative.