Hi all,
Every time I look at multi-channel audio codecs I wonder about the names
ffmpeg uses.
In comparison, I am looking at the names commercial products use. I'd
like to read your feedback...
Starting with Wikipedia's definition of Surround Channels and Center
Channel:
"Surround channels are audio channels in surround sound multichannel
audio. They primarily serve to deliver ambiance and diffuse sounds in a
film or music soundtrack."
"Center channel refers to an audio channel common to many surround sound
formats. It is the channel that is mostly, or fully, dedicated to the
reproduction of the dialogue of an audiovisual program."
This kind of tells us that the Center Channel, if it exists, is part of
a surround environment, but not the mandatory one. From this perspective
#define AV_CH_LAYOUT_2_1
(AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
#define AV_CH_LAYOUT_SURROUND
(AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
#define AV_CH_LAYOUT_3POINT1
(AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
should rather be AV_CH_LAYOUT_SURROUND, V_CH_LAYOUT_3POINT0 and
AV_CH_LAYOUT_3POINT1, respectively (the fact that 3.1 is surround + LFE
should already tell as much, IMHO).
libav is missing a few possible channels. These are:
- a second LFE channel (possible at least with Dolby Digital Plus, MLP
and DTS-HD)
- Left and Right Side High channels (DTS-HD)
AV_CH_WIDE_* should be renamed to AV_CH_FRONT_WIDE* for consistency.
AV_CH_BACK_* should be AV_CH_REAR_*, to use the names everyone else is
using.
AV_CH_SURROUND_DIRECT_* are matching SMTPE spec, but it's hard to see
from the name that this is "in the corner between AV_CH_SIDE_* and
AV_CH_BACK*". SMTPE uses this name to distinguish the channels from the
"normal" surround channels, which libav calls AV_CH_SIDE* anyway. Maybe
those should be renamed to AV_CH_SIDE_REAR*?
We should introduce generic AV_CH_SURROUND_(RIGHT|LEFT). The reason is
simple: AC3/MLP/LPCM surround decode their "surround" channels to
AV_CH_SIDE_* (or AV_CH_BACK_CENTER if there is only one surround
channel). The dca decoder does so, too, but I am not sure what will
happen if an extension track decides to explicitly use the side channels
- according to the spec those are different from the core surround
channels, which are located at around the AV_CH_SURROUND_DIRECT*
location. Having a generic "surround" target channel for 5.1 might help
to avoid channel misordering during transcoding.
To summarize the problem: AC3 & Co order channels along the sides
Surround -> Surround Direct -> Rear (from front to back), while DTS
orders them Side -> Surround -> Rear.
WARNING: A wall of TL;DR follows for those who might be interested.
A CEA standard defines a large set of speakers for audio transmission
over HDMI, which looks like this:
+---+ +---+ +---+
|FLH| |FCH| |FRH| "High" speakers
+---+ +---+ +---+
+---+ +---+ +---+ +---+ +---+ +---+ +---+
|FLW| |FL | |FLC| |FC | |FRC| |FR | |FRW|
+---+ +---+ +---+ +---+ +---+ +---+ +---+
+---+
|LFE|
+---+ +---+
|TC | "High" speaker
+---+
+---+ +---+ +---+ +---+ +---+
|RL | |RLC| |RC | |RRC| |RR |
+---+ +---+ +---+ +---+ +---+
and gives them the names Front Left High, Front Center High, Front Right
High, Front Left Wide, Front Left, Front Left (of) Center, Front Center,
Front Right (of) Center, Front Right, Front Right Wide, Low Frequency
Effect, Top Center, Rear Left, Rear Left (of) Center, Rear Center, Rear
Right (of) Center and Rear Right.
The Digital Cinema specification, which is also referenced from the
Blu-ray Disc Specification, Specifies this speaker layout:
+---+ +---+ +---+
|Vhl| |Vhc| |Vhr| "High" speakers
+---+ +---+ +---+
+---+ +---+ +---+ +---+ +---+ +---+ +---+
|Lw | | L | |Lc | | C | |Rc | | R | |Rw |
+---+ +---+ +---+ +---+ +---+ +---+ +---+
+----+ +----+
|LFE1] |LFE2|
+---+ +----++---++----+ +---+
|Ls | |Ts | |Rs |
+---+ +---+ +---+
+---+ +---+
|Lsd| |Rsd|
+---+ +---+ +---+ +---+ +---+
|Rls| |Cs | |Rrs|
+---+ +---+ +---+
The names of these channels are Vertical height left, Vertical height
center, Vertical height right, Left wide, Left, Left center, Center,
Right Center, Right, Right wide, Low Frequency Effect (and Low Frequency
Effect 2), Left surround, Top Center Surround, Right Surround, Left
surround direct, Right surround direct, Rear left surround, Center
surround, Rear right surround.
The Ls and Lr channels are meant to drive a "diffuse array" of
speakers, while the surround direct speakers are meant to pinpoint a
position to the side.
DTS with extension adds even more speakers, and new names:
+---+ +---+ +---+
|Lh | |Ch | |Rh | "High" speakers
+---+ +---+ +---+
+---+ +---+ +---+ +---+ +---+ +---+ +---+
|Lw | | L | |Lc | | C | |Rc | | R | |Rw |
+---+ +---+ +---+ +---+ +---+ +---+ +---+
+----+ +----+
|LFE1] |LFE2|
+---+ +---+ +----++---++----+ +---+ +---+
|Lhs| |Lss| |Oh | |Rss| |Rhs| Lhs/Rhs "High"
+---+ +---+ +---+ +---+ +---+
+---+ +---+
|Ls | |Rs |
+---+ +---+ +---+ +---+ +---+
|Lsr| |Cs | |Rsr|
+---+ +---+ +---+
+---+ +---+ +---+
|Lhr| |Chr| |Rhr| "High" speakers
+---+ +---+ +---+
The names of these speakers are Left height, Center height, Right
height, Left Wide, Right Wide, Left, Left center, Center, Right center,
Right, Right wide, Low Freqency Effect 1 & 2, Left height side, Left
surround on side, Overhead, Right surround on side, Right height side,
Left surround on side in rear, Right surround on side in rear, Left
surround in rear, Center surround in rear, Right surround in rear, Left
height in rear, Center height in rear, Right height in rear.
DTS introduces new "high" speakers for side and back. The Lhs and Rhs
speakers are currently not defined in libav. The bigger issue, however,
is the different (physical) location of the Ls/Rs speakers compared to
the other standards.
The very first surround systems, analog matrix coded into stereo
signals, used four speakers, Front Left / Front Center / Front Right /
Surround. The Surround channel mapped to a single rear speaker
originally, and the Digital Cinema specification says to map a single
surround channel to all available surround channels.
The next generation of "up to 5.1 channels" introduced two discrete
surround channels instead of the center and a Low Frequency Effect
channel. The stereo surround channels map to the Ls and Rs channels in
the above diagram.
I can't really be conclusive on the HDMI to Digital Cinema mappings, but
the following table should show how the speakers map to the current
AV_CH_* constants:
Constant | HDMI | Digital Cinema | DTS extension
==============================|================|==============
FRONT_LEFT | FL | L | L
FRONT_RIGHT | FR | R | R
FRONT_CENTER | FC | C | C
LOW_FREQUENCY | LFE | LFE | LFE
BACK_LEFT | (RLC) | Rls | Lsr
BACK_RIGHT | (RRC) | Rrs | Rsr
FRONT_LEFT_OF_CENTER | FLC | Lc | Lc
FRONT_RIGHT_OF_CENTER | FRC | Rc | Rc
BACK_CENTER | RC | Cs | Cs
SIDE_LEFT | (RL) | Ls | Lss
SIDE_RIGHT | (RR) | Rs | Rss
TOP_CENTER | TC | Ts | Oh
TOP_FRONT_LEFT | FLH | Vhl | Lh
TOP_FRONT_CENTER | FCH | Vhc | Ch
TOP_FRONT_RIGHT | FRH | Vhr | Rh
TOP_BACK_LEFT | | | Chr
TOP_BACK_CENTER | | | Lhr
TOP_BACK_RIGHT | | | Rhr
STEREO_LEFT | | |
STEREO_RIGHT | | |
WIDE_LEFT | FLW | Lw | Lw
WIDE_RIGHT | FRW | Rw | Rw
SURROUND_DIRECT_LEFT | | Lsd | Ls
SURROUND_DIRECT_RIGHT | | Rsd | Rs
Digital Cinema is lacking a mapping for LFE 2, DTS lacks mappings for
LFE 2, LHs and Rhs.
HDMI names in brackets are guessed mappings. There is no specification.
DTS core mapping currently is Ls/Rs to SIDE_LEFT and SIDE_RIGHT.
According to the Digital Cinema specification, The following channels
should be used for N channel input:
Constant | 1 | 2 | 4 | 6 | 7 | 8 | 9 channels
==========================================================
FRONT_LEFT | | X | X | X | X | X | X
FRONT_RIGHT | | X | X | X | X | X | X
FRONT_CENTER | X | | X | X | X | X | X
LOW_FREQUENCY | | | | X | X | X | X
BACK_LEFT | | | | | | |
BACK_RIGHT | | | | | | |
FRONT_LEFT_OF_CENTER | | | | | | X | X
FRONT_RIGHT_OF_CENTER | | | | | | X | X
BACK_CENTER | | | X | | X | | X Note 1
SIDE_LEFT | | | | X | X | X | X
SIDE_RIGHT | | | | X | X | X | X
[unused channels removed]
The Blu-ray specification on the other hand states the following use
(referring to the Digital Cinema specification for channel names), and
using a naming scheme of front/surround(+lfe) for LPCM:
Constant |mono|stereo|3/0|2/1|3/1|2/2|3/2|3/2.1|3/4|3/4.1
======================================================================
FRONT_LEFT | | X | X | X | X | X | X | X | X | X
FRONT_RIGHT | | X | X | X | X | X | X | X | X | X
FRONT_CENTER | X | | X | | X | | X | X | X | X
LOW_FREQUENCY | | | | | | | | X | | X
BACK_LEFT | | | | | | | | | X | X
BACK_RIGHT | | | | | | | | | X | X
FRONT_LEFT_OF_CENTER | | | | | | | | | |
FRONT_RIGHT_OF_CENTER | | | | | | | | | |
BACK_CENTER | | | | X | X | | | | | Note 1
SIDE_LEFT | | | | | | X | X | X | X | X
SIDE_RIGHT | | | | | | X | X | X | X | X
[unused channels removed]
The Blu-ray specification further states that the an ac3 (core) stream
uses the same channels as mono to 3/2.1 from above, a Dolby Digital Plus
or MLP stream can use any of the Digital Cinema specification specified
channels.
Note 1: BACK_CENTER should be played at all surround speakers in 2/1 and
3/1 channel operation
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel