Dolby Digital 5.1 AC-3 passthrough not working

In testing my video tracks with accompanying Dolby Digital 5.1 (AC3) audio soundtracks, I'm finding the Apple TV Dev Kit is not recoginizing the AC3 soundtrack, and is reverted to the stereo-only AAC track. This problem occurs for both in-app audio and audio streamed via Airplay.


Never had a problem with these files (iOS 6 through 9. -iPhones and iPads via Airplay). Works fine for Apple TV 2nd and 3rd gen.


Bug report filed : 22792203


If you also depend on AC3 passthrough support for your apps, please report your findings here.Thanks!

UPDATE: After extensive testing, I have determined the problem lies with video that was processed with Apple Compressor using "Multi-Pass" encoding enabled. For some reason, the Apple TV Dev Kit is more sensitive to whatever is going on with this encoded file configuration and will not (consistently) recognize the AC3 (or EC3) track that accompanies.

Work-around: In all cases, re-processing the video in Compressor with the "Multi-pass" option turned off resulted in an AC3 track which Apple TV Dev Kit will indeed recognize and play.

Thank you for filing the bug report!

GM Update: Apple TV still does not recognize Dolby Digital 5.1 tracks. At least not those created with Final Cut Pro X and Apple Compressor.

I create and encode my tracks with Adobe Audition, and have had good results. I do have to manually force the Apple TV into "Dolby Surround Sound" mode, otherwise it detects too many channels (8 on a 5.1 system) and the mapping is all off.

What are you using to play back your audio? Make sure you set your audio session before playback, and query/set the number of channels you need.

My embedded media are merely .m4v videos with an accompanying AC3 5.1 track (produced as per Apple spec for the iTunes / Apple TV). I just rely on the Apple TV to passthrough the AC3 for decoding by the receiver, using the native player. (MPMoviePlayerController for iOS, AVPlayerViewController for tvOS.) Sounds like you are mapping raw tracks to surround channels?


"Make sure you set your audio session before playback, and query/set the number of channels you need."


That's for AVAudioPlayer, right? Is it even possible to do this for AVPlayerViewController?

@pnb2001 - Have you filed a bug on this channel mapping issue? If so, please provide me with the number - thanks!

@jpdev001 - Yes, you can set the AVAudioSession category either way. However, if you are simply playing back a piece of media that contains video and an AC-3 5.1 audio track, it should just work.

I haven't, but I will.

Yes, that's been my experience with the previous gen Apple TVs. Something doesn't quite jive with this new ATV model and Dolby Digital - even with my workarounds in place, it still adds a touch of unrequested compression at times... (Full details in bug report 22792203)

I am not mapping raw tracks (that would be awesome, but I couldn't find a way to do it). Instead, I encode everything I need into .ec3 files and play those back, relying on passthrough to the receiver.

It might be worth a shot to set your audio session before creating your AVPlayerVC. Something along the lines of:


let session = AVAudioSession.sharedInstance()
session.setCategory(AVAudioSessionCategoryPlayback)
session.setActive(true)


//Check to see how many channels are available and set
//You're hoping for 6 for Dolby Digital

let maxChannels = session.maximumOutputNumberOfChannels
session.setPreferredOutputNumberOfChannels(maxChannels)

Also, in the Apple TV Audio Video Settings, try setting the Dolby Digital setting to On, rather than Auto.

I've already tried out the Apple TV Audio Video Setting options, but will certainly give setting the AVAudioSession a try and report back. Thanks!

As a test, I just removed the channel setting code from my own app, and surround sound still works, so that probably won't help you. I did leave in the setting of the session to AVAudioSessionCategoryPlayback.

Yeah, I forgot I had already had AVAudioSessionCategoryPlayback in my method, but did try the channel setting (to no avail, as you suspected). Thanks anyway, though!


Can you confirm you are decoding actual Dolby Digital 5.1? I know some AV receivers may switch into the old Dolby Surround on their own, or even a "faux" surround mode, which may sound pretty authentic if the surround content is not too distinct from the front channel information...

When I start to play a encoded sound, I see my receiver switch to Dolby Digital. My app also happens to be a surround sound testing and diagnostic app, so I'm pretty sure its working as expected. One of my tests is a channel identification test, and all of my speakers play back as expected. I can add you as a Test Flight tester if you'd like to check it out.

Dolby Digital 5.1 AC-3 passthrough not working
 
 
Q