Opened 8 years ago

Closed 8 years ago

Last modified 7 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


Looking at the specification from
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:;a=commit;h=dfcbfd57c35bbef83df5c5256485e5bfa6f81f41

If you need a test file:
(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 cehoyos 8 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 8 years ago by Crayden

  • Version changed from unspecified to git-master

comment:2 Changed 8 years ago by cehoyos

  • 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 Changed 8 years ago by heleppkes

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 Changed 8 years ago by Crayden

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 Changed 8 years ago by cehoyos

  • Resolution set to worksforme
  • Status changed from new to closed

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 Changed 7 years ago by cehoyos

  • Resolution changed from worksforme to fixed

The issue was fixed slightly differently by Anssi Hannula in e10fccf6

Note: See TracTickets for help on using tickets.