Multichannel audio in iTunes (on a Mac)

QuadraphonicQuad

Help Support QuadraphonicQuad:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

tghewett

New member
Joined
Feb 24, 2020
Messages
7
Location
UK
This is intended to be a tutorial, hopefully not duplicating a pre-existing thread. This is for Macs but may work on Windows as well with a little "standing on one leg and pulling faces" and such like.

It would be great to have multichannel music in iTunes but "multichannel" and "iTunes" are two words which don't mix. The only way seems to be to have Dolby Digital or DTS in WAV files and to manually set up the digital output audio device to the right sample rate, setting the iTunes volume to maximum (x1) to preserve the bitstream. This works but iTunes does not have exclusive use of the device, so system beeps or viewing web page videos will disrupt the decoding of the bitstream and leave just silence, or even worse, a very loud noise.

However there IS a way by using the M4V format used by podcasts. This supports multiple audio codecs including Dolby Digital, including multichannel Dolby Digital. Playing a Dolby Digital track causes iTunes to set up the audio device for exclusive use, the stream being selected via the "Audio & Subtitles" submenu on the Controls menu which becomes available when multiple streams are present in an imported M4V file. This provides what is needed - no other application producing audio can mix anything into the playback stream so it stays intact.

An M4V file imported into iTunes can be played like an MP3, WAV, or ALAC file, but now with full multichannel support. It also contains only raw DD, unlike WAV files which encapsulate it in a padded-out S/PDIF format and use much more space, so it helps to make the most of hard disk space.

The M4V format also supports chapters, a new menu being added when iTunes detects a track has chapters defined in it - this makes it possible to import a whole album as a continuous DD stream and to access individual tracks as chapters, meaning the audio can play continuously without gaps, gaps being unavoidable if the album is imported as separate tracks.

Unfortunately the M4V format does not support DTS as a codec, they remain only playable in WAV-type PCM files.

How-to:
  1. make sure you have the ffmpeg command line utility installed.
  2. get your audio into a continuous raw Dolby Digital stream in a file. If there are multiple audio tracks (e.g. stereo and multichannel versions), make sure they are in separate files.
  3. prepare your chapter markers in a file, see below for a sample.
  4. the "fun" bit - create your M4V file with ffmpeg:
Bash:
ffmpeg -i chapters_file.txt -i first_ac3_file.ac3 -i second_ac3_file.ac3 -map 1:0 -map 2:0 -c:a:0 copy -c:a:1 copy -metadata:s:a:0 language=eng -metadata:s:a:1 language=eng -disposition:a:0 default -disposition:a:1 none -f mp4 outfile.m4v

The results will be in "outfile.m4v" which can then be directly imported into iTunes like any other track.

This example is for two Dolby Digital audio streams (each of which will be separately selectable in the iTunes "Audio & Subtitles" submenu when the imported file is played) but it can be adapted for any number. Just add "-i nth_ac3_file.ac3", "-map n:0", "-c:a:n-1 copy", "-metadata:s:a:n-1 language=eng" and "-disposition:a:n-1 default" options as appropriate. Note that the "-disposition" option sets which stream is to be the default, so there should only be one set to "default", all the others should be set to "none". If there is only one audio stream then this option can be skipped. The "-map n:0" options must be in order otherwise the subsequent options will stop working.

Sample "chapters_file.txt" file for ffmpeg, adapt as appropriate. The start and end times are in 100ths of a second.

Code:
;FFMETADATA1
major_brand=M4V
minor_version=0
artist=Pink Floyd
album_artist=Pink Floyd
album=Atom Heart Mother
genre=Rock
compilation=0
gapless_playback=0
[CHAPTER]
TIMEBASE=1/100
START=0
END=21400
title=Rise And Shine
[CHAPTER]
TIMEBASE=1/100
START=21400
END=49800
title=Sunny Side Up
[CHAPTER]
TIMEBASE=1/100
START=49800
END=78000
title=Morning Glory

Make sure that you select "Prefer AC3 Passthrough" in the iTunes "Audio & Subtitles" submenu, and enjoy.
 
Last edited:
Nice. Thanks for posting this info. While it does look a bit daunting, it's a sure bet that the only way we're going to see multichannel music move forward (sadly) is if it becomes something that can be played from a phone or tablet.

How nice would it be to load your phone up with 5.1 files and have your car, your home system, or whatever play them discretely, and not through something like an Amazon fake-surround listening device.
 
Unfortunately iTunes has quite limited file format support.

I’d recommend using other media player software that plays more universal file formats such as FLAC and even DSF. At least these formats will remain more future proof, allowing all the hard work involved in disc/file conversion to be reusable if we change players over time.

ITunes is a reasonable choice for portable stereo listening but there’s not many (any?) options for surround listening in a portable environment.

For hardcore multichannel enthusiasts a dedicated separate speaker system is the norm. Most are using computers (lots of great software media player choices) and some using dedicated media players, which support lossless FLAC, DSF and high def surround music videos etc. Most these options have music library and artwork features that are quite flexible.

I can’t see many here would feed such systems from an iTunes library.

Nice work though! I never realised iTunes could play mch.
 
I just saw this post, while doing some searching for a friend. I've been sending him DTS WAV files over the years but didn't know that he was converting them in iTunes to AIF files. Strangely, these AIF files seem to still be compressed by DTS and play MC just fine on his iTunes. To test it out, I took a DTS WAV file and converted it to AIF in Xrecode. No matter which player I used (iTunes died on me earlier this year, so excluding iTunes) I got static. But I sent the file to him anyways and he could play it just fine. He is trying to balance file size with MC and this seems to work for him. Just wanted to share.
 
Oh my gods...

Just download old and simple Songbird!
iTunes is a broken old media player app they abandoned over 15 years ago. It doesn't even play multichannel files in its own native ALAC! Still shipping with no FLAC codec. etc etc. It's a file transfer utility app for iThings now and that's absolutely it. (Not a good one either! Nothing very Apple-like in this experience.)

And going to all that trouble to hear crappy lossy dolby!?

Oh my gods...

Songbird. Just download Songbird!
It's free, simple, and looks like iTunes.
You can mix and match different surround channel formats in the same playlist and everything always comes out the correct speakers. Supports pretty much all the lossless full quality surround formats.

You're giving yourself a Windows-like experience on your poor Mac there, Tghewett!

PS. If the aim is to feed an older AVR with a dolby encoded signal to kludge an AVR with no appropriate inputs for lossless delivery. Just change the extension from .dts to .wav. Send it to your digital output connected to your AVR. Don't accidentally send that output directly to a sound system!!!
 
...To test it out, I took a DTS WAV file and converted it to AIF in Xrecode. No matter which player I used (iTunes died on me earlier this year, so excluding iTunes) I got static.

The critical thing with playing DTS masquerading as linear PCM (it makes no difference whether it is in a WAV or AIFF file, it is still the same set of PCM pseudo-samples when in the padded S/PDIF format, as found in WAVs and AIFFs) is that the volume in iTunes must be set to maximum - these effects a "x1" multiplication and so the DTS stream passes out of iTunes without any gain modification. It is also critical to ensure that the audio device being played to is set to the sample rate as the DTS stream otherwise the resampling process will destroy the DTS bitstream - on Macs this can be done using the Audio MIDI Setup application in the Utilities folder. If these things aren't done then the DTS pseudo-samples will just be played as PCM at the amplifier, with the consequences you mention.

It is a shame that the M4V container format doesn't support the DTS codec, only Dolby Digital, otherwise it would be possible for iTunes to set up the audio device for you automatically and also make sure it has exclusive use of it to stop any other application from corrupting the DTS stream, just as it does already for AC3.
 
iTunes is a broken old media player app they abandoned over 15 years ago. It doesn't even play multichannel files in its own native ALAC! Still shipping with no FLAC codec. etc etc. It's a file transfer utility app for iThings now and that's absolutely it. (Not a good one either! Nothing very Apple-like in this experience.)

iTunes is frustrating in that way, but the lack of FLAC support is part-compensated for with support for ALAC. It is fair to say that iTunes weaknesses do encourage a flourishing third party market for better media players... Still, it is useful to find a way to play multichannel audio natively within it, I thought it wasn't possible until discovering this technique. The extra-nice thing is that AC3 in M4V container files is stored in the raw form, i.e. without the space-sapping padding found in the S/PDIF format found in WAVs and AIFFs, so they are much more compact.

And going to all that trouble to hear crappy lossy dolby!?

Convenience. It's not that bad, though DTS is audibly more precise and is normally preferred, though it takes up hugely-more space.

Not sure what you mean in your postscript.
 
Back
Top