[Libav-user] FFmpeg channel layouts

Nicolas George george at nsup.org
Thu Jul 21 16:18:56 EEST 2022

rohit khali (12022-07-21):
> I have a query regarding channel layout in the FFmpeg decoded audio stream.
> Using below example to explain my question:
> As per ATSC A/52:2012, *coded channel layout* in a 5.1 E-AC3 stream is [L,
> C, R, Ls, Rs, LFE].
> For the same stream FFmpeg reported channel layout is [5.1(side):FL FR FC
> If we see here, the position of channels 'C, R, Ls, Rs and LFE' are
> different.
> Does FFmpeg reposition channels while decoding as per the standard FFmpeg
> channel layout [FFmpeg -layouts]?

When the audio is compressed, there is no order of channels, the
channels are encoded together to use the fact that they contain usually
a lot of similarity. A decoder will reconstruct each channels, and the
order in which it outputs them to the application is an unimportant
implementation detail.

For example, the audio hardware of a PC makes a different choice of
order than both FFmpeg and what you quoted above, and I am pretty sure
the kernel driver reorders to unify the order for different hardware.

FFmpeg decodes audio and gives you the channels flagged in the channel
layout in the order documented by FFmpeg. What you do with them then is
your task. Note that when the decoder produces planar output, the
reordering is computationally tiny.


  Nicolas George

More information about the Libav-user mailing list