Options & grammars¶
Encoding commands in Commands take these after their positional arguments, in any
order. Not every command honors every option, though the parser accepts them anywhere: silence
takes none at all; record and live mode=channels build a real encoder plan, so they honor the
whole metadata group below (drc=, heavy, dialnorm=<n>, cmixlev=/surmixlev= — which is
also what their §7.8 fold-down uses — mixmeta, lfemix=, dmixmod=) alongside fast-mdct=off,
container=/fmp4-window=, layout=, codec=, watchdog= and, live only, capture2=,
objects=, map= and downmix=. dialnorm=auto is the one they refuse: it measures a whole
programme before encoding it, and a live capture has not got one yet. live mode=atmos encodes
the fixed TS 103 420 shape, so it takes dialnorm=<n> and fast-mdct=off from the group and
nothing else. atmos, atmos-path and atmos-encode all apply dialnorm=<n>, fast-mdct=off,
joc-domain=
and the object-signing flags below, and dialnorm=auto is silently inert on atmos/atmos-path
— of those three, only atmos-encode measures, and not when src=/map= are in play
(an assembled object set has no single fixed layout to measure a whole-programme loudness
against). The two ingest commands atmos-adm and atmos-iab build the same AtmosEncoder
config, so they take dialnorm=<n>, fast-mdct=off, joc-domain= and numblkscod= as well, but
not the object-signing flags. With codec=ac4 the three object commands write AC-4 instead and read
coding=, dialnorm=<1..31> and, on atmos-encode, crc=; AC-4's options have their own section,
AC-4 options, below. Every command honors quiet, verbose and --help:
metadata options (any order, after the positional arguments):
drc=<profile> §7.7.1 dynamic range control per block
film-standard | film-light | music-standard | music-light | speech
heavy §7.7.2 heavy compression: a peak ceiling in the
mono downmix, at syncframe resolution
ceiling=<dBFS> that ceiling (default -0.5)
dialogue=<dBFS> where heavy compression puts dialogue (default -20)
drc2=<profile> Ch2's own DRC profile, layout 1+1 only (§7.7.1) - not
inherited from drc=, set both to compress both programmes alike
heavy2 Ch2's own heavy compression, layout 1+1 only (§7.7.2.2)
ceiling2=<dBFS> that ceiling for Ch2 (default -0.5)
dialogue2=<dBFS> where Ch2's heavy compression puts dialogue (default -20)
dialnorm=auto measure BS.1770 loudness and derive dialnorm (§5.4.2.8)
dialnorm=<1..31> set it directly (default 31)
dialnorm2=auto | <1..31> Ch2's own dialnorm, layout 1+1 only (§5.4.2.16, default 31)
cmixlev=-3|-4.5|-6 centre downmix level (Table 5.9)
surmixlev=-3|-6|off surround downmix level (Table 5.10)
mixmeta E-AC-3 only: emit the mixmdate group (Table E1.2)
lfemix=<0..31>|off E-AC-3 LFE mix level, 10-code dB (§E2.3.1.11)
dmixmod=ltrt|loro|none preferred stereo downmix (Table D2.2)
ltrtcmixlev=<dB> Lt/Rt centre level, Table D2.3: +3|+1.5|0|-1.5|-3|-4.5|-6|off
lorocmixlev=<dB> Lo/Ro centre level, Table D2.5 (same eight values)
ltrtsurmixlev=<dB> Lt/Rt surround level, Table D2.4: -1.5|-3|-4.5|-6|off
(the three louder codes are reserved)
lorosurmixlev=<dB> Lo/Ro surround level, Table D2.6 (same five)
annexd AC-3 only: emit bsid 6, spending the two 14-bit timecod
fields on Annex D's xbsi1/xbsi2 instead (§D1)
dsurexmod=none|off|ex|pliiz Dolby Surround EX (Table D2.7)
dheadphonmod=none|off|on Dolby Headphone (Table D2.8)
adconvtyp=standard|hdcd A/D converter type (Table D2.9)
encinfo AC-3 Annex D: set the encoder's own reserved bit (§D2.3.1.12)
infomdat E-AC-3 only: emit the infomdat group (Table E1.2)
bsmod=<service> type of service, Table 5.7: cm | me | vi | hi | dialogue |
commentary | emergency | voiceover (or 0..7)
dsurmod=none|off|on Dolby Surround, 2/0 only (Table 5.11)
mixlevel=<dB SPL> peak mixing level, 80..111 (§5.4.2.14)
roomtyp=none|large|small mixing room (Table 5.12)
mixlevel2= / roomtyp2= Ch2's own pair, layout 1+1 only (§5.4.2.22/23)
langcod / langcod2 emit the reserved 0xFF language byte (§5.4.2.12); AC-3 only
copyright set copyrightb (§5.4.2.24; default clear)
origbs=on|off original bit stream vs. a copy (§5.4.2.25; default on)
sourcefscod E-AC-3: source sampled at twice fscod's rate (§E2.3.1.63)
timecode=HH:MM:SS[:FF[.N]] AC-3 bsid 8 only (§5.4.2.26-28)
pgmscl=<dB>|mute E-AC-3 programme scale factor, -50..+12 dB (§E2.3.1.13)
pgmscl2=<dB>|mute Ch2's own, layout 1+1 only (§E2.3.1.15)
extpgmscl=<dB>|mute the external programme's (§E2.3.1.17)
mixdef=none|premix|reserved|ext mixing-parameter block (Table E2.6)
premixcmp=<sel>:<src>:<scale> dynrng|compr : external|local : 0..7
(§E2.3.1.19-21)
mixdata=<0..4095> the twelve bits mixdef=reserved reserves (§E2.3.1.23)
extmix=<L>,<C>,<R>,<Ls>,<Rs>,<LFE>[,<dmix>] mixdef=ext external channel
scale codes 0..15 (Table E2.8), 'off' for a channel the
external programme lacks
auxmix=<a1>,<a2> mixdef=ext auxiliary channel scales, same codes
speechmix=<d>[,<d1>:<att1>[,<d2>:<att2>]] mixdef=ext speech enhancement
data (§E2.3.1.44-51)
paninfo=<0..239>[:<0..63>] E-AC-3 pan position, 1.5 degree steps
clockwise from centre, mono/1+1 only (§E2.3.1.53-58)
paninfo2= Ch2's own, layout 1+1 only
blkmixcfg=<b0,..,b5> E-AC-3 per-block mixing configuration, six 0..31
words or '-' for a block that sends none (§E2.3.1.59-61)
couple enable channel coupling - honored by 'encode' and 'sine' ('sine' can also
spell it as a 'c' layout suffix); E-AC-3 coupling is the tools argument's
cpl token instead
strict decode: exit 2, after writing what could be decoded, when any frame or unit was
lost after the first one decoded (an AC-4 frame waiting for an I-frame, a
concealed frame or unit, a TrueHD unit a lenient decode dropped); the frames
that wait before the first one decodes are not a loss. Without it such a decode
exits 0 and warns, as it always has
keep-partial encode/eac3-encode/atmos-encode/atmos-cbi: if the run fails partway, keep
whatever frames were already encoded (named beside the intended output as
<name>.partial.<ext>) instead of discarding them - off by default, matching
the GUI's own keep-partial-output setting
fast-mdct=off force the direct §8.2.3.2 forward MDCT instead of the default §7.9.4 fast
path (coefficients within ~3e-12 max relative error of the direct form, so
a stream differs only where that tips a quantisation decision; the direct
form is the validation oracle) - applies wherever this command
encodes, incl. atmos/record/live/eac3-sine/eac3-encode, and wherever
decode/monitor/live reconstruct JOC objects under joc-domain=mdct;
eac3-encode's [tools] positional can also reach this field via a bare
nofastmdct token, which wins if both are given; bare fast-mdct (the old
opt-in) is a no-op
fast-imdct=off decode: force the direct §7.9.4 step-3 inverse instead of the default
radix-4 FFT evaluation - the decode-side mirror of fast-mdct=off above,
with the same relationship to its oracle (both codecs; bare fast-imdct,
the old opt-in, is a no-op)
search=<what> AC-3 encode (encode/sine) and E-AC-3 encode (eac3-encode/eac3-sine): choose
§7.2.2's transmitted bit allocation parameters per frame, from the error a
decoder will reconstruct, instead of taking the rate-derived defaults.
distortion minimises that error; perceptual weights it by a tonality/masking
model first. off (the default) keeps the fixed values every release before
this emitted. E-AC-3 narrows it: CBR only (silently inert under vbr=),
distortion only (perceptual parses and does nothing), AHT streams excluded
from the measurement, and the candidates are dbpbcod - kAllocCodes' 3
against Table E1.4's 2 - crossed with Table 7.11's rate-adaptive fgaincod,
which unlike AC-3's is not free (it opens the per-block fgaincode element)
and so is scored after a refit rather than assumed. Costs encode time - see
docs/library/quality.md for the measured figures
mode=reference both switches above in one word: every transform this command runs falls
back to the spec's own direct evaluation. mode=performance (the default
state) names the fast paths. Tokens apply in order, so a later
fast-mdct=off / fast-imdct=off still adjusts one half on its own
joc-domain=mdct atmos*/decode: estimate and apply the JOC reconstruction matrix over 256
MDCT bins instead of the default §7.1 64-band complex QMF - cheaper, ~5 dB
worse per object, and not the domain a licensed decoder reconstructs in.
Not part of mode= in either direction (=qmf names the default)
dither=off pin §7.3.4 dithflag at 0 instead of deciding it per channel per block from
content - the same reach as fast-mdct=off (encode/sine and the
atmos/record/live session builders); eac3-encode's [tools] positional can
also reach this field via a bare nodither token. Real dither values are
decoder-defined (the spec's own "any reasonably random sequence"), so this
is for a run that needs bit-for-bit agreement between two decoders of the
same stream more than it needs dither's own perceptual benefit -
tools/checks/verify_gold_reference.sh is the one caller that does
delta=off skip §7.2.2.6 delta bit allocation wherever this command encodes.
For eac3-encode, the equivalent spelling inside the fourth positional
[tools] argument is nodelta; it is not a tools=nodelta key/value option
fgaincod=<code> pin §7.2.2.4's fast gain (Table 7.11) for the whole encode instead of
letting the encoder choose it - auto (the default) or 0..7, where a higher
code leaks more of the fast masking curve. auto is each codec's own
behaviour and they differ: AC-3 follows a measured rate curve, because
fgaincod rides an element it already sends every block; E-AC-3 leaves
Table E1.4's implied 0x4 and writes nothing, because there any other code
opens a per-block fgaincode element in all six blocks (1 + 3*(nchans +
cplinu) bits each). Pinning it on eac3-encode pays that cost and takes the
code out of search='s candidate set
numblkscod=<N> atmos* encode: 0-3 (default 3), the short syncframes of §E2.3.1.4 - see
the tools token below, whose numblkscod:N this is for the commands that
have no [tools] positional
bed-only decode: render an Atmos stream's 5.1 bed and skip §6 JOC object
reconstruction. The bed is bit-identical either way - this is a memory
option, not a quality one: reconstruction needs an
oba::joc::ReconstructionState (147,504 bytes in one block) plus a QMF
pair, ~233 KB together, which does not fit on every target the library
builds for (see docs/platforms/bare-metal/esp32-s3.md). Harmless on a
stream with no object layer
sign-objects atmos/atmos-path/atmos-encode/atmos-cbi: write a keyed EMDF object
signature (needs signing-key=); metadata on a TrueHD stream: sign its
evolution frames (iclforge's own tag, not Dolby's); see
docs/concepts/object-signing.md
verify-objects decode/monitor (and decode of TrueHD): check each frame's object signature against
signing-key= instead of just playing it - a mismatch refuses the command;
omitted (the default) decodes signed and unsigned streams alike, unchecked
gate-objects decode/monitor/spatial: the licensed policy - frames whose object
signature verifies against signing-key= play as objects, any other
(unsigned, another key's, altered) plays as its 5.1 bed and the decode
carries on, where verify-objects would refuse. Not combinable with
verify-objects
signing-key=<path> the key file sign-objects/verify-objects/gate-objects use (or
ICLFORGE_SIGNING_KEY_FILE / ICLFORGE_SIGNING_KEY). Repeat it to give
verify-objects and gate-objects several keys - a frame is good under any
of them; sign-objects takes one
sign-content ac4-encode/atmos-encode/atmos-adm/atmos-iab (codec=ac4): sign the AC-4 file
once it is written, with content-key= and content-chain=; see
docs/library/signing.md
verify-content decode/ac4-verify: refuse unless the AC-4 content signature, its chain
and a trust anchor or pin all check, and the signer information is as CS
spec v2.6 section 5.3 asks: a 128 byte nonce, a publisher UUID that is
there, and one of the expect-publisher-uuid= accounts if any are given
check-content decode/ac4-verify: print what the content-signature checks find and carry
on, judging the certificates at the signed date unless verify-time=
says otherwise. Not combinable with verify-content
unanchored-ok with verify-content: accept a signature that checks out against a chain
no trust-anchor= or pin= vouches for (still reported as unanchored)
content-key=<path> the operator's P-256 private key, PEM or DER (or
ICLFORGE_CONTENT_KEY_FILE / ICLFORGE_CONTENT_KEY)
content-chain=<path> the certificates for that key, a bundle; repeat for more (or
ICLFORGE_CONTENT_CHAIN_FILE)
trust-anchor=<path> a certificate to trust as the top of the chain; repeat for more
trust-key=<path> a P-256 public key (PEM "PUBLIC KEY" or DER) to trust to sign; a chain whose
signing certificate carries it is anchored; repeat for more
pin=<hex> a certificate by SHA-1 (40 hex) or SHA-256 (64 hex) fingerprint, trusted
wherever it appears in the chain; repeat for more
leaf-title=<text|any> the title the signing certificate must carry (default
Code/Content Signer)
signed-date=<YYYY-MM-DDTHH:MM:SS> the date a new signature records, UTC (default now,
which is what CS spec v2.6 section 5.3 asks for; another date is warned about)
publisher-uuid=<UUID> ac4-sign/sign-content: the UUID of your publisher account, written as
the signature's publisherUUID; it is not in the signing certificate and is not
compared with it. Without it a warning, and verify-content refuses the
signature
expect-publisher-uuid=<UUID> ac4-verify/decode: a publisher account to accept; repeat for
more. A signature naming another is a finding in ac4-verify and a refusal
with verify-content; without it the UUID is only reported
publisher-name=<text> your legal or trade name
product-id=<n> your product identifier, a whole number (default 0)
product-name=<text>, wrapper-name=<text> the product and, if one is used, the PACE wrapper
os-name=<text>, os-version=<text>, os-description=<text> the operating system of the
signing host; informational, and bound by the signature
verify-time=now|signed|ignore|<YYYY-MM-DDTHH:MM:SS> when every certificate must be valid:
now by default (ac4-verify, verify-content), the signed date for
check-content
verify eac3-encode: decode every access unit as it is encoded and diff the
decoder's model against the encoder's own, refusing the run at the first
disagreement - off by default, since it roughly doubles the work
bap-census=<path> decode (AC-3 and E-AC-3): write a JSON census of the decode, per coded
stream, of how many (block, bin) pairs the allocator gave zero bits - the
evidence tools/checks/compare_wav.py's masked comparison rests on; a
verification aid, refused for AC-4 and by every other command
qc options (qc; any order, after the positional arguments):
preset=<name> gate the measurement against a named delivery spec
ebu-r128-s2 | atsc-a85 | atsc-a85-streaming | netflix | apple-music-atmos
preset=all gate against every preset above
omitted: measure and report only, no gate
layout=bed the default - meter the independent substream's own
Table 5.8 bed (BS.1770 Annex 1's basic algorithm)
layout=rendered meter the whole assembled program instead, every
dependent substream's height/wide/rear channels
included (BS.1770-5 Annex 3's extended algorithm)
objects=<layout> re-render dynamic objects by their own OAMD position
onto <layout> (71|512|514|714) and meter that too
(BS.1770-5 Annex 4); dynamic-object-only programmes
only
For decode, drc=<scale> instead applies §7.7.1 partial compression (0 = ignore, 1 = as
encoded), and bare heavy prefers compr where the stream carries it, applying the word's own
gain and nothing more (drcmode=rf adds RF mode's 11 dB with each word) — the decode-time
meaning of these two tokens is deliberately the mirror of their encode-time meaning. On the
encode side, ceiling= and dialogue= are levels at the output of an RF-mode decode, which
normalises dialnorm and adds those 11 dB itself, so the default dialogue=-20 asks the word
for no make-up. Both apply to
E-AC-3 decode too, matching the legacy AC-3 decoder — .ec3 input no longer accepts and silently
ignores them. fast-imdct=off and mode= select the inverse transform's evaluation and apply to
both codecs' decode alike. monitor and spatial take the same four: all three commands build
one iclforge::ac3::DecoderConfig from these options and hand it to the same decoder. AC-4 has neither
drc= nor heavy: its decoder takes an output-level= and its own drcmode= names (see
AC-4 options), and decode given drc= or heavy with an AC-4 stream names
them in a warning and ignores them.
See Metadata for what each of these fields actually is at the library
level (dynrng, compr, dialnorm, downmix levels) — the CLI tokens above map directly onto
that page's config fields.
Bit stream information: annexd, infomdat and the service fields¶
Everything in this group is metadata a receiver reads about the programme; none of it changes an output sample. What it decides is whether that receiver can tell a complete main programme from an audio-description track, whether a stereo pair is a Dolby Surround matrix, and what acoustic level the mix was judged at.
The two gate tokens exist because the two formats carry the group differently:
annexd(AC-3 only) writesbsid6. AC-3's two 14-bittimecodfields have never been applied for their originally anticipated purpose (§D1), so Annex D spends them onxbsi1(dmixmodplus separate Lt/Rt and Lo/Ro centre and surround levels) andxbsi2(dsurexmod,dheadphonmod,adconvtyp). It is implied bydmixmod=, by any of the four level tokens, and by the threexbsi2tokens — soforge encode in.wav out.ac3 384 51 dmixmod=ltrtwrites absid-6 stream without being asked twice.timecode=andannexdare refused together: they are the same 28 bits.dmixmod=offers Table D2.2's three defined codes; its reserved11has no token, and the library will not write it.infomdat(E-AC-3 only) opens Table E1.2'sinfomdatelement. It is implied by every informational token —bsmod=,dsurmod=,dsurexmod=,dheadphonmod=,adconvtyp=,mixlevel=,roomtyp=,copyright,origbs=,sourcefscod. AC-3 needs no such gate: those fields are unconditional in its own bsi.
Fields the layout has no room for are simply not written, per the syntax: dsurmod and
dheadphonmod exist only at 2/0, dsurexmod only at 2/2 and 3/2, mixlevel2/roomtyp2/
paninfo2/pgmscl2 only at 1+1. Setting one anyway is not an error — it just does not reach the
wire, which is what lets one set of options describe a programme at any layout.
langcod is a presence flag rather than a value: §5.4.2.12 makes the byte a reserved 0xFF, the
language table it once indexed having been dropped in favour of the signalling layer's own
ISO 639-2 code.
forge encode in.wav out.ac3 384 51 bsmod=vi mixlevel=105 roomtyp=large copyright dmixmod=ltrt ltrtcmixlev=-1.5 dsurexmod=ex adconvtyp=hdcd
That is an AC-3 visually-impaired associated service, mixed at 105 dB SPL in a large X-curve
room, copyright asserted, preferring an Lt/Rt downmix with the centre 1.5 dB down in it, flagged
as Surround EX and captured through an HDCD converter — bsid 6, because the last three of those
have nowhere else to go.
Programme mixing (E-AC-3): pgmscl, mixdef, paninfo, blkmixcfg¶
The mixmeta group's five downmix levels say how to fold this programme down. The tokens above
say how to combine it with a second one — the audio-description or commentary service a
receiver mixes against the main programme. §E2.3.1.17's "external program" is that second stream.
The whole group is written only by the independent substream, since a dependent is part of
someone else's programme and has no second one of its own to talk about.
mixdef= picks one of Table E2.6's four options and decides which of the tokens below are
written: premix sends premixcmp= alone, reserved sends mixdata='s twelve bits, and ext
sends whichever of extmix=/auxmix=/speechmix= are given inside a length-prefixed block.
Naming any of them turns mixmeta on.
forge eac3-encode in.wav out.ec3 448 none 51 pgmscl=-6 extpgmscl=+3 \
mixdef=ext premixcmp=dynrng:external:0 extmix=0,2,0,off,off,15 \
blkmixcfg=3,-,7,-,-,31 bsmod=commentary mixlevel=98 roomtyp=small
In extmix=, off means the external programme has no such channel (§E2.3.1.31's cleared
flag), which is not the same as a scale factor of 0 — that is Table E2.8's −1 dB. blkmixcfg=
takes one word per block with - for a block whose blkmixcfginfoe stays clear.
decode reports both groups back: any service, production, Surround or programme-mixing field
the stream actually carries is printed under the dynrng/compr lines. A plain complete-main
programme with none of them prints nothing extra.
The tools: token (eac3-encode)¶
Annex E coding tools, +-joined:
tools: Annex E coding tools, '+'-joined — none | cpl | spx | aht | tpn |
nofastmdct | nodither | nodelta | numblkscod:N | all
(cpl:N / spx:N pin a band edge, aht:N the gain mode, ecpl selects
enhanced coupling instead of standard, tpn selects transient
pre-noise processing)
cpl:N / spx:N pin that tool's band edge (e.g. cpl:4+spx:5);
aht:N pins the GAQ mode — aht:0 is AHT with GAQ switched off;
atten:N pins the SPX notch depth, noatten removes it;
ecpl only takes effect alongside cpl (e.g. cpl+ecpl);
nofastmdct forces the direct-form forward MDCT instead of the
default §7.9.4 fast path, nodither pins dithflag at 0 instead of
deciding it from content, and nodelta skips delta bit allocation;
these control effort rather than enabling Annex E tools, so 'none'
and 'all' leave them alone, and the older opt-in spelling
'fastmdct' still parses as a no-op;
numblkscod:N (0-3, default 3) shortens the syncframe to 1/2/3/6
blocks (5.3/10.7/16/32 ms) — every substream of the access unit
takes the same value, AHT is unavailable below 3 (Table E1.3 has
no ahte bit there — combining it with aht/auto is refused up
front, not silently dropped), and 'none'/'all' leave it alone too
The tool set is the fourth positional argument, not an = option. Example:
forge eac3-encode in.wav out.ec3 192 cpl+spx:5+aht:0 turns on coupling (auto band edge),
spectral extension pinned to band 5, and AHT with GAQ off; cpl+ecpl+tpn in the same slot turns
on enhanced coupling (auto band edge) and transient pre-noise processing together — ecpl and
tpn are independent tools, not alternatives to each other or to spx/aht, so any
combination the tools argument accepts is legal here. all does not currently imply ecpl or
tpn; name them explicitly to get either. Use nodelta in this positional argument, such as
cpl+nodelta; delta=off is the command-wide option spelling.
forge eac3-encode in.wav out.ec3 192 cpl+numblkscod:1 couples and halves the syncframe to two
blocks (10.7 ms) — useful where 32 ms of encode latency is too much (live monitoring, a
round-trip over a network link) at the cost of the bsi/audfrm header repeating three times as
often for the same audio, which comes straight out of the mantissas at a fixed bit rate.
The atmos* encode commands take the same choice as a numblkscod=N key=value option rather
than a tools token (they have no [tools] positional — the bed's coding tools are the object
encoder's own business). The object layer scales with the frame: the OAMD update's
ramp_duration covers exactly one shortened frame (Table 24 spells 1536 and 512 directly, 256
through Table 25's ramp table, and a three-block frame's 768 as the 11-bit literal), and the JOC
matrix interpolates across the frame's own QMF timeslots — four per block — instead of a fixed
24. So objects update proportionally more often, at the same header-repetition cost as above
plus a proportionally larger share of each frame spent on the OAMD/JOC container itself, which
repeats per syncframe too.
The vbr token (eac3-encode only)¶
vbr (eac3-encode only): off | q:0..1[,min:kbps][,max:kbps]
| avg:kbps[,win:frames][,min:kbps][,max:kbps] - E-AC-3 only
quality is encoder-relative, not a fixed target — bit cost rises
steeply above roughly half the range, so a high quality with no
max bound will often refuse real programme material outright;
bitrate_kbps still matters in vbr mode — it feeds the same
coupling/spx frequency defaults it always has, not a target rate
avg:kbps instead of q: is average-rate (ABR) mode: the encoder
steers the SNR offset to hold that long-run average, with a
sliding-window bit reservoir underneath it, so a quiet frame
stays cheap and a busy one may cost more. It takes no quality —
that is the knob it exists to move — so q: and avg: are refused
together. win:frames sets the window (32 frames by default,
about a second at 48 kHz); min:/max: still bound each frame.
There are two rate controls here, named by the leading token.
q: — plain VBR. forge eac3-encode in.wav out.ec3 192 none stereo q:0.4,max:320 encodes at
quality 0.4, capped at 320 kbps whenever the content would otherwise ask for more; bitrate_kbps
(192 here) still drives the coupling/spx band-edge defaults the way it always has, since VBR has
no fixed target rate to hand them. What quality 0.4 actually costs, and whether it beats CBR at
that cost, is measured in
E-AC-3 rate control: what VBR and ABR are worth.
avg: — average-rate (ABR). forge eac3-encode in.wav out.ec3 192 none stereo avg:192
delivers a stream that averages 192 kbps over the long run while each frame's size still follows
the content. The encoder holds one SNR offset across frames and steers it — up while the stream is
running under its target, down while it is over — with a sliding-window reservoir underneath as a
hard ceiling, so no window of win: frames can overrun its pooled budget.
avg: takes no quality, and passing both (q:0.5,avg:192) is refused rather than one half
silently winning: quality fixes the SNR offset, and moving that offset is the whole of what ABR
does. The stream's first frame seeds the offset from its own budget search, so there is no
starting value to supply.
win: sets the window in frames — 32 by default, about a second at 48 kHz. Shorter holds the
average more tightly but gives the reservoir less to carry between a quiet passage and the loud
one that could use its savings; longer does the opposite. min:/max: bound each individual
frame and compose with the average, but a min: above the average (or a max: below it) makes
the average unreachable by construction and is refused.
Omit vbr (or pass off) for ordinary CBR — the default. AC-3 (encode) is CBR-only because
frmsizecod indexes a fixed frame-size table; eac3-silence and eac3-sine are E-AC-3
(frmsiz) and are CBR-only simply because their argument lists have no vbr slot.
The layout grammar¶
layout: mono | stereo | 1+1 | 51 | 71 | 512 | 514 | 714
AC-3 carries only mono | stereo | 1+1 | 51 — everything wider needs the dependent
substreams that only E-AC-3 has.
71 renders 8 speakers from 10 coded channels
714 renders 12 speakers from 14 coded channels
For 'sine' and 'eac3-sine' each speaker gets its own tone; append
'c' to a 'sine' layout (stereoc, 51c) to enable channel coupling.
For 'encode' and 'eac3-encode' it names the OUTPUT layout: a
source narrower than it leaves the channels it lacks silent, and
a wider one folds down per §7.8 using cmixlev/surmixlev.
[layout] also takes a comma-separated Table E2.5 location list
instead of one of the names above, for anything Annex E allows
that has no preset: e.g. L,C,R,LFE,Vhl,Vhr or L,C,R,LFE,LFE2,Vhc.
AC-3 accepts one too, as long as it needs no dependent substream
(e.g. L,R,Cs or L,C,R,Cs - Table 5.8 modes no preset names).
Locations: L C R Ls Rs Lc Rc Lrs Rrs Cs Ts Lsd Rsd Lw Rw Vhl Vhr
Vhc Lts Rts LFE2 LFE - a paired location (Lc/Rc, Lrs/Rrs, Lsd/Rsd,
Lw/Rw, Vhl/Vhr, Lts/Rts) must be given both halves.
With no [layout], 'encode' and 'eac3-encode' follow the source: a WAV
that states which speakers its channels are (a WAVE_FORMAT_EXTENSIBLE
channel mask, which 'decode' writes from three channels up) is encoded
as exactly those - FL FR BC is 2/1, FL FR FC BC is 3/1 - and one that
states none is read by its channel count.
71 and 714 render fewer speakers than they code because, per §E3.8.2, a dependent
substream's channels replace some of the bed's rather than adding to it — see
Wide layouts for the encoder-side mechanics behind that.
1+1 is not a speaker layout at all — two independent, single-channel programmes sharing one
syncframe (§5.4.2's "1+1 dual mono") — so it's never inferred from a source's channel count the
way mono/stereo/51/etc. are; it has to be named explicitly. encode/eac3-encode take its
two channels either as one two-channel WAV (channel 0 = Ch1, channel 1 = Ch2) or as two mono WAV
files (in.wav = Ch1, the trailing in2.wav positional = Ch2) — see Commands for
both forms. dialnorm2=/drc2=/heavy2 above set Ch2's own dialnorm/DRC/heavy compression;
none of the three is inherited from Ch1's — a stream that wants both programmes treated alike sets
both explicitly. decode writes Ch1/Ch2 back out in that same order, and levels names them
Ch1/Ch2 rather than a speaker position that would not apply.
Source options (encode/eac3-encode/atmos-encode): src=, map= and offset=¶
source options (encode/eac3-encode/atmos-encode/live; any order, after the positional
arguments):
src=<path> an additional input source; repeat for more than one
map=<spec> <source>.<channel>[-<channel2>]:<dest>[@<trim>][,...] - dest is a channel
name, obj, objm, p1, p2 or none; a channel range is only legal with obj,
objm or none, and folds to one mono object with objm; trim is an optional
signed dB gain in [-24,24] on dest, e.g. L@-3.5
once given, every loaded channel must appear - explicit 'none' silences
the goes-nowhere warning without giving it anywhere to go
offset=<sourceIndex>:<seconds> leading silence ahead of that source's own channels
(seconds >= 0), same 0-based numbering as src=
the programme is still as long as the longest one once every offset is
applied
src= loads another WAV alongside in.wav (source index 0), in the order given — src=a.wav
src=b.wav makes a.wav source 1 and b.wav source 2. Every source must share in.wav's sample
rate. On live mode=atmos the "sources" are the capture devices instead: source 0 is
capture_device, source 1 is capture2= when present, and map= binds their channels to
object slots rather than to file channels (see
objects= and map=).
With exactly one source (no src= at all), map= is not needed: the existing automatic
single-source panning applies, byte-identical to a plain forge encode/eac3-encode invocation
that predates this option — omitting map= is defined to behave exactly as if src=/map= did
not exist. With more than one source, map= becomes mandatory: automatic panning has no defined
meaning across several files, so every loaded channel needs an explicit entry (or an explicit
none) before the encode will run.
Each map= entry is <source>.<channel>:<dest>, comma-separated, <channel> 0-indexed. A
channel range (<channel>-<channel2>) is only legal when <dest> is obj, objm or none —
a location or a programme names exactly one channel, so a range there would be ambiguous about
which one it means. objm folds the whole range into ONE mono object (equal-weight sum, scaled by
1/n so several full-range channels summed together don't clip past what one alone would) rather
than one object per channel the way a plain obj range does. Two entries naming the same location,
or more than one entry per dual-mono programme, is refused.
The obj/objm destinations are acted on by the two object-capable commands:
atmos-encode and live mode=atmos both assemble them. Each obj row becomes its own dynamic
object; a contiguous objm range folds to a single mono object (equal-weight sum, scaled by
1/n); the objects appear in map= order — every obj row first, in source-then-channel order,
then each objm group. atmos-encode honours src=/map= the same way encode/eac3-encode
do, so a GUI assignment is reproducible headlessly, which is the point of the two front ends
sharing one grammar (see
GUI → Multi-source & assignment). With codec=ac4 a location row
is not dropped but becomes an object held at that speaker, and an LFE row the LFE object: see
AC-4 objects from a WAV.
forge atmos-encode stems.wav out.ec3 448 src=vo.wav \
map=0.0:obj,0.1:obj@-3,0.2-3:objm,1.0:obj,1.1:none
On encode/eac3-encode they remain what they always were: those two commands have no object
layer to put an object in, so the routing skips every non-location row (also true of a stray
p1/p2 row on a target that isn't dual mono) and audio mapped onto an object destination is
discarded — not silently, though: both print a warning naming the source/channel and destination
for each row that resolves to nothing.
Any <dest> may carry an optional trailing @<trim> — a signed decibel gain in [-24, 24],
snapped to a tenth of a dB (L@-3.5, obj@2) — applied as linear gain wherever that channel's
content reaches the stream: folded into the routing matrix for a bed position or a dual-mono
programme, or, for obj/objm, into that object's own plane as it is assembled (by
atmos-encode, live mode=atmos or the GUI — see the note above). Omitted (no @) means no
trim, the same as an explicit @0.
forge eac3-encode roundtrip-stereo.wav out.ec3 384 none 51 \
src=roundtrip-51.wav \
map=0.0:C,0.1:none,1.0:L,1.1:R@-3,1.2:none,1.3:LFE,1.4:Ls,1.5:Rs \
offset=1:2.5
roundtrip-stereo.wav's left channel (source 0, channel 0) carries the centre; its right channel
is explicitly silenced. roundtrip-51.wav (source 1) fills the rest, its right channel (1.1)
trimmed 3 dB down, with its own centre channel (1.2) also sent nowhere so it doesn't collide
with the first source's. [vbr] and [in2.wav] are both skippable here even though they come
earlier in eac3-encode's own positional order — the parser lifts option tokens (anything
containing =, plus the known bare flags) out of the argument list wherever they appear, so the
remaining positionals keep their places whether options are present or not.
offset=1:2.5 delays roundtrip-51.wav (source 1) by 2.5 seconds of leading silence ahead of its
own channels — every channel that source contributes shifts together, as when it starts, not what
it contains. offset= applies as silence, not truncation: the programme's overall length grows to
cover whichever source ends latest once every offset is applied, not just the longest source's own
raw length, so a delayed source is never cut short to fit. <sourceIndex> uses the same numbering
src= establishes (0 is the primary positional file, 1..N are src= in the order given), and
works with a single source too — forge encode in.wav out.ac3 384 51 offset=0:2.5 needs no
src=/map= at all. Omitting offset= for a source (or giving it 0 seconds) behaves exactly as
it always has.
dialnorm=auto/dialnorm2=auto work alongside src=/map=: the whole programme is routed once
as a measurement pre-pass — the same BS.1770-4 gated pass the single-file path runs, over what
map= actually assembles (post-routing, post-trim), not each source's own raw channels — before
the real encode loop routes it again to encode it. A 1+1 target measures Ch1/Ch2 independently,
same as the single-file case; every other target gets one whole-programme measurement over the
routed bed. A trim on map= (e.g. L@-6) is measured on the trimmed signal, since that is what
actually reaches the stream.
In the GUI, a full-bandwidth channel explicitly assigned onto LFE/LFE2 is sent through a
120 Hz low-pass rather than passed through untouched — an explicit assignment states raw content
for that position, and a real subwoofer (and the LFE channel's own +10 dB mixing headroom)
assumes it only ever carries deep bass. forge does not filter: its map= routing is a pure
gain matrix, so content mapped onto LFE/LFE2 (e.g. 1.3:LFE above) passes through
unfiltered. Neither front end touches a source's own dedicated LFE channel reaching LFE
through automatic single-source routing (no src=/map= at all) — that stays bit-exact, since
nothing there claims full-bandwidth content belongs on that position.
The GUI's own multi-source Format-tab table (Add source… plus a per-channel assignment field) is a direct front end over this same grammar — see GUI → Multi-source & assignment.
Record/live options (record, live): container=, layout=, codec=, watchdog=¶
record/live options (record, live; any order, after the positional arguments):
container=raw the bare elementary stream (the default)
container=mkv Matroska, written incrementally as the take runs
(container=matroska is an accepted alias)
container=ts an MPEG-2 Transport Stream, same DVB profile as 'ts'
container=spdif an IEC 61937 WAV carrier, same bursts as 'spdif'
container=fmp4 a DIRECTORY of fragmented MP4/CMAF segments plus live
HLS playlists and a dynamic DASH MPD, updated as the
session runs - the output path names the folder
(container=cmaf is an accepted alias)
fmp4-window=<n> container=fmp4 only: keep only the last <n> segments in
the playlist/MPD (a rolling live window); 0, the
default, keeps every segment
layout=<name> the encoded layout (default stereo); anything wider
than AC-3 carries promotes the stream to E-AC-3
codec=ac3|eac3|ac4 force the codec instead of deriving it from layout=;
ac4 encodes AC-4
watchdog=<sec> stop the session if capture delivers nothing for this
long (default 3, 0 disables)
container=¶
All five values write the take incrementally, as it is captured — the same RecordingSink
the GUI's own takes go through (apps/shared/media/src/recording_sink.hpp), shared verbatim between the two
front ends rather than reimplemented. Two consequences worth stating: a take of any length costs
one frame of memory rather than the whole session, and a crash an hour in leaves an hour of
playable file rather than nothing.
| Value | What it writes | Byte-identical to |
|---|---|---|
raw (default) |
The bare .ac3/.ec3 elementary stream, or an .ac4 one's sync frames with their CRC |
the frames, concatenated |
mkv (alias matroska) |
Matroska, via iclforge::containers::matroska::Writer's unknown-size Segment |
mkv over the same frames, modulo the streaming Segment header |
ts (alias mpegts) |
MPEG-2 Transport Stream, DVB profile | ts over the same frames |
spdif |
IEC 61937 bursts inside a PCM16 WAV carrier | spdif over the same frames |
fmp4 (alias cmaf) |
A directory of fragmented MP4/CMAF segments plus HLS/DASH manifests, via Fmp4FolderWriter (apps/shared/media/src/fmp4_folder_writer.hpp) |
see below |
Plain mp4 is deliberately absent: moov/stco need every frame's final offset and the
dac3/dec3 box needs a bitstream scan, so it cannot be written before the take ends — the
standalone mp4 command wraps an already-finished file instead.
Fragmented MP4 has no such constraint, which is exactly why container=fmp4 can stream
incrementally like the other four. Any other value is refused rather than silently ignored, the
same rule every option on this page follows.
container=fmp4 (alias container=cmaf) is the same choice for fragmented MP4/CMAF, with one
shape difference the format forces: the output path names a folder, not a file, because the
container is a set of files. It is written incrementally — init.mp4 at the first frame, a
segment*.m4s each time a fragment closes, and audio.m3u8/master.m3u8/manifest.mpd
rewritten alongside it — so the folder is a servable live origin while the session is still
running: the playlist carries no #EXT-X-ENDLIST and the MPD is type="dynamic" with an
availabilityStartTime until the session stops, at which point the trailing partial fragment is
flushed and both close to their VOD/static forms. live never accumulates the take in memory on
this path at all; record, which encodes to a fixed length up front, pushes its frames through
the same writer so the two leave identical folders for the same take.
fmp4-window=<n> bounds what the manifests list to the last n segments — #EXT-X-MEDIA-SEQUENCE
and the MPD's @startNumber/SegmentTimeline advance with the window, which is what a real
origin deleting segments behind itself needs. The segments themselves are still written; only the
manifests roll. RFC 8216 §6.2.2 wants a live playlist to hold at least three target durations of
media, so an <n> below 3 is accepted but not something a player will enjoy. The default, 0,
lists every segment — right for a session whose folder will be served whole afterwards.
forge record out.mkv 30 192 0 container=mkv
forge record out.ts 30 448 0 container=ts layout=51
forge live out.wav 0 30 448 -2 -2 atmos container=spdif
forge live out.mkv 0 30 448 -2 -2 atmos container=mkv
forge live out_dir 0 30 448 -2 -2 atmos container=fmp4 fmp4-window=20
layout= and codec=¶
layout= takes the same grammar as every other layout argument on this page — a named layout or a
comma-separated Table E2.5 location list (see The layout grammar) — and
defaults to stereo, which is what record and live mode=channels encoded before they could be
told otherwise. The captured channels are placed onto it by direction, not by index: a
two-channel microphone recorded onto 51 fills L/R and leaves the rest silent, and a source wider
than the target folds down per §7.8 using cmixlev=/surmixlev= — exactly what encode does with
a file.
The codec follows from the layout: anything wider than AC-3 can carry needs the dependent
substreams only E-AC-3 has, so it promotes the stream automatically. codec=eac3 forces E-AC-3 for
a narrow layout too (for a receiver you want to exercise as Dolby Digital Plus); codec=ac3
alongside a layout AC-3 cannot carry is refused with the layout named.
codec=ac4 encodes AC-4 (ETSI TS 103 190) through the same AC-4 encoder ac4-encode uses, from
the same plan: mono, stereo, 5.0 (layout=L,C,R,Ls,Rs) or 5.1, at 48 or 44.1 kHz, with
dialnorm= sent as AC-4's dialnorm and drc='s profile as its drc_eac3_profile, an I-frame every
24 frames and the rate's own codec mode. A layout the AC-4 encoder does not take is refused with the
reason, before the device opens. Each container carries AC-4 as its own command does: raw the
sync frames with their CRC, ts the DVB signalling of ts, spdif the IEC 61937-14 bursts of
spdif (the smallest burst type the rate's largest frame fits), and fmp4 a CMAF track fragmented
at I-frames with the ca4m and ca4s brands and Annex G's manifest values, as fmp4 writes one.
mkv is refused, since Matroska registers no codec ID for AC-4. live's monitor decodes the AC-4
it encodes; its passthrough receiver gets the parallel 5.1 AC-3 leg (downmix=), since no receiver
found takes AC-4 over IEC 61937.
layout=/codec= describe a channel session. live mode=atmos always encodes the TS 103 420
shape — a 5.1 E-AC-3 bed plus its object layer — so passing either alongside it is refused rather
than silently ignored.
forge record out.ec3 30 448 0 layout=51
forge record out.ec3 30 384 0 layout=stereo codec=eac3
forge live out.ec3 0 30 448 -1 -1 channels layout=714
forge record out.ac4 30 192 0 layout=51 codec=ac4 drc=film-light
watchdog=¶
A capture device that vanishes — unplugged, disabled, or torn down under the session — delivers
nothing but zero-byte reads for as long as you let it, which a plain "wait for more samples" loop
cannot tell from a device that is briefly starved. Without a watchdog the session just sits there
looking healthy with no audio coming in. watchdog=<seconds> is how long that may go on before the
session stops as a failure (default 3, matching the GUI's own
device-drop detection); watchdog=0 turns it off
for a device that legitimately goes quiet for longer.
When it fires, everything already captured stays on disk — that is what streaming the take buys —
and the command exits 5 (runtime), naming the device that stopped. live capture2= gets its own
watchdog on the same timeout, so a dropped slave is reported as the slave.
Live options (live): capture2=, objects=, downmix=¶
live options (live; any order, after the positional arguments):
capture2=<index> a second capture device, clock-conformed to the first (see 'devices')
objects=<N> the object-slot budget for mode=atmos (1..15)
downmix=off refuse an AC-3-only passthrough endpoint instead of running
the parallel 5.1 AC-3 leg
capture2=¶
capture2=<index> names a second capture device — same 0-based numbering devices prints and the
capture_device positional already uses — that joins the session alongside the master. The master
(capture_device) still paces the session exactly as it always has: frame timing, target frame
count and every other positional argument mean what they meant before this option existed.
capture2's own sample rate does not need to match the master's, only be a legal AC-3 rate itself
(32, 44.1 or 48 kHz) — a drift-tracking resampler continuously conforms the slave's stream to the
master's pacing, correcting both the nominal rate conversion and whatever free-running clock drift
the two devices accumulate against each other. The slave's channels are appended after the
master's own, at new, higher channel indices, in the same interleaved per-frame block that feeds
the encoder — so a two-device atmos session simply has more capture channels to bind object slots
to. The measured drift is printed once, in signed parts-per-million, when the session ends.
Captures 30 seconds of Atmos-mode E-AC-3 from device 0 (the clock master) plus device 1
(clock-conformed to device 0), no monitor or passthrough, writing out.ec3.
objects= and map= (mode=atmos)¶
The object-slot budget is allocated once, at session start, and never changes: a decoder reads the object count from the first access unit's OAMD and does not re-read it, so a slot bound half-way through a session cannot be allowed to change how many objects the stream declares. That is the same rule the GUI's live object room follows — its Add object chips allocate against a fixed budget, and reassigning a chip rebinds a slot rather than creating one.
Without either option, live mode=atmos allocates one slot per captured channel (capped at 15,
since the bed's LFE is the 16th object and TS 103 420 §8.3.2.2 caps the total at 16) and binds them
one-to-one — exactly what it always did. objects=<N> sets the budget explicitly; slots past the
captured channel count are allocated but unbound, and carried silent.
map= binds capture channels to slots by name, using the same grammar encode/eac3-encode take
for files (see Source options) with the
capture devices as sources: source 0 is capture_device, source 1 is capture2= when present.
obj makes a channel its own object; objm over a contiguous range folds it to one mono object;
none leaves a channel out. Objects appear in map= order — every obj row first, then each
objm group. A @<trim> on either is applied to that channel's contribution.
# Four objects: capture channels 0 and 1 on their own, 2-3 folded to one, and
# capture2's first channel as the fourth. Two more slots are allocated and left
# silent, so the stream declares six objects throughout.
forge live out.ec3 0 60 448 -2 -2 atmos capture2=1 objects=6 \
map=0.0:obj,0.1:obj@-3,0.2-0.3:objm,0.4:none,0.5:none,1.0:obj,1.1:none
map= is refused on mode=channels: a channel session places its channels by direction onto
layout=, and there are no object slots to bind. A budget smaller than what map= assigns is
refused rather than silently truncated.
downmix=¶
When the session's stream needs E-AC-3 — an object session, or a channel layout wider than AC-3 can
carry — but the chosen passthrough_device only bitstreams plain AC-3, live runs a parallel
5.1 AC-3 leg: an independent AC-3 encode of the bed the main plan has already computed, sent to
that receiver, while the file and the monitor still carry the full stream. The bed is already a
self-sufficient fold-down of the whole programme, so there is no second §7.8 fold to compute; the
receiver simply hears a capped downmix instead of a refusal. This is the CLI half of the GUI's
parallel downmix leg.
downmix=off refuses instead — the plain "does not accept E-AC-3 over IEC 61937" warning and a
file-only session, which is what live did before. A receiver that accepts neither format is a
a refusal either way.
forge live out.ec3 0 30 448 -2 1 channels layout=714 # capped 5.1 AC-3 to receiver 1
forge live out.ec3 0 30 448 -2 1 channels layout=714 downmix=off
Play options (play): follow=¶
play options (play; after the positional arguments):
follow=off refuse a sink that rejects the source format instead of
transcoding to AC-3 or falling back to decoded PCM
follow=¶
When play is given a device_index, it asks what that sink actually accepts —
its own EDID/ELD-carried Short Audio Descriptors where a backend can read them (real today only
on ALSA; see Linux), the same live probe outputs uses everywhere
else. By default (follow=on, the implicit default), a source format the sink rejects gets an
automatic fallback:
- E-AC-3 on an AC-3-only sink is transcoded to AC-3 first (
transcode, through a temporary file — dialnorm,comprand the mix metadata carry across exactly as a directforge transcodecall would), then plays as AC-3. This is the "no 5.1 PCM over optical" case: an optical link can carry compressed AC-3 but never multichannel PCM, so a 5.1 E-AC-3 source has no other way through. - A sink that bitstreams neither format falls back to decoded PCM (
monitor's own §7.8-aware path, so a wide programme is folded to the endpoint's real width rather than left to a shared-mode mixer to average down however it sees fit).
follow=off disables both and restores the plain refusal play always gave — the escape hatch
for a script that wants a hard failure rather than an automatic re-encode. The default endpoint
(no device_index given) is unaffected either way: its capabilities were never probed before
this option existed either, and it is taken at its word exactly as before.
AC-4 is the exception to both paths: no receiver found takes it over IEC 61937, so play decodes
an AC-4 stream to PCM on an ordinary output whatever the sink accepts, and follow=off, which
asks for passthrough alone, refuses it (exit 4).
forge play programme.ec3 2 # follows the sink (the default)
forge play programme.ec3 2 follow=off # the old plain refusal instead
Common options (every command): quiet, verbose¶
common options (every command; any order, after the positional arguments):
quiet no status output at all - errors on stderr and, for a '-'
output, the payload on stdout. Nothing else is printed.
verbose print the stderr progress line whatever the run's length,
and name every source/routing decision as it is made.
--help, -h this command's own help
quiet silences the status output — the meters, the routing summary, the dialnorm=auto
measurement line, the "wrote N frames" summary — while leaving errors on stderr and, for a -
output, the payload on stdout untouched. It does not silence a reporting command's report:
levels, loudness, qc, devices and outputs print their answer regardless, because that
answer is the command's output rather than commentary on it.
verbose turns the stderr progress line on whatever the run's length. Without either token, a run
long enough to be worth watching (500 frames or access units — about 16 seconds of audio) prints
that one line on stderr and nothing else new. It is always stderr, never stdout: a - output owns
stdout, and a progress line in the middle of a piped elementary stream would corrupt whatever is
reading it.
forge encode in.wav out.ac3 448 51 quiet && echo "encoded"
forge decode long.ec3 - verbose > out.wav
Exit codes¶
Every command returns one of eight codes, so a script can tell why something failed rather than
only that it did. forge help exit-codes prints the same table.
| Code | Meaning |
|---|---|
0 |
Success. |
1 |
Usage — a bad or missing argument, an unknown command or option, or a configuration the encoder cannot express (an illegal bitrate for a layout, more objects than a stream can carry). Retrying the same command line cannot help. |
2 |
Input — unreadable, absent, or not a valid AC-3/E-AC-3/AC-4/WAV/ADM file, or a stream that stopped decoding part-way (and, with decode ... strict, one that lost frames or units after the first one decoded, once what could be decoded is written). |
3 |
Output — the destination could not be created, written or finalized. |
4 |
Unavailable here — this build or this machine cannot run the command at all (no audio backend, no capture/render endpoint, an endpoint that refuses the format, a library this build was not configured with). The same command line may well succeed elsewhere. |
5 |
Runtime — the run started and then failed for none of the above reasons: a capture device that stopped delivering audio (the record/live watchdog), an output device that went away mid-playback (play, monitor, identify, live's output legs), a loudness measurement with nothing above the gate, a signing pass that could not complete. |
6 |
A QC gate failed. Distinct from 2 so a CI step can tell "the stream is out of spec" (a result) from "qc could not read the file" (a fault). |
7 |
Internal — an exception escaped a command. Never expected. |
qc's long-standing contract is unchanged: exit 0 only when the file decodes cleanly and
every requested gate passes. What is new is the non-zero half being named.
Two paths return 1 where the table gives an input problem 2: every failure of probe, and
decode of an AC-3 or E-AC-3 stream whose independent substreams cannot be framed (stream
framing failed, no programmes in stream). A script that gates on 2 for a bad input should
test for 1 there as well.
forge qc out.ec3 preset=ebu-r128-s2
case $? in
0) echo "in spec" ;;
6) echo "out of spec" ;;
*) echo "qc could not run" ;;
esac
Programme options (eac3-encode)¶
programme options (eac3-encode; any order, after the positional arguments; N = 2..8):
programmeN=<path> author another programme into the same stream, as an
independent substream of its own (§E2.3.1.2's I(N-1))
programmeN-layout=<name> its layout; omitted follows its own source
programmeN-bitrate=<kbps> its own rate, spent ON TOP of the primary's; omitted is half
programmeN-<field>=... its own metadata - the same key vocabulary the primary programme's
own bare tokens above use (bsmod=, dsurmod=, dmixmod=, cmixlev=/surmixlev=,
lfemix=, pgmscl=/extpgmscl=, mixdef=/premixcmp=/mixdata=/extmix=/auxmix=/
speechmix=, paninfo=, blkmixcfg=, dialnorm=<1..31>|auto, drc=/ceiling=/
dialogue=, heavy, infomdat, copyright, sourcefscod, and more) applied to this
programme's own plan::Metadata instead of the primary's
A/52 Annex E allows eight independent substreams (I0–I7) in one elementary stream. That is a different thing from the dependent substreams a wide layout uses: a dependent extends one programme's soundfield, while an independent substream is a whole separate programme with its own layout, rate, level and service label. Broadcast DD+ uses them for the services §5.4.2.2 names — a second language, an audio description, a commentary — so one stream carries the main mix and the alternatives, and a receiver plays one of them.
forge eac3-encode film51.wav out.ec3 448 none 51 off \
programme2=commentary.wav programme2-layout=mono programme2-bitrate=96 \
programme2-bsmod=commentary programme2-dialnorm=20 \
programme3=description.wav programme3-layout=mono programme3-bitrate=96 \
programme3-bsmod=vi programme3-dialnorm=auto
That writes I0 as 5.1 at 448 kbit/s, I1 as a mono commentary at 96 kbit/s labelled bsmod
commentary, and I2 as a mono audio description at 96 kbit/s labelled visually-impaired, its own
dialnorm measured from its own audio. The rates add: substreams share a frame period rather
than a frame, so the file above runs at 640 kbit/s, not 448.
Every programmeN- token is its own programme's own value, never inherited from the primary or
from a lower-numbered programmeN-: a commentary or description track is levelled and labelled
independently of the mix it plays against and of any other associated service in the same stream
— that independence is the reason each is carried as a separate programme at all. Omitting a
field gives that programme the same default the primary's own bare token would (dialnorm=
defaults to 31, bsmod= to complete main, and so on).
programmeN= slots fill in order — programme2= first, then programme3=, and so on — because
§E2.3.1.2 assigns substream ids (I1, I2, …) sequentially with no way to leave a gap in the
sequence. programme4= given without programme2=/programme3= is refused rather than quietly
becoming I1: the number in the token is a promise about which substream it becomes.
Not supported, and refused rather than ignored:
programmeN-layout=1+1. 1+1 already carries two programmes in one substream, levelled bydialnorm/dialnorm2; nesting it inside another independent substream would mean three programmes described two different ways with only one of the levels reachable. Use 1+1 on the primary programme instead, or give the extra programme a layout of its own.- The five fields that only ever mean anything under 1+1 (
dialnorm2=,drc2=,heavy2/ceiling2=/dialogue2=,mixlevel2=,roomtyp2=) and the two Table E1.2 fields §E2.3.1.13/54 reserve for a 1+1 programme's own second channel (pgmscl2=,paninfo2=) — since 1+1 is refused as an extra programme's layout, none of these has a second channel left to describe. - AC-3 Annex D's own fields (
annexd,encinfo,langcod,langcod2,timecode=) — an extra programme is always an E-AC-3 independent substream, which has no bsid-6 alternate syntax to carry them. programmeN=together withsrc=/map=. The multi-source router assigns channels to one programme.
One thing worth knowing before shipping such a stream: FFmpeg refuses it outright, and not only the second programme — see Validation → Where the oracles don't reach.
Programme options (decode, qc, levels): programme=¶
programme options (decode, qc, levels, monitor, spatial, play, transcode, spdif, mkv, mp4, fmp4,
ts; any order, after the positional arguments):
programme=<0..7> which programme of a multi-programme stream to work on, by the §E2.3.1.2
substreamid of its independent substream; omitted takes the first the
stream carries (mp4, fmp4 and ts omit it to carry every programme)
The decode-side half of programme2= above, and the same token for the commands that play, re-code
or wrap a stream (monitor, spatial, play, transcode, spdif). Every one of them works on
exactly one programme — never a fold of several, since two programmes are alternatives rather than
layers and mixing them would give a WAV that splices unrelated audio, a loudness figure neither
programme has, from monitor, a main and then its audio description one frame period at a time, or,
from play and spdif, a receiver sent the main at half speed with the description between its
frames.
decode and monitor can also mix one programme into another when the second is an associated
service (§E3.10): a description, a commentary, a voice-over, carried beside the main with the
gains and pan the stream gives it.
associated=<0..7>|<service> mix this programme into the one being decoded or played: a substream
id, or a service name (visually-impaired, audio-description, hearing-impaired,
commentary, emergency-information, spoken-subtitles) that the stream's own
bsmod labels
associated-gain=<dB> the listener's level for it, 0 dB or less, on top of the stream's own
forge decode broadcast.ec3 mixed.wav associated=visually-impaired
forge decode broadcast.ec3 mixed.wav programme=0 associated=1 associated-gain=-3
forge monitor broadcast.ec3 associated=audio-description
forge monitor broadcast.ec3 programme=0 associated=1 associated-gain=-6
The main is programme= as above, and the status output names what was mixed and the range of
each gain. What is applied is the associated programme's pgmscl to itself, its extpgmscl and
per-channel scales to the main (or dmixscl, when channels=2 or 1 folded the main), the main's
own pgmscl, and for a mono service its paninfo by Tables E3.15 to E3.17 — see
Mixing an associated service
for the rules and for what Annex E gives no processing. A stream with no such programme, or
whose main is 1+1 dual mono, is refused rather than decoded without it.
monitor mixes as it plays, from a second decoder run in step with the main's, so a stream that
cannot give the service is refused before the output is touched and decode's words and exit code
are the ones it refuses in. The main is folded to the endpoint's width first, as monitor always
does when the endpoint renders fewer channels than the programme, and the mix then takes dmixscl
in place of the per-channel scales exactly as decode channels=2 does; the service is never folded,
so a mono description is still placed by its pan. play mixes nothing: it hands one coded programme
to a receiver (or to the AC-3 transcode that does), without decoding it, so it names associated=
as ignored — except where the endpoint takes PCM only and play decodes the stream through
monitor, which mixes. spatial places one programme's objects and ignores associated= the same
way.
forge decode out.ec3 main.wav # programme 0
forge decode out.ec3 commentary.wav programme=1
forge levels out.ec3 programme=1
forge qc out.ec3 programme=1 preset=atsc-a85
forge monitor out.ec3 -1 programme=1 # hear the commentary
forge transcode out.ec3 commentary.ac3 192 programme=1
monitor and spatial play the programme they chose and say so before they touch a device; a
programme the stream does not carry is refused by name (exit 1) on a machine with no output at
all. play sends a receiver that programme alone: a receiver takes independent substream 0 and
ignores the rest, so a programme other than 0 is cut out and renumbered as substream 0 first, as the
containers do. Where play has to fall back, the PCM leg is monitor and the AC-3 leg is
transcode, and both honour programme= the same way. transcode without it takes the first
programme, as it always has.
spdif writes what play would send: the one programme, cut out and renumbered as substream 0 when
it is not 0 already, as that programme's bursts alone, so unspdif recovers that programme and no
other. It names the programme it wrapped, and a programme the stream does not carry is refused by
name (exit 1) with no carrier left behind. It decodes nothing, so associated= is named as
ignored there, as play names it.
forge spdif out.ec3 main.wav # programme 0, as play sends it
forge spdif out.ec3 commentary.wav programme=1
On mkv, mp4, fmp4 and ts the chosen programme is written alone, renumbered as independent
substream 0 with its CRC re-stamped (a player takes substream 0 and ignores the rest, so another
programme's frames left as they are would be a track it will not play); the audio and every other
field are untouched. Without it mp4, fmp4 and ts carry every programme, as TS 102 366 F.2 and
A/52 Annex G §3.3 define a sample or PES payload, and mkv keeps the first with a warning.
Omitting it takes the first programme the stream carries. When there is more than one, each
command says which it picked and what else was there (programme 0 of 2 (0, 1)), so a
multi-programme stream is never handled silently. Asking for a programme the stream does not
carry is an error that lists the ones it does. Ignored for AC-3, which has no substream layer.
AC-4 has no programmes: it chooses a presentation instead (below), and decode given programme=
with an AC-4 stream names it in a warning and ignores it; monitor, play and spdif ignore it for
AC-4 without saying so.
AC-4 options¶
AC-4's options are described where the commands are (ac4-encode,
presentations,
immersive layouts,
objects, output level and DRC).
This section lists every key, the commands that read it and what it takes.
Reading AC-4. decode, monitor, play, qc, levels, loudness and transcode choose a
presentation the same way; the rest belong to the three that play or write the decoded audio.
| Key | Commands | Takes |
|---|---|---|
presentation=<n> |
all seven | The presentation at position n of the table of contents, 0 to 1023 |
presentation-id=<id> |
all seven | The presentation with that presentation_id, 0 to 1023 |
language=<tag> |
all seven | A BCP 47 tag: the presentation that best meets it, ahead of associated= |
associated=<service> |
all seven | visually-impaired, audio-description, audio-description-subtitles, spoken-subtitles, emergency-information, hearing-impaired or commentary |
dialogue-gain=<dB> |
all seven | The dialogue against the music and effects, up to 12 dB and the stream's own maximum |
associated-gain=<dB> |
all seven | The associated audio's gain, 0 dB or less |
md-compat=<0..7> |
all seven | The md_compat level the decoder claims; 7 by default |
conceal=repeat\|mute\|off |
decode, monitor |
What stands in for a frame that will not decode; off by default |
output-level=<dBFS> |
decode, monitor, play |
The level the stream's dialnorm is taken to, -60 to 0; unset leaves the coded level |
drcmode=<mode> |
decode, monitor, play |
default, home-theatre, flat-panel-tv, portable-speakers, portable-headphones or off; every one but off needs output-level= |
dialogue-enhancement=<dB> |
decode, monitor, play |
0 to 12 dB, no more than the stream's cap |
headphones |
decode, monitor, play |
The listener is on headphones |
decoding=full\|core |
decode, monitor, play |
The immersive element in full, or its 5.X.2 core |
speakers=<layout> |
decode, monitor, play |
5.1, 5.1.2, 5.1.4, 7.1, 7.1.2 or 7.1.4 |
channels=2\|1\|5.1\|as-coded, downmix=loro\|ltrt\|mono\|auto, mix-lfe, mix-lfe=on\|off |
decode, monitor, play |
The fold of clause 6.2.17; channels=5.1 folds a 7.X stream's last pair and is transcode's too |
syntax-trace=<file> |
decode |
Every syntax element read, one a line |
decode also takes AC-4's objects out as objects_dir and adm_out. The options only AC-3 and
E-AC-3 read (drc=, heavy, ltrt-phase=, fast-imdct, mode=, programme=, bed-only,
joc-domain=) are named and ignored by decode for an AC-4 stream, and bap-census=,
verify-objects and gate-objects refuse it; AC-4's own are named and ignored for AC-3 and E-AC-3, and
channels=5.1 and syntax-trace= refuse them.
Writing AC-4. ac4-encode takes every key below; the other commands that write AC-4 take the
few noted in the last rows.
| Keys | Takes |
|---|---|
frame-rate=, rate-mode=, codec-mode=, iframe-interval=, iframes=, fragment=, crc= |
The frame rate, how frames share the rate, the codec mode, and where I-frames fall; crc=off leaves a raw stream's sync frames without their CRC |
experimental=<tools>, objects=<scene file> |
The tools no outside reader has checked, and the scene an object stream is written from |
dialnorm=, loudness=, drc=, drc-home-theatre=, drc-flat-panel-tv=, drc-portable-speakers=, drc-portable-headphones= |
The dialogue level, the measured loudness values, and the DRC profile for all four decoder modes or for one |
cmixlev=, lorocmixlev=, ltrtcmixlev=, surmixlev=, lorosurmixlev=, ltrtsurmixlev=, lfemix=, dmixmod=, loro-correction=, ltrt-correction= |
The stereo downmix's gains, its preferred method and its loudness corrections |
height-downmix=, height-gain= |
The immersive layouts' downmix to 5.X |
dialogue-channels=, dialogue-stem=, dialogue-method=, dialogue-max-gain=, dialogue-hybrid= |
Dialogue enhancement |
substreamN=, substreamN-<option>=, presentationN=, presentationN-<option>= |
Further substreams (N from 1 to 32) and the presentations that play them (N from 1 to 64) |
syntax-trace=<file> |
Every syntax element written, one a line |
atmos-encode, atmos-adm, atmos-iab with codec=ac4 |
coding=ajoc\|direct, dialnorm=1..31, and on atmos-encode crc= |
transcode to .ac4 or with codec=ac4 |
drc=<profile> and dialnorm=; the AC-3 and E-AC-3 options with no AC-4 counterpart are refused |
record, live with codec=ac4 |
layout= (mono, stereo, 5.0 or 5.1), container= (not mkv), dialnorm=<1..31> and drc='s profile |
ac4-encode refuses heavy, heavy2, drc2=, dialnorm2=, mixmeta, infomdat and annexd,
which describe AC-3 and E-AC-3 metadata AC-4 has no counterpart for.
Stream-tool options (transcode, metadata)¶
| Token | Command | Meaning |
|---|---|---|
codec=ac3 / codec=eac3 / codec=ac4 |
transcode |
The output codec, when the output name's own suffix cannot say it — stdout (-), or a file named something other than .ac3/.ec3/.ac4. Without it, an unrecognisable name is refused rather than guessed |
compr=<dB> |
metadata |
Stamp §7.7.2's compression word onto an existing stream, as the 8-bit wire value that gain implies |
compr2=<dB> |
metadata |
The same for Ch2 of a 1+1 dual-mono stream |
bsmod=<0..7> |
metadata |
Table 5.5's service type (0 = complete main, 1 = music and effects, 2 = visually impaired, …) |
dsurmod=<0..3> |
metadata |
Table 5.11's Dolby Surround mode. Coding mode 2/0 only — §5.4.2.7 transmits it nowhere else |
compr=/compr2= round down to the nearest representable word, not to nearest: §7.7.2
exists to give "an assured upper limit of instantaneous peak reproduced signal level", and a
ceiling exceeded by half a step is not assured. That is the same rule
iclforge::ac3::meta::encode_compr_at_most applies on the encode side.
compr= is a different thing from the heavy/ceiling=/dialogue= group above. Those ask an
encoder to derive a compression word from the signal it is coding; compr= names the word
outright, because a metadata rewrite has no signal to derive from — only bits to overwrite, and
only where the stream already carries a compr word. Asking for one where it does not is
refused, not invented.
dialnorm= and dialnorm2= work on metadata too, but only with an explicit 1..31 value:
dialnorm=auto needs a measurement, which is what forge normalize is. On transcode they
override the value carried from the source, and dialnorm=auto measures the source the same
way an encode from a WAV would; an AC-4 source is measured as the presentation it transcodes, as
coded. A transcode to AC-4 takes dialnorm= and drc= for AC-4's dialnorm and DRC profile, and
refuses the options AC-4 has no counterpart for (heavy, drc2=, dialnorm2=, mixmeta,
infomdat, annexd); a transcode from AC-4 takes the presentation options of
Commands and channels=5.1.
Qc options (qc): preset=, layout=, objects=¶
qc options (qc; any order, after the positional arguments):
preset=<name> gate the measurement against a named delivery spec
ebu-r128-s2 | atsc-a85 | atsc-a85-streaming | netflix | apple-music-atmos
preset=all gate against every preset above
omitted: measure and report only, no gate
layout=bed the default - meter the independent substream's own
Table 5.8 bed (BS.1770 Annex 1's basic algorithm)
layout=rendered meter the whole assembled program instead, every
dependent substream's height/wide/rear channels
included (BS.1770-5 Annex 3's extended algorithm)
objects=<layout> re-render dynamic objects by their own OAMD position
onto <layout> (71|512|514|714) and meter that too
(BS.1770-5 Annex 4); dynamic-object-only programmes
only
preset=<name> checks qc's BS.1770-4 measurement against one named delivery-loudness gate instead of just
reporting it; preset=all checks every one below in a single run. Each preset states a target integrated
loudness, a symmetric tolerance around it (in LU) and a true-peak ceiling (a one-sided limit, never exceeded —
not a tolerance band). The numbers are defined in iclforge::ac3::meta::qc_preset()
(iclforge/ac3/meta/qc.hpp), each
read directly from its own primary source rather than recalled from memory:
| Preset | Loudness | Max true peak | Source (version, date) |
|---|---|---|---|
ebu-r128-s2 |
−23.0 LUFS ±1.0 LU | −1.0 dBTP | EBU R 128 s2 "Loudness in Streaming" (Geneva, November 2023, v3) recommendation (e) — programmes "should be streamed unchanged, that is at −23.0 LUFS" — which itself defers tolerance/true-peak to EBU R 128 (Geneva, November 2023, v5) recommendations (h) and (m) |
atsc-a85 |
−24.0 LKFS ±2.0 dB | −2.0 dBTP | ATSC A/85:2026-07 (approved 8 July 2026) §6 "Target Loudness and True Peak Levels for Content Delivery or Exchange" |
atsc-a85-streaming |
−25.0 LKFS ±2.0 LU | −2.0 dBTP | ATSC A/85:2026-07 (approved 8 July 2026) Annex L.5 — "Selecting a Loudness value between −23 and −27 LKFS is recommended", restated in Annex M's Table M.1 |
netflix |
−27.0 LKFS ±2.0 LU | −2.0 dBTP | Netflix "Sound Mix Specifications & Best Practices" v1.6, Near-field Audio Prerequisites for Mix Facilities; Netflix "Dolby Atmos Home Mix Deliverable Requirements" v2.3 states the same numbers for an Atmos deliverable |
apple-music-atmos |
≤ −18.0 LKFS (a ceiling, not a band) | −1.0 dBTP | Apple "Immersive Audio Source Profile" (Apple Video and Audio Asset Guide), Dolby Atmos music deliverables — "should not exceed −18 LKFS measured as per ITU-R BS. 1770-4" |
Two of these need a word of explanation.
atsc-a85-streaming carries a band, not a point. Annex L.5 asks a streaming service to pick "only one
specific and consistent Target Loudness" somewhere between −23 and −27 LKFS; −25.0 ±2.0 reproduces those two
edges exactly. The −25.0 midpoint is an artefact of how this table is shaped and is not a level the Annex
asks anyone to aim for — it names −23, −24 and −27 as the values real operators actually use.
apple-music-atmos is the one preset whose loudness figure is a ceiling rather than a band: Apple's clause
is "should not exceed", so a quieter master is compliant however quiet it is. Gating that as a ±band would fail
material the specification accepts, so qc prints it as limit <= -18.0 LKFS and passes anything at or under
it. True peak is always a ceiling, for every preset.
Specifications deliberately not given a preset¶
Adding these would mean shipping a second name for a verdict already on offer, so they are documented here instead:
- EBU R 128 s4 "Loudness Normalisation of Cinematic Content" (November 2023). Recommendation (m) normalises
Programme Loudness to "a Target Level of −23.0 LUFS" and (l) repeats the −1 dBTP ceiling — numerically
identical to
ebu-r128-s2. What s4 adds is recommendation (j), a Loudness-to-Dialogue Ratio not exceeding 5 LU; that is a Programme-minus-Dialogue figure, andLoudnessMeterhas no dialogue gate, so the single clause that would distinguish an s4 preset is also the one this meter cannot evaluate. - Netflix Dolby Atmos Home Mix Deliverable Requirements v2.3. Same three numbers as
netflix. What it adds is scope rather than numbers — "Loudness and peaks should be measured via a 5.1 rerender" — which is alayout=choice, not a gate. - Amazon. Prime Video figures are widely repeated at −24 LKFS/−2 dBTP, but every source found for them is a
third-party summary and Amazon's own delivery specifications sit behind a partner portal. Nothing in this
table is cited to a document that was not read, so the row is absent rather than guessed — and −24/±2/−2
would in any case restate
atsc-a85.
layout=bed (default) and layout=rendered¶
layout= chooses which soundfield is metered, and with it which of BS.1770's two algorithms does the
metering:
| What is measured | Algorithm | |
|---|---|---|
layout=bed (default) |
The independent substream's own Table 5.8 bed | BS.1770 Annex 1's basic algorithm — Table 3 weights, keyed on acmod |
layout=rendered |
The whole assembled program, every dependent substream's channels laid over the bed in Table E2.5 order | BS.1770-5 (11/2023) Annex 3's extended algorithm — Table 4 weights, keyed on each channel's position |
The default is bed, which is what qc has always measured. On a stream that carries dependent substreams,
bed now says so explicitly rather than silently reporting the 5.1 as if it were the whole programme:
qc: atmos.ec3 (E-AC-3, 3/2 + LFE, 48000 Hz, 62 access unit(s), 1.98 s)
layout=bed (BS.1770 Annex 1, Table 3 weights over the Table 5.8 bed)
note: this stream carries dependent substreams whose channels (height, wide, rear)
are NOT in the figures above - layout=rendered measures them as well
layout=rendered is what makes 7.1, 5.1.2, 5.1.4 and 7.1.4 measurable at all, since none of those channels is
a member of Table 5.8. Annex 3's Table 4 weights a channel by where it sits: 1.41 (+1.5 dB) for anything
between 60° and 120° azimuth below 30° elevation, 1.00 everywhere else. Applied to Table E2.5's locations
that gives:
| Weight | Locations | BS.2051 label |
|---|---|---|
| 1.41 (+1.5 dB) | Ls Rs Lsd Rsd Lw Rw |
M±110, M±090, M±060 |
| 1.00 (0 dB) | L C R Lc Rc |
M+000, M±030, M±SC |
| 1.00 (0 dB) | Lrs Rrs Cs |
M±135, M+180 |
| 1.00 (0 dB) | Vhl Vhr Vhc Lts Rts Ts |
every U/T position |
| excluded | LFE LFE2 |
— |
Two results there are worth reading twice, because reasoning from the channel names gets both wrong: a 7.1 layout's rear pair is not surround-weighted (M±135 is past the 120° edge), and no height channel is either (Table 4's elevation row simply does not cover the upper layer). The wides are, sitting exactly on the inclusive 60° edge.
That first one is where other meters differ. ffmpeg's ebur128, probed one channel at a time, weights a 7.1
layout's back surrounds at 1.41 just like its side surrounds — it generalises Annex 1's Table 3 by channel
name, so anything called a surround gets +1.5 dB. Annex 3's Table 4 and Table 5 both put M±135 at 1.00, and
layout=rendered follows the standard, so expect a 1.5 dB disagreement on exactly those two channels. On 5.1
the two agree to within 0.02 dB, which is why ebur128 is a good cross-check for layout=bed and not for
layout=rendered.
For a plain 5.1 stream the two algorithms are the same function — Ls/Rs are M±110, inside Table 4's +1.5 dB
sector, which is where Annex 1's Table 3 got its 1.41 — so layout= changes nothing there. The one Table 5.8
layout where they differ is 2/1 and 3/1: Annex 1 has no Table 3 entry for a lone surround and this
meter reads it as the surround field collapsed to one channel (+1.5 dB), while Annex 3 sees Table E2.5's Cs,
a rear centre at M+180, at unity.
objects=<layout>¶
layout= above meters channels — the bed, or the whole assembled program with every dependent's channels
laid over it. Neither sees a dynamic object's own position: this project's own encoder pans every object onto
the flat 5.1 ring at encode time (iclforge::spatial::pan_room's own "a raised object folds onto the ring... at
full level"), so an object authored directly overhead measures no differently from one on the ring — the bed
a legacy 5.1 decoder plays has nowhere else to put it.
ITU-R BS.1770-5 (11/2023) Annex 4 covers this: it defines no weighting table of its own, and instead says to
render object-based (or combined channel- and object-based) audio to a real loudspeaker configuration first,
then meter that through Annexes 1/3 — and to report which configuration and rendering algorithm did the
rendering, since two reasonable choices can legitimately disagree by several LU (Annex 4's own worked example,
its Table 6, does exactly that across renderers and layouts). objects=<layout> is that: it re-renders each
dynamic object by its own OAMD position — including height — onto the named layout (51, 71, 512, 514
or 714) via iclforge::spatial's direction-based panner (the same height-aware geometry iclforge::ac3::plan's
layout-to-layout channel renderer uses internally), then meters the result through the Annex 3 algorithm
layout=rendered already implements:
$ forge qc atmos.ec3 objects=514
qc: atmos.ec3 (E-AC-3, 3/2 + LFE, 48000 Hz, 62 access unit(s), 1.98 s)
layout=bed (BS.1770 Annex 1, Table 3 weights over the Table 5.8 bed)
...
objects=5.1.4 (BS.1770-5 Annex 4: objects re-rendered by their own OAMD
position, via iclforge::spatial's direction panner, then Annex 3)
objects: measured (BS.1770-4 gated / EBU Tech 3342 / BS.1770-4 Annex 2):
...
layout=/layout=rendered and objects=<layout> are independent switches — objects= adds a third,
separately-labelled report rather than replacing either of the other two.
Restricted to a dynamic-object-only programme — the only shape atmos-encode produces, and what Dolby's
own reference JOC test streams declare. For that shape the decoded bed already IS the objects' 5.1 VBAP fold
(oba/oamd.hpp's own comment: "the 5.1 downmix IS the objects' VBAP render"), so objects= starts every
full-bandwidth target channel at silence and sums each object's own recovered audio
(DecodedAccessUnit::object_audio) into it, rather than adding to a bed that already carries it and
double-counting. A bed-and-objects programme — third-party content whose bed may carry independent,
non-object material this decoder cannot separate back out — is refused rather than risk silently doubling or
dropping content:
$ forge qc plain_channel_based.ec3 objects=514
error: programme 0 carries no dynamic-object-only OAMD - objects= needs OAMD dynamic
objects (try layout=rendered or layout=bed instead)
Omitting preset= entirely leaves qc in measure-and-report mode — every number is still printed, there is
just no PASS/FAIL verdict and nothing to gate on. See Commands → qc for the
full report format and the exit-code convention this drives.
TrueHD and MLP options (decode, levels, loudness, truehd-encode, truehd-atmos, metadata)¶
decode, levels and loudness of TrueHD or MLP (after the positional arguments; ignored with a warning for other streams):
truehd-presentation=best|2ch|6ch|8ch|all
the substreams read; best (default) is the highest of substreams 0 to 2
truehd-check=strict|lenient
strict (default) stops with exit status 2 at the first failed check;
lenient counts failed checks and decodes on
decode of a TrueHD Atmos stream, with truehd-presentation=all (provisional):
truehd-render=LAYOUT
place the objects of substream 3 on the layout (a name such as 7.1 or
7.1.4, or a list such as L,R,C,LFE,Ls,Rs,Lrs,Rrs) and write the speaker
feeds as the output WAV instead of the channels
A TrueHD or MLP run refuses every other option it is given, by name, with exit status 1: decode applies these two,
levels and loudness the same two, and mkv, mp4, ts, spdif and remux none. truehd-encode applies its own
options and verify:
truehd-encode (after the positional arguments):
truehd-downmix=none|standard
none (default): the first two channels are substream 0 as they are;
standard: a stereo and 5.1 downmix, undone exactly by the later substreams
truehd-downmix-gains=C,S,LFE,R
four gains in dB, 0 to -60 or off, for C, Ls and Rs, LFE, and Lrs and Rrs
folded into the downmix (default -3,-3,off,-3)
truehd-restart=N access units between restart headers, 1 or 8 to 4096 (default 128)
truehd-peak-rate=KBPS
the rate the stream is declared not to exceed, kbit/s (default 18000)
truehd-rate-check=strict|lenient
strict (default) refuses a stream that cannot be sent within the peak rate;
lenient writes it and counts
truehd-fir-order=0..8
the largest FIR prediction order tried (default 8)
truehd-matrix=on|off
decorrelate channel pairs with a primitive matrix (default on)
truehd-stereo-mode=stereo|ltrt|headphone
the 2 channel mode the stream declares (default stereo)
verify decode every access unit as it is coded and compare it with the input
truehd-atmos applies the same options, and:
truehd-atmos (after the positional arguments; provisional; the input is a WAV of object channels or an ADM master):
truehd-bed=FILE the 7.1 bed as a WAV (L R C LFE Ls Rs Lrs Rrs, the objects' length and rate);
without it the bed is the objects placed on 7.1 by the renderer
truehd-objects-lfe=on|off
on (default): the first channel of the objects WAV is the LFE;
off: every channel is an object
The channel meaning of TH spec section 14, written into every major sync (and set in a finished stream by metadata,
with the same options). Per presentation, 2, 6 and 8 channels, each refused by name outside its field's width; a field
left out is 0 and a control bit off, as in FFmpeg's streams. Provisional, no oracle until the DEE set (FFmpeg writes
zeros): the specification gives the widths and, for the 6 and 8 channel dialogue norms, a unit (n is -n dBFS), and gives
no unit for the mix level, no table for the source format and no word on what a control bit gates
(libs/truehd/ERRATA.md, questions
51 to 55):
truehd-encode and metadata, of TrueHD (after the positional arguments):
truehd-dialnorm-2ch=0..63 truehd-dialnorm-6ch=0..31 truehd-dialnorm-8ch=0..31
the presentation's dialogue norm (6 bits for 2 channels, 5 for the others)
truehd-mix-level-2ch=0..63 truehd-mix-level-6ch=0..63 truehd-mix-level-8ch=0..63
the presentation's mix level (6 bits; no unit is given, so the number is not converted)
truehd-source-format-6ch=0..31 truehd-source-format-8ch=0..63
the presentation's source format (5 and 6 bits; no table is given); the 2 channel
presentation has none
truehd-control-2ch=on|off truehd-control-6ch=on|off truehd-control-8ch=on|off
the presentation's control-enabled bit (what it gates is not given)
truehd-heavy-drc-start-up-gain=-32..31
truehd-drc-start-up-gain=-64..63
the two DRC start-up gains (6 and 7 bits, signed)
Probe options (probe): json=, detail=¶
probe options (probe; any order, after the positional arguments):
json=1 emit the JSON document instead of the human table
(schema iclforge.probe/1 - docs/forge/cli/commands.md)
detail=frames add a per-access-unit dump: offsets, sizes, CRC,
substream headers and each frame's object layer
detail=blocks the same, plus every block's coding tools and
exponent strategies - what a codec bug report needs
json=1 is a value token rather than a bare word (unlike couple or heavy) because probe is
the first command here whose output form is a choice: json=0 is accepted and means the table,
so a script building its command line programmatically (json=$want) never has to omit the token
to turn it off. The document it emits is a versioned contract — see
Commands → probe for the schema, the compatibility rules and
the units each field is in.
detail= is independent of json=: all four combinations work, and the two detail levels add to
the stream summary rather than replacing it — the same summary comes out either way.
detail= |
What it adds |
|---|---|
| (omitted) | Nothing. The stream summary alone, which is what a pipeline or a CI gate wants |
frames |
One entry per access unit: byte offset, size, start time, and each syncframe's own header, CRC state, authenticity tag and object layer |
blocks |
The same, plus per syncframe: Table E1.3's frame-level tool gates, and per block which coding tools were in force and what exponent strategy each coded stream carried |
A dump of a long file is a lot of output, which is why neither is on by default — but it costs no
extra memory, because each access unit is written as the walk reaches it rather than collected
first. See Commands → probe for what the block dump
looks like and why it exists.
Defaults¶
Optional positional arguments, when omitted:
silence,sine,eac3-silence,eac3-sine— 5 s at 192 kbps; the tone commands default to 1000 Hz at 50% amplitude, and the three that take[layout]default tostereo.orbit— 8 s at 448 kbps, 4 s per orbit.atmos— 8 s at 448 kbps, 4 objects, 6 s per orbit.encode,eac3-encode,ac4-encode— 192 kbps;atmos-encode,atmos-cbi,atmos-adm,atmos-iab— 448 kbps;atmos-path— 8 s at 448 kbps, with as many objects as its scene file describes.record— 5 s at 192 kbps from device 0.live— 10 s at 192 kbps.fmp4— 48 frames per fragment.play,monitor,spatial— device-1, the default output.transcode— 448 kbps (192 for AC-4), and the source's own layout (folded to 5.1 when the target cannot code it).cut— from 0 s to the end of the stream.
What the encoder accepts¶
- WAV sample rates: AC-3 takes 32, 44.1 or 48 kHz (Table 5.6); E-AC-3 additionally takes the
Annex E
fscod2half rates 16, 22.05 and 24 kHz; AC-4 takes 48 or 44.1 kHz. - AC-3's bit rate must be one of the 19 nominal rates (Table 5.18), 32 through 640 kbps. E-AC-3
signals its frame size directly, so
eac3-encodetakes rates off that table, up to what an 11-bitfrmsizcan signal (1024 kbps a substream at 48 kHz) and down to what holds the coded channels; the encoder says which limit a rate broke. AC-4 takes 8 to 3 000 kbps, and refuses a rate that cannot hold a substream's least frame. record(andlive mode=channels) encodes ontolayout=—stereoby default, anything up to 7.1.4 — and places the endpoint's channels onto it by direction, not by index: a device narrower than the layout leaves the rest silent, a wider one folds down per §7.8. Seelayout=andcodec=.- The E-AC-3 Atmos commands take 1 to 15 objects — the bed's LFE is the 16th, and TS 103 420
§8.3.2.2 caps the total at 16. With
codec=ac4an object stream holds 64 objects at most, one of them an LFE object, at 2 048 samples a frame.
Command-specific notes¶
transcode/metadata/normalize/cut/catwork on an already-encoded stream rather than on PCM — see Commands → Stream tools for what each carries across and what it deliberately does not. Onlytranscodere-encodes. Every metadata option above that a stream tool does not name is ignored by it, the same waymkvignores all of them.mkvreads format, packet boundaries, sample rate and channel count from the bitstream itself, so it cannot be told the wrong ones. E-AC-3 dependent substreams are grouped into their access unit and counted as the channels they render.spdifwraps an already-encoded AC-3, E-AC-3 or AC-4 file's IEC 61937 bursts as a 16-bit PCM WAV, playable bit-exactly (100% volume, no mixing) into an S/PDIF or HDMI output to light up a receiver's Dolby Digital indicator. It detects the codec from the stream itself (bsid, or AC-4's sync word); E-AC-3's carrier runs at four times the content sample rate (WASAPI's ownmake_eac3_formatconvention), which is legal though unusual for a plain PCM16 file. The WAV is two channels, except that an AC-4 stream needing the HBR16 burst goes out as eight. The GUI's S/PDIF container option is this same command, run automatically as the second half of a two-command encode — see GUI → Format & channels.atmosencodes objects orbiting the room at different heights and rates as a 5.1 E-AC-3 bed plus JOC + OAMD side data (TS 103 420); FFmpeg reports the result as "Dolby Digital Plus + Dolby Atmos".atmos-encodedoes the same but makes each channel of a real source file an object instead of synthesizing motion. Its optional[paths.txt](same formatatmos-pathreads) authors that motion instead of the default static, fanned-out placement — keyed by WAV channel index, so an object index the file doesn't mention keeps its default placement unchanged. Withcodec=ac4,atmos-encodewrites the objects as AC-4 objects instead (see AC-4 objects from a WAV).atmosmode:objects(default) writes the JOC+OAMD container;bed51omits it so the 5.1 bed still plays on a decoder that would otherwise refuse an object container it can't validate, instead of falling back to the bed on its own.bed51drops the TS 103 420 §8.3.1addbsiobject marker with it, so abed51stream reads as ordinary 5.1 E-AC-3 all the way out: noAtmos complexityline fromscan, no Atmos extension in thedec3boxfmp4builds, noCHANNELS="<N>/JOC"in its playlists, and no "+ Dolby Atmos" from FFmpeg. See Atmos & JOC for why a decoder can tell the difference at all.sign-objects(withsigning-key=<path>): signs the object container's EMDF protection tag so a validating decoder reconstructs the objects instead of playing the bed. Honored byatmos,atmos-path,atmos-encodeandatmos-cbi;atmos-admandatmos-iabdo not take it, and an AC-4 object stream (codec=ac4) has no such container to sign, so it is refused there. Off unless you pass both —sign-objectsalone with no key is an error. The key may also come fromICLFORGE_SIGNING_KEY_FILE/ICLFORGE_SIGNING_KEYinstead ofsigning-key=. The key is never stored by the tool; the algorithm is in-tree but the key is yours to provision. Full details in Object signing.fast-mdct=off: every encode runs the §7.9.4 fast forward MDCT by default (the quality evidence that made it the default: ~3e-12 max relative coefficient error against the direct form, 331 dB direct-vs-fast end-to-end SNR, 0.000 dB SNR delta against an independent oracle at 192–448 kbps — seetools/ci/quality_race.py fast-mdct).fast-mdct=offforces the direct §8.2.3.2 reference form — the validation oracle — wherever the command encodes, including theatmos*,record,live,eac3-sineandeac3-encode(both its single-source and itssrc=/map=multi-source path).eac3-encodealso has a second spelling: the barenofastmdcttoken inside its[tools]positional argument reaches the same field, and wins overfast-mdct=offif both are given on the same command line. Typingtools=nofastmdctas if it were a trailing option does not parse, since any=token goes to the options parser, which has notoolskey. The fast MDCT is not a coding tool, sonone/allleave it alone.eac3-silencehas no use for either spelling: it builds a silent access unit directly, with no forward transform in the loop to choose a path for. The barefast-mdctword and thefastmdcttool token — the opt-in spellings from when this defaulted off — still parse and now name what already happens.fast-imdct=off: the decode-side mirror.decoderuns §7.9.4 step 3 — the inverse transform's one O(N²) part — through an FFT by default. The FFT (libs/dsp/include/iclforge/dsp/detail/fft_stockham.hpp, the family's one) is radix-4 throughout, ending on a single radix-2 pass only where log2(P) is odd — P = 128 and P = 512, not P = 64. The quality evidence that made the fast path the default, measured on the radix-4/2 kernel it replaced: 7.8e-14 max peak-normalized relative error against the direct evaluation at the transform level, and over 180-second real-material decodes 214.9 dB SNR agreement for AC-3 / 284.7 dB for E-AC-3, with decodes 4.5–4.7× faster.fast-imdct=offforces the pseudocode's own direct sum — the reference form, and the oracle the fast path's tests validate against. Applies to both codecs; theqc,levelsand playback decoders stay on the library default, where a difference that small cannot move a reported figure. Encoded output never depends on this switch: the encoder's own internal inverse-transform uses are pinned to the direct form regardless. The barefast-imdctword — the opt-in spelling from when this defaulted off — still parses and now names what already happens.mode=performance|reference: the two switches above as one statement of intent.mode=referenceturns both fast paths off — the forward MDCT wherever the command encodes and the step-3 inverse indecode— so the whole run uses the spec's own direct evaluations: the forms the standard states, the forms every fast-path test validates against, and the forms to reach for when two runs must agree bit-for-bit with the spec's stated arithmetic (comparing against an external reference decoder sample-for-sample, regenerating validation fixtures, chasing a suspected transform defect).mode=performance— the default state, so passing it changes nothing — names the fast paths: coefficients within ~3e-12 of the direct forward transform and 7.8e-14 of the direct inverse, encodes measurably faster and decodes 4.5–4.7× faster. Tokens apply in order, somode=reference fast-mdct=offis redundant but harmless, andmode=performance fast-imdct=offruns a fast encode with a reference decode.eac3-encode's[tools]positional still wins the forward-MDCT half if both are given, exactly as it does againstfast-mdct=off.joc-domain=qmf|mdct: which domain JOC's reconstruction matrix is estimated in (onatmos,atmos-pathandatmos-encode) and applied in (ondecode).qmf— the default — is TS 103 420 §7.1's 64-subband complex filterbank, which is what §6.6.6 describes and what a licensed decoder runs.mdctselects the 256-bin MDCT approximation this project used before it had a filterbank: cheaper on the encode side, but about 5 dB worse per object (22.8 dB against 27.7–28.6 dB mean per-object SNR over four placements; 20.2 dB against 26.5 dB on moving objects), and correct only against a decoder given the same token. Use it to reproduce output from before 0.9.0, not for new material. Unlikefast-mdct=off/fast-imdct=offthis is not part ofmode=in either direction: those two are the same answer computed two ways, agreeing to ~3e-12 or better, while these are different answers — see Atmos & JOC. Note that the two domains do not have the same latency, so adecodewriting objects withobjects_dir=gets them 576 samples behind the bed underqmfand 256 behind undermdct.verify:eac3-encodeonly. Runs the encoder/decoder mirror self-check (iclforge::ac3::verify, see Validation) over every access unit the command emits: each one is decoded with this project's own decoder as soon as it is encoded, and the decoder's model of it — per-substream, per-block bit offsets, decoded exponents,bap, delta correction, AHT gain mode and gains, and the coupling, enhanced-coupling and spectral-extension coordinates — is diffed against the encoder's own. The first disagreement refuses the run (exit 1) and names where the two sides parted company, down to the substream, block, coded stream and bin:
error: verify: the encoder and decoder disagree about access unit 0
frame 0 substream 0 block 2 channel 1: bap[10] encoder=8 decoder=9
A clean run prints one extra line beside the usual summary and writes exactly the stream it
would have written anyway — the check reads state the encoder already has and never steers a
decision. Off by default because it decodes everything it encodes, which roughly doubles the
work. What it buys is the class of defect a round trip cannot see: the two sides differing in
a way the audio survives. That matters most for ecpl, tpn, fscod2 and 714, which have
no external decoder to check against at all — see
Validation → where the oracles don't reach.
encode (AC-3) has no equivalent token yet; its half of the same facility is library-only
(iclforge::ac3::verify::MirrorEncoder).
- keep-partial: encode, eac3-encode and atmos-encode refuse a frame that cannot fit the
configuration mid-run just as they always have, but with keep-partial given, whatever frames
were already encoded before that point are written to <name>.partial.<ext> (out.ec3 →
out.partial.ec3) rather than discarded — the run still exits non-zero and prints the same
error either way, only what happens to the frames already produced changes. Off by default, the
same as every other bare token here; a plain invocation with no keep-partial behaves exactly
as it always has. Mirrors the GUI's own keep-partial-output setting (see
GUI → window layout) rather than a separate idea — the same
.partial. naming either way, so a file produced by either front end is named alike.
Next¶
Concepts → Atmos & JOC if any of JOC, OAMD, or the object/bed
relationship above are unfamiliar; Spatial & Atmos objects for
the library-level API these commands are thin wrappers over.