5.1 to Stereo ... Mac vs AppleTV

The Perian forums have moved to Google Groups, this forum is read only.
gbooker
Cocoaforge Admin
Posts: 723
Joined: Sat May 06, 2006 2:47 am
Contact:

Re: 5.1 to Stereo ... Mac vs AppleTV

Postby gbooker » Thu Jan 22, 2009 3:16 pm

Trevize wrote:And inside the dac3 the channel layout as in the new ETSI specification.

That's the wrong kind of channel layout. It contains the channel count and information as to which channels are present. The channel layout I'm referring to is the one that QuickTime uses which indicates the order in which the channels come out of the decoder.

For example: 5.1 could be "L R C LFE Ls Rs" (which is the order mandated by Core Audio unless a specific order is provided). Another example could be "L C R Ls Rs LFE" (which is the layout that Apple's .ac3 file importer uses despite the fact that the only multi-channel AC3 decoder on the mac doesn't use that layout and existed before their importer; rdar 5799879). These two layouts have identical channel sets, but different order, and the dac3 atom does not contain this order information.

One can argue that the order of channels should be set by the decoder and not the file, but as I said earlier, while the layout from the decoder is queried, it is ignored by QuickTime, and QuickTime never sets a layout in the decoder.

dkeel
Harmless
Posts: 12
Joined: Tue Jan 08, 2008 7:54 pm

Re: 5.1 to Stereo ... Mac vs AppleTV

Postby dkeel » Thu Jan 22, 2009 3:56 pm

Just a thought relating to all of this - I have a really clever (and understanding!) friend who I have persuaded to put together a nice script thing for me that will go through my movie collection and if a movie has only an AC3 5.1 soundtrack it will save this as a Stereo AAC and then add it back to the movie and save it out. It will be able to deal with batches and will have a progress bar etc. Once it is ready then I will try it out and if it all works OK then I am sure that he will be happy for me to leave it somewhere for download by anyone who would find it useful. BUT - since a lot of my movies (and probably a lot of other people's movies) have 6 tracks defined as mono in the AC3 5.1 - would it first make sense for the script to assign these to the correct layout ("L R C LFE Ls Rs" for example). I assume that the Visual Hub created 5.1 (6 x mono) is at least consistent and that if somebody on this thread can advise what the correct layout for every movie created in this way should be then it may be able to be incorporated into this script (or a small routine created that would simply fix this in each movie that has been created in this way).
Not sure if this makes sense or not - and I'm sure that somebody will tell me if it doesn't!

Trevize
Harmless
Posts: 13
Joined: Thu Mar 24, 2005 9:14 am
Contact:

Re: 5.1 to Stereo ... Mac vs AppleTV

Postby Trevize » Thu Jan 22, 2009 3:57 pm

Well, clearly apple didn't take it only as a channel count as it uses the layout written in these specs in their mp4 importer. Each acmod value means a different channel count with a different channel layout as described there.
Yeah maybe ETSI and Apple did a stupid thing, saw this little nice table in that file an thought of using these layout, but this is what they did for ac-3, and waiting for them to "fix" it is kinda useless, as we all know that they take years to fix real bug, I would bet they will never change their channel layout only because an open source ac3 decoder uses a different one.

Trevize
Harmless
Posts: 13
Joined: Thu Mar 24, 2005 9:14 am
Contact:

Re: 5.1 to Stereo ... Mac vs AppleTV

Postby Trevize » Thu Jan 22, 2009 4:03 pm

And I see that they added the following layout in CoreAudioTypes.h:

Code: Select all

   kAudioChannelLayoutTag_AC3_1_0_1            = (149L<<16) | 2,                       // C LFE
   kAudioChannelLayoutTag_AC3_3_0               = (150L<<16) | 3,                       // L C R
   kAudioChannelLayoutTag_AC3_3_1               = (151L<<16) | 4,                       // L C R Cs
   kAudioChannelLayoutTag_AC3_3_0_1            = (152L<<16) | 4,                       // L C R LFE
   kAudioChannelLayoutTag_AC3_2_1_1            = (153L<<16) | 4,                       // L R Cs LFE
   kAudioChannelLayoutTag_AC3_3_1_1            = (154L<<16) | 5,                       // L C R Cs LFE


gbooker
Cocoaforge Admin
Posts: 723
Joined: Sat May 06, 2006 2:47 am
Contact:

Re: 5.1 to Stereo ... Mac vs AppleTV

Postby gbooker » Thu Jan 22, 2009 4:59 pm

Trevize wrote:I would bet they will never change their channel layout only because an open source ac3 decoder uses a different one.

Actually, it's the only thing on the entire platform which uses it. The only AC3 support Apple has ever provided is an encoder in their Pro apps (for DVDs) and passthrough. Neither need a channel layout defined in QuickTime. Furthermore, the only documentation I have ever seen for channel layout in CoreAudio (not QuickTime) mandates a layout of L R C LFE Ls Rs with missing channels skipped.

Trevize wrote:Well, clearly apple didn't take it only as a channel count as it uses the layout written in these specs in their mp4 importer
Trevize wrote:Yeah maybe ETSI and Apple did a stupid thing

AC3 is unique in that it knows which channel information belongs to which channel. Some compressors encode each channel individually, in which case the codec need not know the layout (but the player does), but AC3 is not one of those. So, defining a channel order in the spec not only unnecessary, it is misleading.

Trevize wrote:And I see that they added the following layout in CoreAudioTypes.h

That's rather moot as I can see there is no definition for 3_2_1 (5.1) which is by far the most popular.

Apple made several mistakes here, all of which in concert lead to this problem. If they correct any of them, it will entirely fix it.
  1. They defined the channel order as part of the AudioStreamBasicDescription only
  2. They don't communicate channel order between QuickTime and CoreAudio components
  3. They don't take into account that CoreAudio has a predefined channel order but instead expect channel order in the one defined in the AudioStreamBasicDescription (and not communicated to the CA component)
  4. They started using a channel order which is different from the only thing on the platform which uses it.

It could be possible that communication of channel order does exist, but I have not seen it documented anywhere, and my attempts to guess at it resulted in QuickTime ignoring the information my component provided, or it never querying/setting it. If someone could provide the information on how this is done, then I can modify the interleaver to handle it (since liba52 gives a completely different order, one already exists in the code).


Return to “Perian”

Who is online

Users browsing this forum: No registered users