The bit stream information follows the five bytes of sync information. The fields are packed bit by bit, and later ones appear only when earlier ones call for them.
Fields
| Width in bits | Name | Present when | Meaning |
|---|---|---|---|
| 5 | bsid | always | stream identification |
| 3 | bsmod | always | service type |
| 3 | acmod | always | channel layout |
| 2 | cmixlev | three front channels: acmod is odd and not 1 | centre mix level |
| 2 | surmixlev | a surround channel: acmod is 4 or more | surround mix level |
| 2 | dsurmod | acmod is 2 | Dolby Surround mode |
| 1 | lfeon | always | 1 means the low-frequency effects channel is present |
| 5 | dialnorm | always | average dialogue level below full scale: 1 to 31 means −1 to −31 dB; 0 is reserved and read as −31 dB. It must set the playback level, in the decoder or the volume control (see decoding) |
| 1 + 8 | compre, compr | compr only if compre is 1 | heavy compression gain word for one frame: a signed value X (bits 7–4) and an unsigned value Y (bits 3–0); the gain is 2X+1 × (16 + Y) / 32 |
| 1 + 8 | langcode, langcod | langcod only if langcode is 1 | reserved. It once gave the language through a table; the language now travels in the container (an ISO 639-2 code), so the meaning was withdrawn |
| 1 + 5 + 2 | audprodie, mixlevel, roomtyp | the last two only if audprodie is 1 | audio production information |
| as above | dialnorm2, compr2e, compr2, langcod2e, langcod2, audprodi2e, mixlevel2, roomtyp2 | only if acmod is 0 (dual mono) | the same fields for the second channel |
| 1 | copyrightb | always | 1 means copyright is claimed |
| 1 | origbs | always | 1 means the stream is an original, 0 a copy |
| 1 + 14 | timecod1e, timecod1 | timecod1 only if timecod1e is 1; replaced when bsid is 6 | timecode, first part |
| 1 + 14 | timecod2e, timecod2 | as above | timecode, second part |
| 1 + 6 | addbsie, addbsil | addbsil only if addbsie is 1 | additional bit stream information follows; its length in bytes is addbsil + 1 |
| (addbsil + 1) × 8 | addbsi | as above | reserved for future use; ignored by decoders that do not know it |
bsid: stream identification
| bsid | Meaning |
|---|---|
| 0 to 7 | versions of AC-3 that a version 8 decoder can play; 6 is the Annex D alternate syntax |
| 8 | AC-3 as specified, the usual value |
| 9, 10 | not defined by TS 102 366: AC-3 and E-AC-3 decoders must mute. Some decoders, FFmpeg’s among them, read these frames as the AC-3 syntax at half (9) or a quarter (10) of the sample rate |
| 11 to 15 | versions of Enhanced AC-3 that a version 16 decoder can play |
| 16 | Enhanced AC-3 |
| 17 to 31 | future versions that current decoders cannot play: mute |
An AC-3 decoder plays bsid 0 to 8 and mutes above 8; an Enhanced AC-3
decoder plays 0 to 8 and 11 to 16. The bsid sits in bits 40–44 of the frame
in both syntaxes, so a parser can read it before knowing which layout it has.
bsmod: service type
| bsmod | Service |
|---|---|
| 0 | main audio: complete main |
| 1 | main audio: music and effects |
| 2 | associated: visually impaired |
| 3 | associated: hearing impaired |
| 4 | associated: dialogue |
| 5 | associated: commentary |
| 6 | associated: emergency |
| 7 | associated: voice-over (VO) when acmod is 1; main audio: karaoke when acmod is 2 to 7; not defined with dual mono |
Values 0 to 6 apply with any acmod.
acmod: channel layouts
| acmod | Name | Channels | Order in the stream |
|---|---|---|---|
| 0 | 1+1 (dual mono) | 2 | channel 1, channel 2 (independent programmes) |
| 1 | 1/0 | 1 | C |
| 2 | 2/0 | 2 | L, R |
| 3 | 3/0 | 3 | L, C, R |
| 4 | 2/1 | 3 | L, R, S |
| 5 | 3/1 | 4 | L, C, R, S |
| 6 | 2/2 | 4 | L, R, SL, SR |
| 7 | 3/2 | 5 | L, C, R, SL, SR |
The low-frequency effects channel, if lfeon is 1, is added to the count and
comes last.
cmixlev: centre mix level
| cmixlev | Level |
|---|---|
| 0 | 0.707 (−3 dB) |
| 1 | 0.595 (−4.5 dB) |
| 2 | 0.500 (−6 dB) |
| 3 | reserved |
surmixlev: surround mix level
| surmixlev | Level |
|---|---|
| 0 | 0.707 (−3 dB) |
| 1 | 0.500 (−6 dB) |
| 2 | 0, the surround channels are left out |
| 3 | reserved |
dsurmod: Dolby Surround mode
| dsurmod | Meaning |
|---|---|
| 0 | not indicated |
| 1 | not Dolby Surround encoded |
| 2 | Dolby Surround encoded |
| 3 | reserved |
Audio production information
mixlevel: the peak mixing level of the original production, as 80 +
mixlevel dB SPL. roomtyp:
| roomtyp | Mixing room |
|---|---|
| 0 | not indicated |
| 1 | large room, X curve monitor |
| 2 | small room, flat monitor |
| 3 | reserved |
Timecodes
| Field | Bits | Meaning |
|---|---|---|
timecod1 | 5 | hours, 0 to 23 |
| 6 | minutes, 0 to 59 | |
| 3 | seconds, in 8-second steps | |
timecod2 | 3 | seconds, added to the above, 0 to 7 |
| 5 | frames of 1/30 s, 0 to 29 | |
| 6 | fractions of a frame, in 64ths |
Together the halves make a 28-bit time code to 1/64 of a 1/30 s frame. Either half may
be sent alone (timecod1e, timecod2e). They do not affect
decoding, and the fields were never used for their first purpose; with
bsid 6 the same bits carry the Annex D fields instead.
Annex D alternate syntax (bsid 6)
When bsid is 6, the 30 bits of the two time code fields are redefined
(Annex D of TS 102 366). Decoders that do not know the alternate syntax read them as
time codes, which do not affect decoding, so the stream still plays everywhere; the
encoder must still give valid cmixlev and surmixlev values
for them. A decoder that knows it should let the listener choose Lt/Rt, Lo/Ro or the
preferred downmix, and then use the matching mix levels.
| Width in bits | Name | Present when | Meaning |
|---|---|---|---|
| 1 | xbsi1e | always | 1 means the next five fields (14 bits) follow |
| 2 | dmixmod | xbsi1e | preferred stereo downmix: 0 not indicated, 1 Lt/Rt, 2 Lo/Ro, 3 reserved (read as not indicated). Defined only for 3/0, 2/1, 3/1, 2/2 and 3/2 |
| 3 | ltrtcmixlev | xbsi1e | Lt/Rt centre mix level, below (with three front channels) |
| 3 | ltrtsurmixlev | xbsi1e | Lt/Rt surround mix level (with surround channels) |
| 3 | lorocmixlev | xbsi1e | Lo/Ro centre mix level |
| 3 | lorosurmixlev | xbsi1e | Lo/Ro surround mix level |
| 1 | xbsi2e | always | 1 means the next five fields (14 bits) follow |
| 2 | dsurexmod | xbsi2e | 0 not indicated; 1 not Dolby Surround EX, Pro Logic IIx or IIz encoded; 2 Dolby Surround EX or Pro Logic IIx encoded; 3 Dolby Pro Logic IIz encoded. Defined only for 2/2 and 3/2 |
| 2 | dheadphonmod | xbsi2e | 0 not indicated, 1 not Dolby Headphone encoded, 2 Dolby Headphone encoded, 3 reserved (read as not indicated). Defined only for 2/0 |
| 1 | adconvtyp | xbsi2e | A/D converter: 0 standard (also when unknown), 1 HDCD |
| 8 | xbsi2 | xbsi2e | reserved; encoders set it to zero |
| 1 | encinfo | xbsi2e | for the encoder’s own use; decoders ignore it |
The mix-level codes (Tables D.1.2 to D.1.5, also used by Enhanced AC-3):
| Code | ltrtcmixlev, lorocmixlev | ltrtsurmixlev, lorosurmixlev |
|---|---|---|
| 0 | 1.414 (+3 dB) | reserved: 0.841 is used |
| 1 | 1.189 (+1.5 dB) | reserved: 0.841 is used |
| 2 | 1.000 (0 dB) | reserved: 0.841 is used |
| 3 | 0.841 (−1.5 dB) | 0.841 (−1.5 dB) |
| 4 | 0.707 (−3 dB) | 0.707 (−3 dB) |
| 5 | 0.595 (−4.5 dB) | 0.595 (−4.5 dB) |
| 6 | 0.500 (−6 dB) | 0.500 (−6 dB) |
| 7 | 0 (−∞ dB) | 0 (−∞ dB) |
The encoder’s overload protection must allow for every downmix a decoder might use, not only the preferred one.
Karaoke (Annex C)
A stream with bsmod 7 and acmod 2 or more is in karaoke mode,
and its channels take other roles: L and R (for example the backing music), M (a guide
melody) and V1, V2 (one or two vocals).
| acmod | Normal | Karaoke |
|---|---|---|
| 2/0 | L, R | L, R |
| 3/0 | L, C, R | L, M, R |
| 2/1 | L, R, S | L, R, V1 |
| 3/1 | L, C, R, S | L, M, R, V1 |
| 2/2 | L, R, Ls, Rs | L, R, V1, V2 |
| 3/2 | L, C, R, Ls, Rs | L, M, R, V1, V2 |
A karaoke-aware decoder plays L and R, M at the cmixlev level and the
vocals at the surmixlev level, mixing them as
Lk = L + a·V1 + b·V2 + c·M, Ck = d·V1 + e·V2 + f·M, Rk = R + g·V1 + h·V2 + i·M
(then scaled to avoid overload):
| Output | a | b | c | d | e | f | g | h | i |
|---|---|---|---|---|---|---|---|---|---|
| 2/0, one vocal | 0.7 slev | – | clev | – | – | – | 0.7 slev | – | clev |
| 2/0, two vocals | slev | 0 | clev | – | – | – | 0 | slev | clev |
| 3/0, one vocal | 0 | – | 0 | slev | – | 1 | 0 | – | 0 |
| 3/0, two vocals | slev | 0 | 0 | 0 | 0 | 1 | 0 | slev | 0 |
A karaoke-capable decoder lets the listener play neither, one or both vocals; its defaults are, for 2/0 output: none (a, b, g, h all 0), V1 (a = g = 0.7), V2 (b = h = 0.7), both (a = h = 1); c = i = clev throughout. For 3/0 output: f = 1 throughout; none has no vocals, V1 puts V1 in the centre (d = 1), V2 likewise (e = 1), both puts V1 left and V2 right (a = h = 1). Further controls are left to the product.