Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#2153 closed defect (fixed)

aac 7.1 channel layout

Reported by: Crayden Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: 7.1 aac
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Looking at the specification from
http://developer.apple.com/library/mac/#documentation/MusicAudio/Reference/CoreAudioDataTypesRef/Reference/reference.html#//apple_ref/doc/c_ref/kAudioChannelLayoutTag_AAC_7_1
the channels are decoded correctly for 7.1 aac files but it looks like they're mapped/mixed in the wrong way resulting in the following output behaviour:
left -> left + center
center -> center
right -> right + center
right surround -> right
left surround -> left
right rear surround -> right rear surround
left rear surround -> left rear surround
lfe -> lfe

Since most players and audio drivers don't handle this specific layout correctly it may be wise to convert the layout for 7.1 channel aac files to a standard layout.

This issue has already been fixed in the ffmpeg fork for LAV-Filter. Take a look at:
http://git.1f0.de/gitweb?p=ffmpeg.git;a=commit;h=dfcbfd57c35bbef83df5c5256485e5bfa6f81f41

If you need a test file:
https://www.dropbox.com/s/csnm34xap2176sv/Channel%20Check%20Lots%20of%20Formats.mkv
(make sure to select the 7.1 channel aac track)

Attachments (1)

AAC 7.1 (channel_configuration 0 + PCE, 3 front, 2 side, 2 back, lfe).mp4 (162.5 KB ) - added by Carl Eugen Hoyos 11 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Crayden, 11 years ago

Version: unspecifiedgit-master

comment:2 by Carl Eugen Hoyos, 11 years ago

Keywords: channel layout removed

The sample that you provided has a channel configuration (as defined in the AAC specification) of "7" and this corresponds to the channel layout "7.1 wide": FL FR C LFE BL BR FLC FRC (in a specific order but the order is not what this ticket is about afaict).
To the best of my knowledge, this is defined in the AAC specification and FFmpeg decodes the given sample in accordance with the specification (and its output matches QuickTime output which may not be a strong argument, see below).
Afaiu, the patch would change this behaviour from conforming to the specification to non-conforming.

I attached a sample with channel configuration "0" which means the channel layout is defined through PCE (program configuration element as in the specification), the sample is correctly identified as 7.1 (non-wide) and is decoded correctly afaict. (QuickTime apparently fails to decode the attached sample correctly, it seems to assume all 8 channel aac samples as 7.1 wide.)

Perhaps Hendrik can comment further?

comment:3 by Hendrik, 11 years ago

I realize that my patch is not in accordance with the spec, however my requirements are a bit different, because i deal with Microsofts DirectSHow things, and using the "unusual" wide channel layout causes quite a bit of issues with other components in the DirectShow infrastructure, which is the main reason i changed it.

I do not believe its the right course for ffmpeg itself to change this, instead it should stay true to the spec.

comment:4 by Crayden, 11 years ago

True.
I still wonder why they even included this layout in the specification as it is probably almost nowhere in use.

Anyway I hope the developers using the libraries and not reordering the channels (like xbmc) will fix this in the future.

comment:5 by Carl Eugen Hoyos, 11 years ago

Resolution: worksforme
Status: newclosed

I am closing this ticket as worksforme because I believe your sample is handled correctly by FFmpeg.

I wanted to suggest using -channel_layout 7.1 as a work-around, but the option is currently broken - this is ticket #2163 - and I fear it may not work for aac for some reason, this should be tested as soon as ticket #2163 is fixed.

comment:6 by Carl Eugen Hoyos, 10 years ago

Resolution: worksformefixed

The issue was fixed slightly differently by Anssi Hannula in e10fccf6

Note: See TracTickets for help on using tickets.