Commands¶
The command list from the usage text, reproduced rather than paraphrased — 50 commands, as
a Windows build without -DICLFORGE_BUILD_ADM=ON prints them. The two ADM commands read
UNAVAILABLE HERE because that flag is off; spatial does not, because Windows is the one
platform with a spatial backend. Nothing in the build compares this block against the binary, so
forge help on your own build is the authority wherever the two disagree:
Forge — the ICL Forge encoder tools: clean-room AC-3 / E-AC-3 (ATSC A/52) and AC-4 (ETSI TS 103 190) encoder/decoder, and a TrueHD / MLP lossless encoder/decoder
Usage:
forge --version print version and git provenance, then exit
forge help [<command>|exit-codes] this list, or one command's own help
forge silence <out.ac3|out.thd> [seconds] [bitrate_kbps]
forge sine <out.ac3|out.thd> [seconds] [bitrate_kbps] [freq_hz] [amp_pct] [layout]
forge orbit <out.ac3> [seconds] [bitrate_kbps] [orbit_seconds]
forge atmos <out.ec3> [seconds] [bitrate_kbps] [objects] [orbit_seconds] [mode]
forge atmos-path <out.ec3> <paths.txt> [seconds] [bitrate_kbps] [objects] (objects driven by an authored scene file instead of the built-in orbit)
forge atmos-encode <in.wav> <out.ec3|out.ac4|out.mp4> [bitrate_kbps] [objects] [paths.txt] (every source channel as an object; optional: authored per-object motion from a scene file (same formats as atmos-path), objects it doesn't mention keep their default placement; with codec=ac4, AC-4 objects (A-JOC, or coding=direct) in a raw stream or an MP4 file)
forge atmos-adm <in.adm.wav> <out.ec3|out.ac4> [bitrate_kbps] [programme_id] (UNAVAILABLE HERE)
forge atmos-iab <in.iab|in.mxf> <out.ec3|out.ac4> [bitrate_kbps] (UNAVAILABLE HERE)
forge atmos-cbi <in.wav> <out.ec3> [bitrate_kbps] [layout] (a channel-based-immersive bed (Dolby's dee_ddpjoc_encoder --input-format cbi_wav shape) straight to DD+ JOC E-AC-3 with program.bed != 0 and 0 dynamic objects; layout is one of 5.1.4, 7.1.4, 9.1.6 (default: inferred from the file's channel count))
forge lyrics-to-lrc <in.lrc|in.srt|in.ass|in.kar> <out.lrc> (write a lyrics file as the UTF-8 LRC every player reads, whatever its format, with a duet's singers, word times and the gaps between cues; lyrics-encoding=<page> reads a file in a code page (windows-1252, shift-jis, gbk, ...). Never over the file it reads, and over another file only with overwrite=1)
forge strip-objects <in.ec3> <out.ec3> (remove the JOC/OAMD object layer from a DD+ stream, leaving a bit-identical 5.1 bed)
forge record <out.ac3|out.ec3|out.ac4> [seconds] [bitrate_kbps] [device_index] (capture straight to a file; layout=/codec=/container= decide its shape, codec=ac4 encoding AC-4)
forge live <out.ac3|out.ec3|out.ac4> <capture_device> [seconds] [bitrate_kbps] [monitor_device] [passthrough_device] [mode] (capture -> encode -> live monitor and/or passthrough; codec=ac4 encodes AC-4, which its monitor decodes and a receiver gets as a 5.1 AC-3 leg)
forge encode <in.wav> <out.ac3> [bitrate_kbps] [layout] [in2.wav] (in2.wav: layout 1+1's Ch2, when Ch1 is a separate mono file; or use src=/map= for more than one source)
forge eac3-silence <out.ec3> [seconds] [bitrate_kbps] [layout]
forge eac3-sine <out.ec3> [seconds] [bitrate_kbps] [freq_hz] [amp_pct] [layout]
forge eac3-encode <in.wav> <out.ec3> [bitrate_kbps] [tools] [layout] [vbr] [in2.wav] (in2.wav: layout 1+1's Ch2, when Ch1 is a separate mono file; or use src=/map= for more than one source. programme2= (up to programme8=) is a different thing entirely - another independent E-AC-3 substream (its own layout/bitrate/dialnorm and metadata via programmeN-layout=/-bitrate=/-<field>=), not another channel of this one)
forge ac4-encode <in.wav> <out.ac4|out.mp4> [bitrate_kbps] (mono, stereo, 5.0, 5.1, 5.0.4 or 5.1.4 at 48 or 44.1 kHz, in the WAV order decode writes, to AC-4: raw sync frames with CRC, or an MP4 with the 'ac-4' sample entry when the output is .mp4/.m4a/.mov. In 5.X, ASPX_ACPL_3 (a Lo/Ro downmix and A-CPL) below 22.4 kbps a channel and ASPX_ACPL_2 (downmixes of each side and C, and A-CPL) below 33.6; the ASPX codec mode (A-SPX above a crossover, with companding at the lower rates in mono and stereo) below 96 kbps a channel, 76.8 in 5.X, and SIMPLE from there. 5.1.4 takes the immersive element in ASPX_ACPL_2 below 480 kbps, ASPX_SCPL below 640 and SCPL from there, as DEE's 5.1.4 streams do. The options below set the codec mode, the frame rate, the rate mode, the I-frames, the CRC, and the loudness, DRC, downmix and dialogue enhancement metadata; substreamN= and presentationN= add substreams, each an input of its own, and the presentations that play them; syntax-trace=<file> writes what the encoder writes)
forge truehd-encode <in.wav> <out.thd|out.mkv|out.mp4|out.ts> (1 to 8 channels of 16 or 24 bit PCM at 44.1, 48, 88.2, 96, 176.4 or 192 kHz, with the speakers the WAV's channel mask names, or in the order decode writes them (L R C LFE Ls Rs Lrs Rrs) when it has none, to a lossless TrueHD stream (src=, map= and offset= place the channels of several WAVs by TrueHD channel name: map=0.0:L,0.1:R,1.0:C,2.0:LFE,2.1:Ls,2.2:Rs): bare, or in Matroska, MP4 or a Blu-ray transport stream when the output is .mkv, .mp4 or .ts. Decoding it gives the samples back, bit for bit, and so does FFmpeg's strict decode. Each restart interval (truehd-restart=, 128 access units by default) is coded whole, with FIR prediction (truehd-fir-order=), a pair matrix where it helps (truehd-matrix=) and the shortest of three codebooks or raw residuals; the 2, 6 and 8 channel presentations are a stereo and 5.1 downmix of the source with truehd-downmix=standard (truehd-downmix-gains=), and the first two channels and so on as they are with none. The stream is kept within truehd-peak-rate= (18000 kbit/s, Blu-ray's) and TH spec section 18's 75 ms, or truehd-rate-check=lenient writes it anyway and counts the violations; verify decodes every access unit as it is coded and compares it with the input. 24 bit input is coded as 24 bit and 16 bit input as the same samples with their clear low bits sent as an output shift)
forge truehd-atmos <objects.wav|master.adm.wav> <out.thd|out.mkv|out.mp4|out.ts> [paths.txt] (2 to 16 channels of 24 bit PCM at 48, 96 or 192 kHz (the two higher rates are provisional: no Dolby tool has been shown to read the object metadata there, the bed is 7.1 at all three, and the metadata frame stays 1536 samples), or an ADM master (BW64; needs -DICLFORGE_BUILD_ADM=ON, its LFE first and then its beds and objects, on the paths it gives them), as the object channels of a TrueHD Atmos stream: substream 3 (restart sync 0x31EC), the first channel the LFE (truehd-objects-lfe=off: all objects), beside a 7.1 bed in substreams 0 to 2 (truehd-bed=<7.1 WAV>, or the objects placed on 7.1 by the renderer from the same metadata) and the objects' positions in the evolution frames of the access units, one frame every 1536 samples. paths.txt is atmos-path's scene file for the objects after the LFE; the others stand in an even fan around the room. Decoding it with truehd-presentation=all gives the object channels back, bit for bit, and the best presentation the bed. Nothing outside this project reads substream 3, so the stream is provisional and unsigned, and a licensed decoder may not accept it (libs/truehd/ERRATA.md entries 61 to 64). The other truehd-* options are truehd-encode's)
forge ac4-sign <in.ac4> <out.ac4> content-key=<path> content-chain=<path> [publisher-uuid=<uuid>] (append a content signature (ECDSA P-256, Thrift-serialised, with the certificate chain) after the last sync frame of a raw AC-4 stream, making a signed copy. The key and chain are the operator's own; none is built in. The sync frames are not touched, so a signed file plays as the unsigned one. An MP4 is refused: CS spec v2.6 puts signing one out of scope. publisher-uuid= (your publisher account's UUID), publisher-name=, product-id=, product-name=, wrapper-name=, os-name=, os-version= and os-description= say who signed and where; leaf-title= and signed-date= adjust what is written and checked)
forge ac4-verify <in.ac4> [trust-anchor=<path>] [pin=<fingerprint>] (check a raw AC-4 stream's content signature: the digests, the ECDSA signature, the chain and its validity, and the leaf's title. Exit 0 only when it is valid and a trust-anchor= or pin= vouches for its certificates (unanchored-ok accepts one that checks but has no anchor); check-content prints the checks and exits 0 whatever they find, judging the certificates at the signed date unless verify-time= says otherwise; verify-content also refuses a signature whose signer nonce or publisher UUID is not as CS spec v2.6 section 5.3 asks (expect-publisher-uuid= names the publisher accounts to accept; the UUID is not in the certificate))
forge decode <in.ac3|in.ec3|in.ac4|in.thd|in.mlp|in.mkv|in.mp4|in.ts> <out.wav> [objects_dir] [adm_out] (AC-3, E-AC-3 or AC-4, bare or inside a container; the stream decides. AC-4: every layout up to 7.1.4 and the immersive element in every codec mode; a presentation with A-JOC or direct-coded objects renders them to the output's speakers as coded (7.1.4 by default), and syntax-trace=<file> writes what the decoder reads. objects_dir: export each object's own PCM as its own object_NN.wav there - JOC-reconstructed for E-AC-3 Atmos, D10's decoded objects for AC-4. adm_out (needs -DICLFORGE_BUILD_ADM=ON): write a Dolby Atmos Master ADM Profile BW64 there (for E-AC-3 its objects; for AC-4, every bed and dynamic object with its own decoded Annex F properties) - bed/LFE channels pinned to their speaker, dynamic objects positioned by their own timeline. For TrueHD, truehd-presentation=all gives objects_dir each channel of substream 3 and adm_out its beds and objects (provisional, libs/truehd/ERRATA.md entry 61), and another presentation gives adm_out its bed alone)
forge probe <in.ac3|in.ec3|in.ac4|in.thd|in.mlp|in.mkv|in.mp4|in.ts> [json=1] [detail=frames|blocks] (inspect AC-3/E-AC-3 layout, substreams, metadata, objects, tools and CRC, or AC-4 TOC/presentations/substream groups, or a TrueHD/MLP stream's substreams, rate and parity and CRC checks (detail= is not read for it), bare or inside a container, and what the container says of its track; table or documented JSON)
forge transcode <in.ac3|in.ec3|in.ac4|in.thd|in.mlp> <out.ac3|out.ec3|out.ac4> [bitrate_kbps] [layout] (decode and re-encode, carrying dialnorm, compr and the mix metadata across - the DD+-to-DD path for optical and AC-3-only HDMI sinks - or between AC-4 and AC-3 or E-AC-3 either way: an AC-4 presentation, chosen as decode chooses one, becomes the programme, decoded without DRC and re-encoded with its drc_eac3_profile, dialnorm and downmix values; an AC-3 or E-AC-3 source's dialnorm and downmix values go to AC-4, and drc= names its DRC profile. The output codec comes from the output name's suffix, or from codec=; the bitrate defaults to 448 kbps, or 192 for AC-4)
forge metadata <in.ac3|in.ec3|in.thd> <out.ac3|out.ec3|out.thd> (rewrite dialnorm/compr/bsmod/dsurmod on an existing stream and re-stamp its CRCs; the audio is copied through untouched, not re-encoded. A TrueHD stream's channel meaning (TH spec section 14: dialogue norm, mix level, source format and control bit per presentation, and the two DRC start-up gains) is set in every major sync, with its CRC, from truehd-dialnorm-6ch= and the options like it; provisional, no oracle until the DEE set)
forge normalize <in.ac3|in.ec3|in.thd> <out.ac3|out.ec3|out.thd> (measure BS.1770-4 loudness and write the dialnorm it implies (ATSC A/85 §8), audio untouched. A TrueHD stream: each presentation's loudness (BS.1770-5 Annex 3) sets that presentation's dialogue norm in every major sync; no gain is applied, since the stream is lossless; provisional, no oracle until the DEE set)
forge cut <in.ac3|in.ec3> <out.ac3|out.ec3> [start_seconds] [duration_seconds] (extract on access-unit boundaries; nothing is re-encoded)
forge cat <out.ac3|out.ec3> <in1> <in2> [in3...] (join streams end to end (output FIRST, since the input list is variadic); refuses inputs whose codec, rate, layout or substream shape differ)
forge levels <in.wav|in.ac3|in.ec3|in.ac4|in.thd|in.mlp|in.mkv|in.mp4|in.ts> (per-channel peak/RMS report; an AC-4 presentation as coded; TrueHD and MLP as decoded (truehd-presentation=, truehd-check=))
forge loudness <in.wav|in.ac3|in.ec3|in.ac4|in.thd|in.mlp|in.mkv|in.mp4|in.ts> (BS.1770-4 loudness -> dialnorm, beside a stream's own: an AC-3 or E-AC-3 stream's first programme, or an AC-4 presentation as coded, in AC-4's steps of 0.25 dB; a TrueHD or MLP stream's integrated loudness and true peak (BS.1770-5 Annex 3 weights; truehd-presentation=, truehd-check=))
forge qc <in.ac3|in.ec3|in.ac4|in.thd|in.mlp|in.mkv|in.mp4|in.ts> [preset=<name>|all] [layout=bed|rendered] [objects=<71|512|514|714>] (bitstream-aware loudness QC: measured loudness vs. embedded dialnorm/compr, optional preset gate, optional BS.1770-5 Annex 4 object re-render; an AC-4 presentation as coded, against its dialnorm and the loudness it states; a TrueHD or MLP stream's integrity gate (lossless check, CRCs and parity, TH spec section 18's data rate) and the loudness of each presentation beside its dialogue norm, the preset judged on truehd-presentation= (the largest by default); exit 6 when a gate fails)
forge spdif <in.ac3|in.ec3|in.ac4|in.thd> <out.wav> (IEC 61937 wrap as playable PCM16 WAV, one programme of a multi-programme E-AC-3 stream (programme=); AC-4 in IEC 61937-14's bursts; TrueHD in MAT bursts (an eight-channel WAV, or the raw bursts when the output is not .wav))
forge unspdif <in.wav|in.raw|-> <out.ac3|out.ec3|out.ac4|out.thd|-> (the inverse: recover the elementary stream from IEC 61937 bursts, as captured from an S/PDIF or HDMI input or written by 'spdif'. '-' pipes either end)
forge project <project.forgeproj> [out] [print] (encode what a Forge project file says, by running the commands it stands for: the line the Forge GUI's command bar shows for the same settings. out is where the result goes (beside the project, named for it, by default); print shows the commands and runs none of them)
forge mkv <in.ac3|in.ec3|in.thd|in.mlp> <out.mkv> (wrap as a playable Matroska file (A_AC3, A_EAC3 or A_TRUEHD); AC-4 is refused, Matroska registering no codec ID for it)
forge mp4 <in.ac3|in.ec3|in.ac4|in.thd|in.mlp> <out.mp4> (wrap as playable MP4 with dac3/dec3 for AC-3/E-AC-3, dac4 for AC-4 or 'mlpa'/'dmlp' for TrueHD and MLP)
forge fmp4 <in.ac3|in.ec3|in.ac4|in.mkv|in.mp4|in.ts> <out_dir> [frames_per_fragment] (fragmented MP4/CMAF + HLS/DASH manifests, ready for a packager; fallback-51 also writes an object-stripped 5.1 companion rendition. AC-4 as TS 103 190-2 Annex H has it: each fragment starting at an I-frame, the timescale Table E.1 gives, the ca4m and ca4s brands and the DASH descriptors of Annex G)
forge ts <in.ac3|in.ec3|in.ac4|in.thd|in.mlp> <out.ts> [dvb|atsc|bluray] (wrap as MPEG-2 TS; AC-4 supports DVB only; TrueHD and MLP are Blu-ray's stream_type 0x83 (profile bluray, the default for them))
forge demux <in.mkv|in.mp4|in.ts> <out.ac3|out.ec3|out.ac4|out.thd> (the inverse of 'mkv': unwrap the elementary stream a container carries. The container is identified by its own magic bytes, not by the file name. From a transport stream, an output named .thd or .mlp takes its TrueHD track, whatever other audio tracks come first in the programme; any other name takes the first track it can read)
forge remux <in.mkv|in.mp4|in.ts> <out.mkv|out.mp4|out.ts> [dvb|atsc|bluray] (container-to-container: the input is identified by its magic bytes, the output by its extension, and everything either declares is re-derived from the bitstream - the dec3-repair case. A .ts output without a profile is DVB for AC-3, E-AC-3 and AC-4, and Blu-ray for TrueHD and MLP, which only bluray carries)
forge devices (input and loopback capture endpoints)
forge outputs (render endpoints + AC-3/E-AC-3 passthrough support)
forge identify [device_index] [layout] [seconds] [routing] [level_db] (walk the identify tone across an output's speakers - pink noise on one rendered channel at a time, placed by the routing patch, so a room's wiring can be heard (layout "-" is the device's own speakers; routing 1,0,2,3,4,5 swaps the front pair))
forge play <in.ac3|in.ec3|in.ac4|in.mkv|in.mp4|in.ts> [device_index] (exclusive-mode IEC 61937 passthrough, following the sink (bsid decides the source format; a named device that rejects it gets an automatic AC-3/PCM fallback - follow=off for the plain refusal). AC-4, which no receiver takes over IEC 61937 yet, is decoded and played as PCM, as 'monitor' plays it)
forge monitor <in.ac3|in.ec3|in.ac4|in.mkv|in.mp4|in.ts> [device_index] (decode and play on an ordinary (non-bitstreamed) output; a TrueHD or MLP stream too, with truehd-presentation=, its channels sent in the output's speaker order when each has a speaker of its own - a 7.1 stream's side surrounds and rears are swapped to the 7.1 mask's order - and as the stream carries them when one has none)
forge spatial <in.ec3> [device_index] (decode the object layer onto Windows Spatial Sound - dynamic objects at their OAMD positions, the bed's LFE static (Windows spatial object renderer))
forge help [<command>|exit-codes] (one command's own arguments and grammars, not the whole manual)
forge man (the generated groff man page, on stdout)
forge completions <bash|zsh|fish|powershell> (the generated completion script for that shell, on stdout)
By category¶
Synthesis — generate a stream from nothing¶
No source file needed; useful for smoke-testing a build or a receiver without recording anything first.
| Command | What it writes |
|---|---|
silence |
Silent AC-3; with a .thd output, silent TrueHD (stereo) |
sine |
A tone, one per speaker, AC-3. Append c to [layout] (e.g. stereoc) to turn on channel coupling. With a .thd output it is TrueHD, coded losslessly: the layout is mono, stereo, 51 or 71, the first channel carries freq_hz and each later one a quarter higher, and the bit rate and the metadata options have no meaning and are refused by name. |
orbit |
AC-3 with a synthetic panned source circling the room (exercises the spatial layer — plain bed panning, no object metadata) |
atmos |
E-AC-3 with synthetic orbiting Atmos objects — a 5.1 bed plus JOC + OAMD side data (TS 103 420) |
atmos-path |
Same, but object motion comes from an authored scene file (keyframe columns or JSON) instead of the built-in orbit |
The scene file atmos-path reads (and atmos-encode's optional [paths.txt], below) comes in
two forms, told apart by whether its first non-whitespace character is { — not by its suffix,
so either works wherever the other does:
- Keyframe columns, the original: plain text, one keyframe per line as whitespace-separated
columns
object_index time_s x y z gain lfe_send;#starts a comment and blank lines are skipped. Unchanged, including its diagnostics. It is still what the GUI's timeline exports by default — see GUI → Objects & motion. - An object scene in JSON, the
iclforge::objects::oba::ObjectSceneform: named objects, a bed assignment, per-segment interpolation (hold,linear,smooth) and a scene orientation, none of which the columns have anywhere to put. Documented in Library → Spatial & Atmos; the GUI writes it when you save the export under a.jsonname.
Positions are room-anchored per TS 103 420 §4.2.1: x runs 0 at the left wall to 1 at the
right, y 0 at the front wall to 1 at the back, z -1 at the floor to +1 at the ceiling.
Between two cues a value is interpolated (linearly, unless the JSON form says otherwise); before
the first and after the last it holds, so an object sits still rather than extrapolating or
going silent. An object index the keyframe file never mentions keeps that command's own default
placement — room centre for atmos-path, that channel's fanned-out static position for
atmos-encode.
Five seconds at 50% amplitude, 384 kbps, one tone per coded channel — 14 of them for a 7.1.4 layout, though only 12 reach speakers: the two bed channels the dependent substreams replace carry tones a full decoder never renders. (The 1000 Hz argument applies only to a one- or two-channel layout; anything wider gets a distinct spread of per-channel frequencies instead, so a misrouted channel is identifiable by ear.)
File encoding — real audio in, a stream out¶
| Command | What it does |
|---|---|
encode |
WAV → AC-3. Without [layout], follows the source: the speakers its WAVE_FORMAT_EXTENSIBLE header states (FL FR BC is 2/1, FL FR FC BC is 3/1, decode writes them from three channels up so its own output encodes back into its mode), or, for a file that states none, its channel count (1→mono, 2→stereo, 3–6→5.1); a wider source is refused, since no AC-3 coding mode is wider than 3/2 + LFE. |
eac3-encode |
WAV → E-AC-3, with the Annex E tools: token and an optional vbr: token available (see Options & grammars). Without [layout], follows the source: the speakers its WAVE_FORMAT_EXTENSIBLE header states, or, for a file that states none, its channel count (1→mono, 2→stereo, 3–6→5.1, 8→7.1, 10→5.1.4, 12→7.1.4). |
atmos-encode |
WAV → E-AC-3 Atmos, every source channel becomes its own object; optional [paths.txt] drives per-object motion from an authored scene file the same way atmos-path does, keyed by WAV channel index — an object it doesn't mention keeps its default (fanned-out) placement. With codec=ac4 it writes AC-4 objects instead: see AC-4 objects from a WAV below |
atmos-cbi |
WAV already mixed into a fixed channel-based-immersive (CBI) bed layout → E-AC-3 Atmos with program.bed != 0 and 0 dynamic objects — Dolby's dee_ddpjoc_encoder --input-format cbi_wav shape, not free-floating objects |
truehd-encode |
WAV → lossless TrueHD: 1 to 8 channels of 16 or 24 bit PCM at 44.1 to 192 kHz, as a bare .thd or, for .mkv, .mp4 or .ts, in Matroska, MP4 (mlpa) or a Blu-ray transport stream. A WAV's channel mask names its speakers, so a 5.1 or 7.1 file in WAV order is coded as the channels it carries. See TrueHD and MLP below |
truehd-atmos |
The channels of a WAV (2 to 16, the first the LFE, at 48, 96 or 192 kHz; 96 and 192 kHz are provisional, see the 96/192 kHz note), or an ADM master's (its LFE first, then its beds and objects, on the paths it gives them; needs -DICLFORGE_BUILD_ADM=ON) → a TrueHD Atmos stream: a 7.1 bed in substreams 0 to 2 (a WAV given with truehd-bed=, or the objects placed on 7.1 by the renderer), the channels in substream 3 and the objects' positions in the evolution frames, from an optional scene file or an even fan. Provisional: nothing outside this project reads substream 3. See TrueHD and MLP below |
ac4-encode |
WAV → AC-4: mono, stereo, 5.0, 5.1, 5.0.4 or 5.1.4 (7.0, 7.1, 7.0.4, 7.1.4 and 3.0 experimental), at 48 kHz at every frame rate of Part 1 Table 83 or at 44.1 kHz at the native one, as raw sync frames with their CRC (or without, crc=off) or, for .mp4, .m4a or .mov, an MP4 file with the ac-4 sample entry and its dac4. The codec mode follows the rate: SIMPLE from 96 kbps a channel (76.8 in 5.X), the ASPX mode below, in 5.X the A-CPL modes lower still, and in the immersive layouts ASPX_ACPL_2, ASPX_SCPL and SCPL by the rate. The frame rate, the rate mode, the I-frames, the metadata, and further substreams and the presentations that play them are options: see ac4-encode below |
448 kbps, channel coupling on, layout inferred from the WAV: its stated speakers, or its channel count when it states none.
1+1 (dual mono — two independent programmes, never inferred from a channel count, so it always
has to be named explicitly) takes its two channels either as one two-channel file or as two mono
ones:
forge encode both.wav out.ac3 192 1+1 # Ch1/Ch2 = channels 0/1 of both.wav
forge encode narration_en.wav out.ac3 192 1+1 narration_fr.wav # Ch1, Ch2 as separate files
See Options & grammars for dialnorm2= — Ch2's own dialnorm, alongside
the usual dialnorm=.
encode, eac3-encode, ac4-encode, truehd-encode, atmos-encode and atmos-cbi all take - in place of
<in.wav> or the output path to mean stdin or stdout (the other commands that take it are listed
under Conventions), so a pipeline never has to touch
a temporary file:
The status text these commands normally print (frame count, routing, per-channel levels,
dialnorm=auto's measurement line) goes to stderr instead of stdout whenever the output side is
-, so it never ends up inside the piped stream — src=/map= multi-source runs included.
bed_714.wav's 12 channels are read in iclforge::objects::oba::bed_labels()'s own Table 12 order — L, R, C,
LFE, Ls, Rs, Lb, Rb, Tfl, Tfr, Tbl, Tbr for 7.1.4 — which is also Dolby's own cbi_wav channel
order (confirmed against a real DEE-produced 5.1.4 stream; 7.1.4/9.1.6 extend it by the same
Table 12 rule, unverified against DEE itself). [layout] is one of 5.1.4, 7.1.4, 9.1.6 and
defaults to whichever one matches the file's channel count (10, 12 or 16) when omitted. Unlike
atmos-encode, every channel is anchored to its speaker label rather than free-floating, so there
is no [paths.txt] argument and dialnorm=auto is refused for the same reason it is on
atmos-adm/atmos-iab below — see Atmos & JOC and
Spatial & Atmos objects.
ac4-encode¶
A WAV file's channels are taken in the order decode writes them: FL FR FC LFE BL BR for 5.1, the
surrounds in BL and BR; 5.1.4 adds the top front pair (TFL TFR) and then the top back pair (TBL
TBR), and 5.0.4 is the same without the LFE. The layout is the channel count: 1 mono, 2 stereo, 5
and 6 5.0 and 5.1, 9 and 10 5.0.4 and 5.1.4 (ETSI TS 103 190-2's immersive element with its back
pair absent, which is how DEE writes 5.1.4). The experimental options below name the other layouts
the encoder writes: 7.0 and 7.1, 7.0.4 and 7.1.4, 3.0, and 22.2 (24 channels).
Codec mode. Below 96 kbps a channel the ASPX codec mode: the spectral frontend up to a crossover of 7.5, 10.5 or 13.5 kHz by rate, A-SPX above it, and companding below 64 kbps a channel; in 5.X below 76.8 kbps a channel (384 kbps for 5.1), with DEE's 5.1 crossovers of 12 and 12.75 kHz and no companding; the SIMPLE mode from there. In 5.X, lower still, the A-CPL modes, which code a downmix and rebuild the channels from it: ASPX_ACPL_2 below 33.6 kbps a channel (168 kbps for 5.1), the downmixes of each side's pair and C, and ASPX_ACPL_3 below 22.4 (112 kbps for 5.1), a Lo/Ro downmix, as DEE's 5.1 streams are at 128 and 96 kbps; where the rate cannot hold that mode's least frame, the next of ASPX_ACPL_2 and ASPX that it can. The rate must hold a silent I-frame with every metadata element the options send: at the native frame rate from 8 kbps (9 in stereo at 48 kHz in the ASPX mode) and, in 5.X, from 13 kbps by default (14 in ASPX_ACPL_3, 15 in ASPX), more at the higher frame rates and with more metadata.
The immersive layouts choose by the rate over 5.1.4's nine full-band channels, as DEE's 5.1.4
streams do: ASPX_ACPL_2 below 480 kbps (53.3 kbps a channel), which codes L, R and C and the sum of
each coupled pair and rebuilds each pair by A-CPL; ASPX_SCPL below 640 kbps (71.1), which codes
each pair's sum and difference with simple coupling and A-SPX from 12.75 kHz; and SCPL from there,
simple coupling over the whole band. codec-mode= picks one whatever the rate: auto (the
default), simple, aspx, aspx-acpl-1 (with experimental=acpl), aspx-acpl-2,
aspx-acpl-3 (5.0 and 5.1 alone), scpl, aspx-scpl and aspx-ajcc (with
experimental=ajcc); the last three are the immersive layouts' alone. An encode names the mode it
used on its second summary line.
Experimental. experimental= takes a comma-separated list of the tools no reader outside this
project has read from the encoder yet: aspx-balance, aspx-varvar, aspx-interleave,
coding-configs (the 5.X element's coding configurations 1 to 3 and 2ch_mode 1), acpl (with
codec-mode=aspx-acpl-1, ASPX_ACPL_1 in 5.X and the immersive layouts, which also codes each
side's difference from its downmix to 3 kHz; with aspx-acpl-1 or aspx-acpl-2, A-CPL in stereo),
ajcc (with codec-mode=aspx-ajcc, the immersive layouts coded through A-JCC's 5.X core) and
drc-gains-0 to drc-gains-3 (the DRC modes send gains in that drc_gains_config of Part 1
Table 163); 7x-back, 7x-wide or 7x-top-front, which takes seven or eight channels as 7.0 or
7.1 in that 7.X layout, in the WAV order decode writes: 3/4/0's back pair in BL and BR and its
surrounds in SL and SR, 5/2/0's wide pair last, 3/2/2's top front pair in TFL and TFR;
back-pair, which takes 11 and 12 channels as 7.0.4 and 7.1.4, with Lb and Rb; nine-x-4, which
takes 13 and 14 channels as 9.0.4 and 9.1.4, the immersive element with the screen pair Lscr and Rscr
(SCPL, ASPX_SCPL and ASPX_ACPL_2 by the rate, and with acpl ASPX_ACPL_1; it refuses ajcc, dialogue
enhancement and height-downmix=, and its thirteen tracks make the stream md_compat 7, which
decode takes with md-compat=7); three-zero, which takes three channels, L R C, as 3.0, the
dialogue of a music and effects presentation (below);
noise-fill, which sends each scale factor band that quantises to zero a noise level (Part 1
5.1.4: its own energy in 3 dB steps, from the level before it) that the decoder fills with noise,
and so trades some SNR for a spectrum without holes at a low rate; hfr-2 and hfr-4, the
efficient high frame rate mode (Part 2 5.1.3): with frame-rate= 47.95 to 120 (hfr-4 from 100)
the encoder codes at half or a quarter of that rate (Table 18) and sends each frame as two or four
transmission frames, which a decoder joins again; a constant rate only; twenty-two-two, which
takes 24 channels as 22.2, the element of ETSI TS 103 190-2 clause 6.2.4.3 (below); and objects,
which
objects=<scene file> needs.
22.2. With experimental=twenty-two-two, a 24-channel WAV file is written as the 22.2 channel
element: two LFE tracks and eleven channel pairs, in the SIMPLE and ASPX codec modes
(codec-mode=simple or aspx). The channels are taken in the order decode writes a 22.2 stream
in: L R C LFE (FL FR FC LFE), Lb Rb Cb (BL BR BC), Ls Rs (SL SR), Tc Tfl Tsl Tfc Tfr Tsr Tbl Tbc Tbr
(TC TFL TSL TFC TFR TSR TBL TBC TBR), then LFE2, Bfl, Bfr, Bfc, Lw and Rw. The default codec mode is
ASPX below 76.8 kbps a full-band channel (1 690 kbps over the 22 of them) and SIMPLE from there. The
A-CPL, S-CPL and A-JCC modes, the stereo and height downmix values, dialogue enhancement and DRC
gains are refused for it. The rate must hold the element's least frame: 17 kbps in SIMPLE and 49 in
ASPX at the native frame rate (15 and 45 at 44.1 kHz), more at the higher frame rates, and the
encoder's refusal names a rate that cannot. A decoder takes the presentation at md-compat=7
(22 tracks, Part 2 Table 55). An MP4 file carries it with a dac4.
Objects. With experimental=objects, objects=<scene file> takes the WAV file's channels as the
objects of one object substream, written as a raw stream. The scene file is text, one directive a
line, # starting a comment; channels count from 0, and one the file does not name is a dynamic
object at the room's centre. It is written in the library's terms (iclforge::ac4::ObjectsConfig, iclforge::ac4::ObjectProperties);
reading ADM BWF, IAB and object scenes into them belongs to the applications (atmos-encode,
atmos-adm and atmos-iab below write AC-4 objects from those). An object stream reads
frame-rate=, rate-mode=, iframe-interval=, crc=, dialnorm= (a number, not auto),
codec-mode=simple or aspx and syntax-trace=; the other options are not read.
| Directive | What it sets |
|---|---|
coding ajoc or coding direct |
An A-JOC substream (the default) or direct-coded object substreams |
downmix computed, 5.0 or 5.1 |
A-JOC's downmix: computed signals, or a static bed |
downmix-signals <n> |
The computed downmix's signals |
decorrelation on or decorrelation off |
A-JOC's decorrelators |
object <channel> dynamic <x> <y> <z> [<gain dB>] |
A dynamic object where it starts: X, Y 0 to 1, Z -1 to 1 |
object <channel> bed <L\|R\|C\|Ls\|Rs\|Lb\|Rb\|Tfl\|Tfr\|Tsl\|Tsr\|Tbl\|Tbr\|Lw\|Rw> [<gain dB>] |
A bed object on that loudspeaker |
object <channel> lfe |
The LFE |
update <channel> <sample> <ramp> <x> <y> <z> [<gain dB>] |
The object moves there from that input sample over <ramp> samples (0 to 2 048) |
Frame rate and rate mode. frame-rate= is one of Table 83's rates, 23.976, 24, 25,
29.97, 30, 47.95, 48, 50, 59.94, 60, 100, 119.88 or 120, or native, the
default: 2 048-sample frames, the only ones at 44.1 kHz. Away from the native frame rate the
input is converted to the frame's internal rate, and each frame decodes to the samples Part 2
clause 5.11 gives it: at 29.97 fps 1 601 and 1 602 in turn. rate-mode=constant, the default,
gives every frame the rate's share; average lets frames lend each other bytes within the
decoder's input buffer (Part 1 clause 6.2.4), with wait_frames telling a decoder how long to
wait; variable lends up to two seconds' share.
I-frames. iframe-interval=<frames> (default 24) makes every so many frames an I-frame,
iframes=<n,...> names frames, from 0, that are I-frames besides, and fragment=<seconds> makes
the first frame of each fragment of that length one, for a packager that cuts there. An MP4 file
lists the I-frames as its sync samples, and counts 29.97, 59.94 and 119.88 fps in a time scale of
240 000 (Part 2 Table E.1); mp4 does the same for an AC-4 stream it is given.
Loudness and DRC. dialnorm= is the dialogue level in dB below full scale, 0 to 31.75 in
steps of 0.25, or auto to measure it. loudness=<practice>, one of atsc-a85, ebu-r128,
arib-tr-b32, freetv-op59, manual, consumer-leveller and not-indicated, measures the
programme with the BS.1770 meter and sends its integrated loudness, loudness range, true peak and
highest momentary and short-term loudness with that practice, and sets dialnorm from it where
dialnorm= is not given. drc=<profile>, one of film-standard, film-light,
music-standard, music-light, speech and none, sends Table 161's four DRC decoder modes on
that profile; drc-home-theatre=, drc-flat-panel-tv=, drc-portable-speakers= and
drc-portable-headphones= give one mode a profile of its own, sent as its curve or as a repeat
of an earlier mode on the same profile.
Downmix, 5.X, 7.X and the immersive layouts. cmixlev= or lorocmixlev= is the Lo/Ro
downmix's centre gain, +3, +1.5, 0, -1.5, -3, -4.5 or -6 dB or off; surmixlev= or
lorosurmixlev= its surround gain, 0, -1.5, -3, -4.5 or -6 dB or off; ltrtcmixlev= and
ltrtsurmixlev= Lt/Rt's where they differ. lfemix= is the LFE's gain into the downmix, +5.5 to
-25.5 dB in steps of 1 dB, and dmixmod= the preferred downmix, loro, ltrt, pl2 (Lt/Rt for
Pro Logic II) or none. loro-correction= and ltrt-correction= are each downmix's loudness
correction, -7.5 to +7.5 dB in steps of 0.5. A layout with fewer than five channels has no such
downmix, and the encoder refuses these options for it. The immersive layouts (5.0.4, 5.1.4, 7.0.4,
7.1.4) take them for their stereo downmix and add a second downmix, to 5.X, which they send as TS
103 190-2's custom downmix data in the I-frames, as DEE does: height-downmix=front puts both top
pairs into L and R, surround both into Ls and Rs, and front-and-surround the top front pair
into L and R and the top back pair into Ls and Rs. height-gain= is the gain the top channels go
in at, 0, -1.5, -3 (the default), -4.5, -6, -9 or -12 dB, or off, and needs
height-downmix=.
Dialogue enhancement. dialogue-channels= marks which of l, r and c carry dialogue
alone, whose parameters are then 1 in every band; dialogue-stem=<wav> gives the dialogue, in the
programme's channels and sample for sample, and each band's parameter is its share of the channel.
dialogue-method=independent, the default, raises each channel; mid raises the Mid of L and R;
cross, with a stem over two or three channels, raises a mix of the channels that follows the
dialogue and pans it back as the dialogue is panned. dialogue-max-gain= caps what a decoder may
add: 3, 6, 9 (the default) or 12 dB. dialogue-hybrid=<0..1> makes the method a hybrid one: a
dialogue enhancement substream carries the dialogue itself as a waveform, that share of the
enhancement, and the parameters raise it by the rest (Part 1 clause 5.7.8.9); substreamN-enhances=
below names that substream.
Substreams. Without the options below the output is one substream in one presentation, with
presentation_id 0 and the md_compat level its layout needs. The input is substream 1, and
substream2=<wav> up to substream32= add more, each an input of its own layout at the input's
rate and length. substreamN-<option>= sets substream N's own values:
| Option | What it sets |
|---|---|
substreamN-bitrate=<kbps> |
Its share of the rate; the substreams without one share the rest by their full-band channels |
substreamN-codec-mode= |
Its codec mode, as codec-mode= (which is substream 1's) |
substreamN-content= |
Part 1 Table 91's content classifier: main, music-and-effects, visually-impaired, hearing-impaired, dialogue, commentary, emergency or voice-over |
substreamN-language=<tag> |
Its BCP 47 language tag, with a classifier to carry it |
substreamN-dialogue-...= |
Its dialogue enhancement, as the dialogue- options above (which are substream 1's) |
substreamN-max-dialogue-gain= |
A dialogue substream's cap on how far a listener may raise it, 3, 6, 9 or 12 dB |
substreamN-pan=<degrees>[,<degrees>] |
Where a mono dialogue's channel sits, or each of a stereo one's two, clockwise from the front: 330 is L, 30 R |
substreamN-emdf=<id>:<hex> |
An EMDF payload its metadata carries in every frame, repeated for more; the id from 1 |
substreamN-enhances=<M> |
In place of an input: this substream carries the waveform of substream M's hybrid dialogue enhancement |
Presentations. Several substreams need presentations to play them. presentationN=<substreams>,
N from 1 to 64, lists the substreams a presentation plays, from 1, in the order of Part 2 Table 53's
positions, and presentationN-<option>= sets its own values:
| Option | What it sets |
|---|---|
presentationN-config= |
Table 53's configuration: 0 music and effects with dialogue, 1 main with dialogue enhancement, 2 main with associated audio, 3 music and effects with dialogue and associated audio, 4 main with dialogue enhancement and associated audio, 5 roles by each substream's classifier, 6 EMDF payloads alone, which plays no substream; unset for one substream |
presentationN-id= |
Its presentation_id, unset for the least no other presentation takes |
presentationN-md-compat= |
Its level, 0 to 3 or 7 (Table 55), not below what its tracks need |
presentationN-enabled=, -pre-virtualized= |
on or off |
presentationN-name= |
An alternative presentation of this name, up to 31 bytes |
presentationN-dialnorm= |
Its own dialogue level, as dialnorm= |
presentationN-gains=<dB>,... |
Each substream's group gain, 0 to -15.5 dB in steps of 0.25, or off |
presentationN-main-gain=, -main-centre-gain=, -main-front-gain= |
The main audio's scaling beside associated audio, 0 to -76.2 dB in steps of 0.3, or off |
presentationN-associated-pan= |
Where mono associated audio sits, in degrees |
presentationN-emdf=<id>:<hex> |
An EMDF payload in an EMDF payloads substream the presentation names |
The bare options set every presentation's values: the loudness, DRC and downmix values, the last
going to the presentations of 5.X and 7.X. dialnorm=auto and loudness= measure one programme,
so they take one substream. The encoder refuses what does not go together, naming the rule. An MP4
file's dac4 describes every presentation (Part 2 Annex E.10); a presentation of configuration 6
has no field for the presentation_id a CMAF track asks of each, so fmp4 refuses a stream that
has one.
Output. A raw stream's sync frames carry Part 2 Annex G's CRC unless crc=off; an MP4
sample is the raw frame alone. syntax-trace=<file> writes every syntax element the encoder writes,
one per line. The summary names the codec mode, the frame rate and the rate mode, and how far the
decoder's output lags the input, to the nearest sample away from the native frame rate.
forge ac4-encode in.wav out.mp4 128 frame-rate=29.97 rate-mode=average iframe-interval=15
forge ac4-encode in_51.wav out.ac4 384 loudness=ebu-r128 drc=film-light dmixmod=loro dialogue-channels=c
forge ac4-encode me_51.wav out.mp4 448 substream1-content=music-and-effects \
substream2=english.wav substream2-content=dialogue substream2-language=en \
substream3=german.wav substream3-content=dialogue substream3-language=de \
presentation1=1,2 presentation1-config=0 presentation2=1,3 presentation2-config=0
Lyrics beside the stream: lyrics=¶
lyrics=<file> on encode, eac3-encode and ac4-encode puts a lyrics file beside the stream as
its own, so that what Forge makes is a stream and its words. The file may be an .lrc, a SubRip
.srt, an Advanced SubStation Alpha .ass or a MIDI karaoke .kar, in UTF-8 or UTF-16. What is
written is <stream>.lrc (the stream's name with the extension replaced), the one format
Hearth finds by name and sends to every sink: UTF-8, with a duet's V1:
and V2: markers and the singers' names, word times where the file has them (an ASS script's
karaoke syllables, a MIDI file's), and a time with no text where a cue ends before the next one
begins, so that the gap is not shown as the line going on. Styling and positions are not carried.
The file is read before the encode, so a file that is not lyrics is refused first, with exit code
2. A file in a code page (Latin-1, Windows-1251, Shift-JIS and the like) is not guessed at either:
it is refused until you say which page it is in with lyrics-encoding=<page>, and then it is read
in that page and written as UTF-8. A .lrc of that name already beside the stream is left as it
was, and the run says so. - as the output has no name to put a file beside and is refused (exit
code 1).
lyrics-encoding= takes the name of the page: windows-1252 (Western European), iso-8859-1,
iso-8859-15, cp850, cp437, windows-1250 and iso-8859-2 (Central European),
windows-1251, koi8-r and koi8-u (Cyrillic), windows-1253 (Greek), windows-1254 (Turkish),
windows-1255 (Hebrew), windows-1256 (Arabic), windows-1257 (Baltic), windows-1258
(Vietnamese), windows-874 (Thai), shift-jis and euc-jp (Japanese), gbk and gb18030
(Simplified Chinese), big5 (Traditional Chinese) and euc-kr (Korean). The common spellings of
each are read as well (cp1252, latin1, Shift_JIS, sjis, gb2312), in any case. The
conversion is the operating system's own (Windows' code pages, iconv elsewhere), so Forge carries
no table of any page. A file that is UTF-8 or UTF-16 is read as it is whatever page is named, and
bytes the named page does not have refuse the file (exit code 2) and are not replaced by a mark. It
goes with lyrics=, and is a usage error (exit code 1) without it.
forge encode backing.wav sing-along.ac3 384 L,C,R,Cs src=melody.wav src=lead.wav \
map=0.0:L,0.1:R,1.0:C,2.0:Cs bsmod=voiceover lyrics=words.srt
# writes sing-along.ac3 and sing-along.lrc
A lyrics file as UTF-8 LRC: lyrics-to-lrc¶
forge lyrics-to-lrc <in> <out.lrc> is the conversion lyrics= does, with no stream and no encode,
to a path you choose. Use it where the stream already exists and its lyrics file is the problem: a
karaoke .kar or an .lrc in a code page that Hearth or Crucible refuses by name, an .srt or
.ass you want as the one format every player reads. What is written is UTF-8 LRC with a duet's
V1:/V2: markers and names, word times where the file has them, and a time with no text where a
cue ends before the next begins; styling and positions are not carried.
lyrics-encoding=<page> names the code page of an input that is not UTF-8 or UTF-16, from the same
list lyrics= takes (see above), and without it such a file is refused with the exit code 2 and
the page to name. The file read is never the file written, even with overwrite=1, so a code-page
song.lrc is converted to another name and then moved over it when you are satisfied; a file that
is already at the output is left as it was (exit code 3) unless overwrite=1 is given. Standard
input and output are refused (exit code 1): there is no name to read or write.
forge lyrics-to-lrc song.lrc song.utf8.lrc lyrics-encoding=windows-1251
forge lyrics-to-lrc duet.kar duet.lrc lyrics-encoding=shift-jis
ADM ingest — professional master files (opt-in)¶
Only runnable in a build with -DICLFORGE_BUILD_ADM=ON — but always listed, the same
"a command a build cannot run is shown, not hidden" treatment the live-audio commands below get
(see that section's own note): a default build's usage block at the top of this page shows this
row as UNAVAILABLE HERE instead of the description below, and running it prints a clear reason
(forge atmos-adm ... → error: 'atmos-adm' is unavailable on this platform: this build was not
configured with -DICLFORGE_BUILD_ADM=ON ...) rather than "unknown command". Three things in the
tool need iclforge::adm, this project's sole opt-in, Boost-requiring module
(default off — see ADM / BW64 reading): this command,
atmos-iab below, and decode's optional adm_out argument. Everything else builds and works
identically whether that flag is on or off. What the row looks like in a build configured
with the flag on (the usage block at the top of this page is from a default build, where
this row instead reads UNAVAILABLE HERE):
forge atmos-adm <in.adm.wav> <out.ec3|out.ac4> [bitrate_kbps] [programme_id] (a real ADM BWF master (BS.2076-2 ADM XML + BW64/RF64, ADM BWF reader) straight to DD+ JOC E-AC-3 (default) or, with codec=ac4, to an AC-4 A-JOC or direct-coded object substream (coding=ajoc, the default, or coding=direct); every bed/object channel the resolved audioProgramme names becomes a dynamic object, driven by the file's own authored automation - no scene file needed. Only in builds with -DICLFORGE_BUILD_ADM=ON)
| Command | What it does |
|---|---|
atmos-adm |
A real ADM BWF master (professional delivery format Netflix's and Apple's own Atmos ingest pipelines require) straight to DD+ JOC E-AC-3 — no WAV, no hand-authored keyframe file: iclforge::adm::build classifies every channel as a bed speaker feed or a dynamic object and builds its own iclforge::objects::oba::ObjectPath straight from the file's authored BS.2076-2 §10.3 position/gain automation, driven frame by frame the same way atmos-encode drives an authored [paths.txt]. With codec=ac4, every bed/object channel becomes an AC-4 dynamic object instead (A-JOC by default, coding=direct for direct-coded object substreams), its position sampled once a frame (frame_rate_index 13 is the object substream's only rate) |
448 kbps, the file's lowest-ID audioProgramme (BS.2076-2 §5.8's own default-selection rule).
Pass a fourth argument to pick a different one by ID:
codec=ac4 writes AC-4 instead of E-AC-3, its objects A-JOC-coded unless coding=direct asks for
direct-coded object substreams:
forge atmos-adm master.wav out.ac4 256 codec=ac4
forge atmos-adm master.wav out.ac4 256 codec=ac4 coding=direct
forge decode out.ac4 out.wav objects_dir adm_out.wav
That decode line closes the round trip: objects_dir writes each object's own PCM, and
adm_out.wav (needs -DICLFORGE_BUILD_ADM=ON) writes a fresh ADM BWF master back out, its
objects' positions, gains and timing read from what the AC-4 stream's own Annex F metadata says.
The LFE. atmos-adm and atmos-iab do not make the master's LFE bed channel an object: the
stream has an LFE of its own (E-AC-3's, AC-4's LFE object), and the channel feeds it at the level it
was mixed. So the LFE does not take one of the fifteen object slots either: a 9.1.6 master, fifteen
speaker feeds and an LFE, fits, and the status line counts it once (15 bed speaker feed(s) + 0
dynamic object(s) + the bed's LFE = 16 objects). A stream has one LFE, so a master with two (LFE and
LFE2) has them added together, with a warning; a master of nothing but its LFE is refused, since an
Atmos stream needs a speaker feed or an object beside it.
AC-4 objects from a WAV¶
atmos-encode takes codec=ac4 too, and writes the objects it makes of a
WAV file's channels, or of src=, map= and offset=, as AC-4 objects: A-JOC-coded unless
coding=direct asks for direct-coded object substreams, a raw stream (with Part 2 Annex G's CRC
unless crc=off) or, for an .mp4, .m4a or .mov output name, an MP4 file.
GUI → Objects & motion echoes this command, and the
two write the same bytes.
forge atmos-encode stems.wav out.ac4 256 codec=ac4
forge atmos-encode stems.wav out.mp4 256 0 scene.json src=vo.wav \
map=0.0:obj,0.1:obj@-3,1.0:L,1.1:LFE offset=1:0.02 codec=ac4 coding=direct dialnorm=27
- Which channels are objects follows
src=/map=as it does for E-AC-3: eachobjrow its own object, anobjmrange folded to one, in that order. A channel mapped to a speaker is a dynamic object held at the speaker's place on the ring of radius 0.5 about the room's centre at its azimuth, the place ADM's polar coordinates give a bed channel, at unity; one mapped to an LFE is the stream's LFE object. These follow theobj/objmobjects inmap=order, the speakers' in source-then-channel order, the LFE last.[objects]is the E-AC-3 command's count of channels and stays 0 withmap=. - Motion comes from the scene file (
[paths.txt]), addressed by the dynamic objects' order above; an object it does not mention keeps the default placementatmos-encodegives it for E-AC-3. The stream takes one position update per object per frame, evaluated at the frame's end, at 2 048 samples a frame (frame_rate_index 13, the only rate an object substream is written at). A key's gain must be 0 or lie from +15 to -49 dB, and its place inside the room. - The limits are E9's writer's: 64 objects at most, one of them an LFE object, at 48 or
44.1 kHz, and at least one object that is not the LFE. A source shorter than the longest
is silent past its end, where
atmos-encode's E-AC-3 runs withsrc=hold each short source's last sample. - Options.
dialnorm=1..31sets the stream's dialnorm;dialnorm=autoandsign-objectsare refused (an object stream has no bed to measure and no EMDF container to sign), andcoding=andcrc=withoutcodec=ac4are refused rather than dropped.
dialnorm= works the same as every other encoding command (see
Options & grammars); dialnorm=auto does not — an ADM document's bed/object
channels have no single fixed layout to measure loudness against the way atmos-encode's WAV
input does, so atmos-adm refuses it with a clear error rather than silently keeping the default.
Every failure — a container/XML parse error (iclforge::adm::AdmError) or a graph-resolution error
(iclforge::adm::BridgeError, e.g. no audioProgramme, an unresolved reference, an unsupported
pack type) — prints a real diagnosis via that error's own describe(), never an opaque crash or a
bare non-zero exit.
See ADM / BW64 reading and ADM → Atmos bridging
for the parser and the mapping layer this command drives, and
examples/encode_adm.cpp
for the same pipeline as a minimal, standalone, self-fixturing program.
IAB ingest — Dolby Atmos cinema/IMF masters (opt-in)¶
Only runnable in a build with -DICLFORGE_BUILD_ADM=ON — the identical gate and the same
UNAVAILABLE HERE/clear-error treatment atmos-adm above gets, and for the same underlying
reason even though iclforge::iab itself is on by default: this command needs
iclforge::adm's own IAB mapping
(build_iab()), and that whole module rides ICLFORGE_BUILD_ADM (see
ADM / BW64 reading) since it PUBLIC-links iclforge::adm
alongside iclforge::iab. What the row looks like in a build configured with the flag on (the
usage block at the top of this page is from a default build, where this row instead reads
UNAVAILABLE HERE):
forge atmos-iab <in.iab|in.mxf> <out.ec3|out.ac4> [bitrate_kbps] (a real Dolby Atmos cinema/IMF master (SMPTE ST 2098-2 Immersive Audio Bitstream, a bare elementary .iab file or a real MXF Track File alike - IAB reader) straight to DD+ JOC E-AC-3 (default) or, with codec=ac4, to an AC-4 A-JOC or direct-coded object substream (coding=ajoc, the default, or coding=direct); every Bed channel/Object the file names becomes a dynamic object, driven by the file's own authored panning - no scene file needed. Only in builds with -DICLFORGE_BUILD_ADM=ON)
| Command | What it does |
|---|---|
atmos-iab |
A real Immersive Audio Bitstream (SMPTE ST 2098-2) master — a bare elementary .iab file or a real MXF Track File alike, sniffed automatically by its first byte — straight to DD+ JOC E-AC-3: iclforge::adm::build_iab classifies every Bed channel/Object and builds its own iclforge::objects::oba::ObjectPath from the file's own per-frame panning, driven frame by frame the same way atmos-adm drives an ADM master. codec=ac4/coding= work exactly as atmos-adm's own do |
The same command reads a real MXF Track File too, no different invocation:
dialnorm= works the same as every other encoding command (see
Options & grammars); dialnorm=auto does not — an IAB file's Bed/Object
channels have no single fixed layout to measure loudness against the way atmos-encode's WAV
input does, so atmos-iab refuses it with a clear error rather than silently keeping the default.
Every failure — a bitstream/MXF parse error (iclforge::iab::IabError) or a graph-resolution error
(iclforge::adm::BridgeError, e.g. a Table 19 ChannelID that is Reserved, or
essence that never resolved) — prints a real diagnosis via that error's own describe(), never an
opaque crash or a bare non-zero exit.
See IAB reading and
ADM → Atmos bridging for the parser
and the mapping layer this command drives, and
examples/encode_iab.cpp
for the same pipeline as a minimal, standalone, self-fixturing program.
Object-layer strip¶
| Command | What it does |
|---|---|
strip-objects |
Takes the JOC/OAMD object layer out of a Dolby Digital Plus stream without decoding it, leaving a plain DD+ 5.1 stream whose bed audio is bit-identical |
stripped 63 of 63 frame(s) in atmos.ec3 -> bed51.ec3 (7032 bytes removed, 105864 left)
3/2 + LFE at 48000 Hz, no object metadata remains
JOC's bed is the full mix — every object is already panned into it, which is what makes an
Atmos DD+ stream play on an Atmos-unaware decoder at all. So the 5.1 rendition of a JOC stream
needs no re-encode, only the object layer removed: the EMDF container in the per-block skip
fields and TS 103 420 §8.3.1's addbsi marker come out, frmsiz and crc2 are re-derived
around what is left, and every exponent and mantissa is copied bit for bit. Decoding the result
gives sample-identical PCM. See Object-layer strip
for what it does and does not touch.
The container is removed, not emptied — an empty container would still tell every downstream
signalling path (dec3's Atmos extension, an HLS CHANNELS="<N>/JOC" attribute) that objects
are present. The same goes for the addbsi marker on its own: a stream that signals objects it
does not carry gets that signalling removed too. A stream with no object layer at all is copied
through unchanged; an AC-3 stream is refused, since Annex E is where skip fields and substreams
live.
Rewritten frames are sized to their real content, so the output is smaller than the input and a constant-rate input does not stay constant-rate — the encoder's rate-filling auxdata padding goes along with the container. The reported byte count says how much.
This is what fmp4 … fallback-51 uses to write the paired 5.1 rendition Apple's HLS authoring
requirements ask for beside an Atmos one.
Decoding & inspection¶
| Command | What it does |
|---|---|
decode |
AC-3, E-AC-3 or AC-4 → WAV (an AC-3 or E-AC-3 stream of three channels or more is written with its speaker mask, so encode reads the file back as the coding mode it came from); the stream decides which decoder runs (for AC-4, mono, stereo, 3.0, 5.X and 7.X in the SIMPLE, ASPX and A-CPL codec modes, and 7.0.4 and 7.1.4 in every immersive codec mode, in full or core decoding and to the layout speakers= names, written in WAV speaker order, and of a stream of several presentations the one presentation=, language= and associated= choose, its substreams mixed; a presentation with A-JOC or direct-coded objects renders them to the output's speakers as coded, 7.1.4 by default). The input may be a Matroska/MP4/MPEG-TS container as well as a bare elementary stream, sniffed by content rather than by name — the same three readers demux uses. For an Atmos E-AC-3 stream or an AC-4 stream with objects, reports the object count found and, with objects_dir, exports each decoded object as its own object_NN.wav there — JOC-reconstructed for E-AC-3, D10's own decoded objects for AC-4. With adm_out (needs -DICLFORGE_BUILD_ADM=ON), also writes a Dolby Atmos Master ADM Profile BW64 there: for E-AC-3, the bed's LFE plus every JOC-reconstructed channel (a channel-based-immersive bed's channels pinned to their speakers, a dynamic object positioned by its own decoded OAMD automation); for AC-4, every bed and dynamic object with its own decoded Annex F properties |
probe |
What a stream declares, without rendering its audio: bsid, sample rate, layout, substream map, counts, duration, bit rate, metadata ranges, EMDF/OAMD/JOC, authenticity, per-frame CRC and coding-tool usage. Human table by default, or the iclforge.probe/1 JSON document with json=1. An AC-4 stream gets its table of contents, frame rate, bit rate, I-frames and splices, and each presentation with the metadata the decoder reads of it. The input may be a Matroska, MP4 or MPEG-TS container, sniffed by content: the report then also says what the container declares of the track (codec ID, sample entry or descriptor, time scale, language), in the JSON document as container, which is null for a bare stream |
levels |
Per-channel peak/RMS report — takes a WAV, a bare encoded stream, or a Matroska/MP4/MPEG-TS container carrying one; of an AC-4 stream, the presentation presentation= and the rest choose, as coded |
loudness |
BS.1770-4 gated loudness, reported as the dialnorm it implies: of a WAV; of an AC-3 or E-AC-3 stream's first programme, beside the dialnorm it carries; or of an AC-4 presentation as coded, in AC-4's steps of 0.25 dB, beside the stream's own. Bare or inside a container |
qc |
Bitstream-aware loudness QC: decodes an already-encoded AC-3, E-AC-3, AC-4 or TrueHD or MLP stream — bare, or inside a Matroska/MP4/MPEG-TS container — measures it with the real BS.1770-4/EBU Tech 3342 meter — the Table 5.8 bed by default, the whole rendered program with layout=rendered, or a dynamic-object-only programme's objects re-rendered onto a named layout with objects=<layout> (BS.1770-5 Annex 4) — and compares the result against the stream's own embedded dialnorm/compr and, optionally, a named delivery-spec gate. An AC-4 presentation is measured as coded (no output level, so no DRC) against its dialnorm and the loudness it states; layout= takes it too, and objects= does not (see below). One that decodes at 96 or 192 kHz is refused by name: the meter's K-weighting is made for 44.1 and 48 kHz |
decode takes - for either path too, the same convention the encoding commands above (and the
five stream tools below) use:
It decodes on the fast (FFT) inverse-transform path by default; mode=reference or
fast-imdct=off selects the spec's direct evaluation instead — see
Validation → Performance and reference modes
for what each mode is for, and Options & grammars for the token rules.
A stream carrying more than one programme (a second independent substream — a second language,
an audio description) is handled one programme at a time: decode, levels, qc, monitor,
spatial, play, transcode and spdif all take programme=<0..7>, and without it take the
first the stream carries while saying what else was there. See Options & grammars for
the token, and eac3-encode's programme2= for authoring such a stream. decode and monitor
can also mix an associated service (a description, a commentary) into the programme they decode,
with associated= — see
Options & grammars.
forge decode out.ec3 commentary.wav programme=1
forge monitor broadcast.ec3 associated=audio-description # the main with its description mixed in
For an Atmos stream, add objects_dir to also export each object's reconstructed audio:
Or add a fourth argument (objects_dir empty or not) to write an ADM BWF master instead —
positions come from the stream's own decoded OAMD, so master.wav round-trips through
forge atmos-adm (needs -DICLFORGE_BUILD_ADM=ON; without that flag an adm_out
on an E-AC-3 input is refused before the decode starts, exit 2, naming the flag):
The object export works for a bed programme too, which is what channel-based-immersive
third-party content is: a 7.1.4 bed carried in a 5.1 downmix exports its eleven non-LFE channels
(§6.3.2.2 never makes the LFE a JOC output), and the status report names them (bed [L R C LFE Ls
Rs Lb Rb Tfl Tfr Tbl Tbr] + 0 dynamic objects) rather than just counting them. The ADM master
holds a bed programme as well: each bed channel is a DirectSpeakers channel named by its Table 12
label and pinned at that label's position, beside the dynamic objects' own timelines, and the LFE
(which JOC bypasses) comes from the decoded bed. A programme with ISF objects, a second bed
instance, a Table 13 bed assignment or an LFE2 has no label for some channel, so it gets a warning
saying so and no master file written, while the WAV and objects_dir outputs of the same run are
unaffected. The report also names an OAMD trim element when one rides along, any oa_element
skipped because its id is unrecognised, and how many metadata update blocks a frame carries when
it carries more than one.
The output stage: channels=, downmix=, drcmode=¶
By default decode writes the channels the stream codes, at the level it codes them — which is
what a verification tool should do, and not what a listener wants. channels= turns on the §7.8
output stage:
forge decode surround.ac3 stereo.wav channels=2
forge decode surround.ac3 stereo.wav downmix=ltrt # implies channels=2
forge decode surround.ac3 mono.wav channels=1
channels=2 produces §7.8.1's Lo/Ro fold, downmix=ltrt §7.8.2's Dolby Surround compatible
Lt/Rt (whose surround sum really is phase shifted 90°, costing 63 samples of output delay;
ltrt-phase=off takes the sign-only matrix instead), and channels=1 §7.8's mono branch. The
matrix comes from the stream's own cmixlev/surmixlev or mixmdate levels, and §7.8.1's
normalisation means the fold can never be louder than the loudest coded sample. mix-lfe folds
the LFE in as well — §7.8 makes that optional and this decoder drops it by default.
karaoke (or karaoke=on) decodes an AC-3 or E-AC-3 karaoke stream - bsmod 7 with an acmod above
1/0 (Annex C, informative) - the way a karaoke-aware decoder with three outputs does. Such a
stream carries L and R (the music), a guide melody M where a centre would be, and one or two
vocal channels V1 and V2 where the surrounds would be (3/0 is L M R, 2/1 is L R V1, 3/1 is
L M R V1, 2/2 is L R V1 V2, 3/2 is L M R V1 V2). The output is L, C, R and then the LFE when there
is one: M at unity in the centre, a single V1 added to the centre, and a pair V1 and V2 added to
the left and the right, each vocal at the stream's own surround level (surmixlev, §5.4.2.5 -
under the programme provider's control, as Annex C intends) and the whole scaled down by the
largest output's sum, §7.8.1's way (Table C.2.2's 3/0 columns). A 3/0 stream is already that,
and a 2/0 one has nothing but L and R, so both decode as coded. At channels=2 or channels=1
the stereo or mono fold is Annex C's 2/0 reproduction - "any AC-3 decoder will produce the
appropriate output if it is set to perform an Lo, Ro 2-channel downmix" - so karaoke changes
nothing there, and downmix=ltrt is refused, since Annex C has no Lt/Rt. A stream that is not
karaoke is decoded as coded and the report says so; an AC-4 stream warns and ignores the option.
monitor takes it too and plays the same reproduction on the output (see below).
An E-AC-3 karaoke stream is reproduced the same way. A/52 carries its signalling field for
field - bsmod in infomdate (Table E1.2), read as Table 5.7 reads it - and defines no
reproduction for it; Dolby's decoder applies Annex C's to an E-AC-3 stream as it does to an AC-3
one, and this decoder does what it does, for a programme that is one independent substream
with no object layer. The vocals sit at the stream's Lo/Ro surround level, lorosurmixlev of
mixmdate (an E-AC-3 bsi has no surmixlev), and the melody at lorocmixlev in the 2/0 form;
where the stream sends no mixmdate both are -3 dB, which is what Dolby's decoder used. A
programme with a dependent substream (Annex E gives a dependent's channel map no vocal), or with
an object layer, is decoded as coded and the report says why. eac3-encode with bsmod=7 above
1/0 writes that mixmdate group whether or not mixmeta is given, its lorocmixlev and
lorosurmixlev taken from cmixlev= and surmixlev= (-4.5 and -6 dB by default, the level an
AC-3 karaoke stream is made at), so a player is told the level the author set and not left to
its own default; bsmod=7 on mono is Table 5.7's voice-over and on 1+1 a service Annex A and
Annex G prohibit, and both encoders write them as asked with a warning. This reproduction is this
project's by analogy with Annex C and by that decoder; a player built on FFmpeg flags the stream
as karaoke and plays the vocals from the surround channels, as it does an AC-3 one.
karaoke=none|v1|v2|v1+v2 is the karaoke-capable decoder (C.2.3.2, Table C.2.3): the same
reproduction with the listener choosing which vocals are heard rather than the stream's own
surmixlev. At the default layout it is L, C, R again - none leaves M alone in the centre, v1
or v2 adds that vocal to the centre, v1+v2 puts V1 into the left and V2 into the right at unity -
and at channels=2 or channels=1 it is the 2/0 reproduction: M at the stream's cmixlev, a single
vocal at 0.7 in both channels, a pair left and right at unity, with mono the two summed. Every
coefficient is scaled down together when an output's sum exceeds 1. karaoke=off (the default),
karaoke=on and karaoke=aware are the spellings of no reproduction and of the bare option.
forge decode sing-along.ac3 karaoke.wav karaoke # L C R: melody centre, vocals at surmixlev
forge decode sing-along.ac3 stereo.wav channels=2 # the 2/0 reproduction, Lo/Ro
forge decode sing-along.ac3 backing.wav karaoke=none # L C R with the vocals muted
forge decode sing-along.ac3 duet.wav karaoke=v1+v2 # V1 left, V2 right, melody centre
forge decode sing-along.ac3 lead.wav channels=2 karaoke=v1 # stereo with V1 in the middle
karaoke-melody=<dB>, karaoke-v1=<dB> and karaoke-v2=<dB> are Annex C.2.3's "additional
flexibility": the listener moves the level of each part of the capable decoder's reproduction against
Table C.2.3. 0 dB is the table as it stands (bit for bit), up to 12 dB louder, and -24 or off, the
bottom, mutes the part. They are the span, the units and the defaults of Hearth's sliders and of the
wire's karaoke_*_db keys. A part raised far enough lowers the others, because every output's
coefficients are scaled down together when their sum would pass 1 (§7.8.1's way). They are the
capable decoder's alone, so a level with karaoke bare, karaoke=off or no karaoke at all is
refused rather than quietly dropped, and a value outside the span is refused rather than clamped.
forge decode sing-along.ac3 sing.wav karaoke=none karaoke-melody=-6 # the guide melody 6 dB down
forge decode sing-along.ac3 lead.wav karaoke=v1 karaoke-v1=-12 # V1 a quarter as loud
forge decode sing-along.ac3 duet.wav karaoke=v1+v2 karaoke-v2=off # V1 only, on the left
monitor reproduces a karaoke stream the same way, and plays it: forge monitor sing-along.ac3
karaoke=none plays L, C and R (and the LFE) with the vocals out. The channels are laid out as the
3/0 mode they are, not as the 3/2 layout the stream codes, and on an output narrower than the
stream (a stereo endpoint, which monitor folds to unasked) the 2/0 reproduction is what plays.
The report says which. downmix=ltrt is refused with karaoke here as it is by decode.
play applies the choice where it decodes, which is its PCM fallback for an output that takes no
bitstream. Its bitstream legs, and spdif, hand the coded stream on without decoding it, so a
receiver reproduces it (as coded unless it is karaoke-capable): they accept karaoke and say, on
stderr, that it is not applied. spatial places an E-AC-3 stream's objects, has no karaoke bed to
reproduce, and says so.
downmix=auto lets the stream choose between the two stereo folds, the third option A/52
§D3.1.1 describes. The stream's preference is its dmixmod (Table D2.2): in AC-3's Annex D
xbsi1, or in E-AC-3's mixmdate. It is read once, from the first dmixmod the programme's
independent substream sends, and the choice is printed:
A stream that prefers Lt/Rt gets Lt/Rt. Everything else gets Lo/Ro: a stated Lo/Ro preference,
a stream that states none (00, or no dmixmod at all), and the reserved code 11. A/52:2018
Table D2.2 and ETSI TS 102 366 V1.4.1 Table D.1.1 both list 11 as reserved, and Annex E gives
E-AC-3's field the same table, so neither standard defines a further downmix for it; §D2.3.1.2
allows a decoder to read it as "not indicated". A later downmix=, channels=1 or
channels=as-coded on the same command line replaces auto.
drcmode= selects §7.7's two named consumer modes, each of which sets dialnorm normalisation
and which of dynrng/compr applies — unlike drc= and heavy, which are the individual
switches:
forge decode programme.ec3 out.wav channels=2 drcmode=line # §7.7.1
forge decode programme.ec3 out.wav channels=2 drcmode=rf # §7.7.2, overload-protected
drcmode=line puts dialogue at −31 dBFS. drcmode=rf applies each compr word with 11 dB on
top, which puts dialogue at −20 dBFS, and plays any syncframe without a compr word at line
mode's level — the same as the Dolby Reference Player's RF mode (see
RF mode's level).
AC-4 has a different model (ETSI TS 103 190-1 clauses 5.7.8 and 5.7.9): the decoder takes the stream's
dialnorm to an output level the system supplies, cutting or boosting by
2^((output level − dialnorm) / 6), and compresses in one of the DRC decoder modes the stream
configures. output-level=<dBFS> sets that level; without it decode writes the coded level.
At an output level, drcmode= names the mode: default (the default) takes the one Table 161
gives the level (home theatre from −31 to −27 dBFS, flat panel TV from −26 to −17, portable
speakers from −16 to 0), home-theatre, flat-panel-tv, portable-speakers and
portable-headphones name one, and off applies the level alone:
forge decode stream.ac4 out.wav output-level=-31 # home theatre
forge decode stream.ac4 out.wav output-level=-14 drcmode=portable-headphones
forge decode stream.ac4 out.wav output-level=-24 drcmode=off # the level, no compression
headphones says the listener is on headphones: at an output level in the portable range,
drcmode=default takes portable headphones rather than portable speakers, and of a stream's
presentations one rendered for headphones before it was encoded comes first.
dialogue-enhancement=<dB> raises the dialogue where the stream sends dialogue enhancement
parameters (clause 5.7.8), from 0 (the default, which leaves the output alone) to 12 dB, and never
beyond the cap the stream sets, 3, 6, 9 or 12 dB.
channels= and downmix= fold AC-4 by clause 6.2.17's matrices with the stream's own mix gains:
downmix=loro, ltrt and mono as named, and downmix=auto, or channels=2 alone, the method
the stream's preferred_dmx_method names (Lo/Ro where it names none). Lt/Rt takes its Pro Logic
II form where the stream prefers that; there is no 90-degree phase shift, which in AC-4 describes
processing before encoding. The LFE goes into the fold at the stream's lfe_mixgain, which
mix-lfe=off leaves out, and a 7.X stream folds to 5.X on the way. channels=5.1 stops there: a
7.X stream's extra pair folded into its 5.X channels by Table 219, and any other stream as coded.
forge decode stream.ac4 out.wav channels=2 mix-lfe=off # Lo/Ro or Lt/Rt without the LFE
forge decode stream_71.ac4 out.wav channels=5.1
monitor takes all of the same tokens, and additionally folds on its own initiative when the
output device renders fewer channels than the programme: playing 5.1 on a stereo endpoint
otherwise means whatever the platform's shared-mode mixer averages together, with none of the
stream's levels and none of §7.8.1's normalisation. An explicit channels=/downmix= always
wins, and a backend that cannot report its endpoint width leaves the audio alone.
AC-4 presentations: presentation=, language=, associated=¶
An AC-4 stream can carry several presentations of its substreams: music and effects with the
dialogue in one language or another, the main audio with audio description, and so on (ETSI TS 103
190-2 clause 4.8). decode decodes one of them, and monitor, play, qc, levels, loudness
and transcode choose theirs the same way, with the same options. presentation=<n> names it by
its position in the
table of contents and presentation-id=<id> by its presentation_id, which stays with the
presentation as the table of contents changes over time; otherwise language=<BCP 47 tag> and
associated=<service> say
what the listener wants, and decode takes the presentation that best meets them, the language
first, then the associated audio. With neither it takes the first presentation without associated
audio. A presentation the decoder cannot decode, one the stream disables, and one above the
decoder's compatibility level (md_compat) are never chosen, and the status output names the
presentation decoded:
forge decode broadcast.ac4 out.wav language=de
forge decode broadcast.ac4 out.wav associated=audio-description
forge decode broadcast.ac4 out.wav presentation-id=3
associated= takes visually-impaired, hearing-impaired and commentary (ETSI TS 103 190-1
Table 91's associated audio), and Table 92's services: audio-description,
audio-description-subtitles, spoken-subtitles and emergency-information.
md-compat=<0..7> sets the compatibility level the decoder claims, 7 by default: a presentation
whose md_compat is above it is not chosen (ETSI TS 103 190-2 Table 55). md-compat=3 chooses as a
receiver of DVB's and ATSC's floor level would.
A presentation of several substreams is mixed as ETSI TS 103 190-1 clause 6.2.16 gives, with the
stream's own gains and pans. dialogue-gain=<dB> sets the dialogue against the music and effects,
up to the maximum the stream allows (0 dB where it allows none, and at most 12), and
associated-gain=<dB>, 0 or less, the associated audio, except where the stream says that audio
was mixed in before encoding:
forge decode broadcast.ac4 out.wav language=en dialogue-gain=6
forge decode broadcast.ac4 out.wav associated=audio-description associated-gain=-6
AC-4 immersive: speakers= and decoding=¶
An AC-4 stream in 7.0.4 or 7.1.4 carries its channels in the immersive channel element, and says
which of them its source had: DEE's 5.1.4 streams are 7.1.4 streams whose back channels are
silent. decode writes the source's layout, 5.1.4 for those, and speakers= renders the element
to another by the channel renderer of ETSI TS 103 190-2 clause 5.10.2, with the stream's custom
downmix gains and its loudness correction for that layout: 5.1, 5.1.2, 5.1.4, 7.1, 7.1.2
or 7.1.4, the LFE where the stream has one. channels=2, channels=1 and downmix= go by the
renderer's 5.1 to the stereo fold above, and win over speakers=:
forge decode film_514.ac4 out.wav # 5.1.4, the source's layout
forge decode film_514.ac4 out.wav speakers=5.1 # the heights into the fronts and sides
forge decode film_514.ac4 out.wav speakers=7.1.4 # the silent backs as well
decoding=core decodes the element's core instead, 5.1.2, as a low-complexity decoder does (clause
4.7): the back channels folded into the sides and each top pair into one top channel, with less of
A-CPL's and A-JCC's work. Core decoding renders to 5.1.2 and 5.1 alone, so speakers= with top
channels gives 5.1.2 and without them 5.1. The other channel elements decode alike in both modes.
AC-4 objects¶
An AC-4 presentation of object audio, A-JOC or direct-coded objects, decodes to objects, each
with the position and gain its metadata sets. decode renders them to speakers through the layout
renderer Hearth plays E-AC-3's objects with: each object panned from its position and moving as its
metadata moves it, to the layout speakers=, channels= or downmix= names, and to 7.1.4 without
one. decoding=core decodes an A-JOC substream's core instead, its downmix signals as the objects.
An intermediate spatial format is rendered by the decoder itself (ETSI TS 103 190-2 clause 5.10.3),
to the same layouts.
forge decode ajoc.ac4 out.wav # 7.1.4
forge decode ajoc.ac4 out.wav speakers=5.1 # 5.1
forge decode ajoc.ac4 out.wav channels=2 # two channels
forge decode ajoc.ac4 out.wav decoding=core # the downmix's signals as the objects
decode's objects directory and ADM output take an AC-4 stream's objects as they take E-AC-3's,
beside the rendered file: objects_dir gets each object's own decoded PCM as object_NN.wav, and
adm_out (needs -DICLFORGE_BUILD_ADM=ON, as for E-AC-3) an ADM BWF master of every bed and
dynamic object with the properties (Annex F) it decoded, its bed and LFE objects on their
speakers and the dynamic ones on their own timelines. The status output says how many objects it
wrote. A presentation without objects writes no object_NN.wav, and an adm_out on it draws a
warning.
Each format's decode reads options the other's does not. Given an AC-4 stream, decode names
the AC-3 and E-AC-3 ones it was given (drc=, heavy, ltrt-phase=, fast-imdct, mode=,
programme=, bed-only, joc-domain=) in a warning and ignores them, and given an AC-3 or
E-AC-3 stream it does the same with AC-4's (output-level=, dialogue-enhancement=,
presentation=, presentation-id=, language=, dialogue-gain=, headphones,
md-compat= and AC-4's drcmode= names). associated= and associated-gain= are read by
both: an AC-4 stream's choose a presentation and its mix, an E-AC-3 stream's mix a second
programme into the first. The options that
promise what the other format cannot give stop the run: bap-census=, verify-objects and
gate-objects for AC-4, and channels=5.1 and syntax-trace= for AC-3 and E-AC-3.
TrueHD and MLP¶
decode, probe, levels and loudness read a TrueHD or MLP elementary stream (.thd, .mlp), from a file or from -, by
the major sync that follows its first access unit's header. decode writes a 24-bit PCM WAV with the channels in the order the stream carries them, and a channel
mask when that order is the WAV's own (5.1's is; a 7.1's is not, and the status line names the channels). A failed check
(check nibble, CRC, parity, lossless check) or a byte the reader skipped stops the decode with exit status 2;
truehd-check=lenient counts them (the status lines say how many) and goes on. truehd-presentation= picks the substreams read:
best (the default, substreams 0 to 2), 2ch, 6ch, 8ch or all; decode, levels and loudness take both options. decode alone takes truehd-reading= for scoring a provisional reading (seed-shr7-32, zero-histories, shift-by-position or fold-by-position: the other reading of a point the specification leaves open, libs/truehd/ERRATA.md question 101); given, the decode is expected to differ from the source or to fail its lossless check wherever the stream depends on the reading. probe describes the stream (json=1 adds a truehd
member) and exits 1 if a unit's header, directory, parity or CRC fails. TrueHD and MLP.
probe also shows the stream's channel meaning (TH spec section 14.1), of a TrueHD stream (an MLP stream's bytes at that place are not
described): a channel meaning line and, under it, one line each for the 2, 6 and 8 channel presentation (control-enabled bit, dialogue
norm as the number and as -n dBFS, mix level and, for 6 and 8 channels, source format; a presentation the stream has no substream for
says so) and one for the two DRC start-up gains; with json=1 a channel_meaning object under truehd (null for MLP) with
provisional, question, distinct_in_stream, heavy_drc_start_up_gain, drc_start_up_gain and presentations, an object keyed
2ch, 6ch and 8ch whose members are in_stream, control_enabled, dialogue_norm, dialogue_norm_dbfs, mix_level and (not for
2ch) source_format. The first major sync's values are shown, and distinct_in_stream (and a note line) says when the stream's major
syncs carry different ones. Provisional, no oracle until the DEE set: FFmpeg's streams hold zeros, so the numbers are the fields as
written and no unit is applied beyond the specification's -n dBFS for a dialogue norm (libs/truehd/ERRATA.md, questions 51 to 55).
When access units carry extra data, probe adds an evolution line (and an evolution object under truehd with json=1): how
many units carry it; how many pass the check nibble, the framing and the parity; how many read as an evolution frame under each of
the two readings of TH spec v3.6 section 15.4 (the EMDF container of E-AC-3, and the section to the letter) and how many of those
are clean (a payload, and only zero bits after the protection field); which payload ids the frames hold; for payload id 11, the
object audio metadata read by iclforge::objects: the object count, the bed channels, the number of dynamic objects and of update
blocks; how many units apart the frames come; and the first four bytes of the first frame (the container's version, key id and
the start of its first payload id). It prints metadata only. The protection bytes and any signature are not verified, and the report says so. The reading is
provisional: no stream the project holds carries an evolution frame (libs/truehd/ERRATA.md, "Atmos, spec v3.6", question 22), and
this report is the check to run on a real Atmos track.
probe of a TrueHD or MLP stream also reports, from the headers alone: the duration; the average bit rate and the largest unit's rate
against the peak rate the major sync declares, with the count of units that start before the unit ahead of them has arrived at that rate, by their own input_timing (TH spec
section 18; libs/truehd/ERRATA.md entry 99; rate_model under truehd); the presentations, with the speakers of each named (presentations);
the word length (MLP sends two; a TrueHD decode delivers 24-bit words and the stream does not say the source's depth); and the
restart spacing, the distance in units between one major sync and the next (restart_spacing). detail=checks decodes the stream,
the samples discarded, for the lossless check of every restart interval (lossless under truehd, with lossless.terminators, the stream's ending as qc judges it; null otherwise) and exits 1
when an interval fails: that is the cost of a decode, and the plain report stays a read of the headers. The truehd member keeps
its keys and gains these (owner question 8). The report is apps/shared/media/src/probe_truehd.cpp, which Hearth and the window can call.
detail=evolution, detail=structure, detail=format (both), detail=matrix and detail=rate are for the owner's check of a disc's stream and describe TrueHD and MLP
streams only (any other stream is refused, exit status 1). detail=evolution lists the first frames one by one (the extra data's check
nibble, framing and parity; the container's version, key id, each payload's id, size and configuration flags, the protection length
codes), groups all the frames by shape (the payload ids, the protection codes and the reading) with how many frames and how large, and for a
payload that is not the object audio metadata walks it as a Thrift Binary struct, printing field ids, types and lengths and never a value.
detail=structure prints the distinct major syncs (with the size of the channel meaning's extension), each substream's restart headers (the
sync, the 16 bits that end the fixed part as a histogram, the field ranges), and the result of decoding the whole stream, lenient, with
the samples discarded: the lossless checks, the units that failed, the matrices that bypass LSBs, and what follows the last block of each
substream's segments (terminators and the end marker). Nothing derived from the audio, no payload byte and no digest, certificate,
signature or protection byte is printed. libs/truehd/ERRATA.md ("Atmos, spec v3.6", section H) says which field answers which open
question.
detail=matrix (TrueHD and MLP) decodes the stream, lenient, and lists every block header that sends matrices or output_shift, in all four substreams and with no cap on the count, so a substream with none reads as none and never as cut off. It opens with a matrix line (the headers listed) and one line per substream (matrix sets, matrices, output_shift headers and how many of those hold a shift other than 0). Each header then prints its place (unit, sub, block in its segment, sample before it in the unit and whether it carries a restart header). An output_shift line gives the shift of each matrix channel with the output channel the restart header's ch_assign sends it to (m3->out5:-1); the decoder applies the values as sent. A matrix_set line gives the section (matrix channels, count, and for the object audio matrices whether it has the extension, sends coefficients and sends deltas), and a matrix line each matrix: out, frac_bits, f_shift (the real coefficient is the raw value over 2 to the scale, shown as 2^-N), lsb_bypass, noise_shift, the reserved field_2b and field_m4, the extension's ext_width and ext_field2, the coefficients as sent (m<channel>:raw, n0 and n1 for the two noise channels) and the extension's slopes (the per-unit change of each coefficient, - when the matrix has none). json=1 adds a matrix member with the same figures. Counts and header fields only, never audio.
detail=rate (TrueHD and MLP) runs the arrival model of TH spec §3.4 and §18 over the stream's access units and prints, for each restart
interval, its bitrate (kbit/s), the rate of its largest access unit, the least headroom any unit has before it would arrive more than 75 ms
after its slot (milliseconds, three decimals; negative means late) and how many units were late, after a summary line for the whole stream.
The model runs at the rate the first major sync declares, or at truehd-bitrate=KBPS. json=1 adds a rate member with the same figures
in bits per second and microseconds. Integers only, so the output is the same on every run; counts and rates, never audio. The model is the
encoder's reading of the specification and is provisional (libs/truehd/ERRATA.md, entry 71).
A TrueHD or MLP stream, bare or in a container, is also read by probe (the container's own description of the track beside
the stream's), levels (peak and RMS per channel of the 24-bit samples), loudness (integrated loudness and true peak, with
BS.1770-5 Annex 3's weights taken from the speakers the stream names), mkv, mp4, ts, spdif, unspdif, demux and
remux. mkv writes A_TRUEHD, mp4 an mlpa entry with its dmlp box and an edit list that drops the padding samples of
the last unit, and ts a Blu-ray transport stream (stream_type 0x83 under the HDMV registration): its third argument is
bluray or nothing, and dvb or atsc is a usage error, as bluray is for every other codec; remux to a .ts without a
profile writes that Blu-ray one for TrueHD and MLP, as it writes DVB's for AC-3, E-AC-3 and AC-4. spdif packs MAT 1.0 (24
access units to a 61,440-byte burst of IEC 61937 data type 22) into an eight-channel PCM16 WAV at four times the stream's
48 or 44.1 kHz family when the output ends in .wav, and as raw bursts, FFmpeg's spdif muxer's form, otherwise; unspdif
reads either back. decode ... channels=2 writes the stream's own 2 channel presentation (the substream a stereo player reads, not a fold the decoder makes), as truehd-presentation=2ch does, and channels=as-coded is what a decode does; no other count or fold is taken. loudness of a TrueHD stream says the dialnorm the loudness implies (ATSC A/85 section 8) beside the one the stream stores for the presentation decoded. metadata and normalize set the channel meaning of a TrueHD stream, and qc checks one (below). cut and cat
move whole access units and never change a byte: cut in.thd out.thd [start] [duration] starts at the first access unit that carries a
major sync (the start of a restart interval, one in 128 by default) at or after the time asked, says which time it used, and ends on the
unit boundary that covers the duration; cat joins streams of one shape (stream type, rate, substreams, channels, channel assignment) and
refuses an input that does not open with a major sync at byte 0, one that differs in shape (the difference is named), or a damaged one
(cut refuses a damaged stream too: forge probe it first). They take bare .thd and .mlp streams (demux a container first) and
no options. FFmpeg's strict decode of a cut is the same slice of the whole decode, and of a join the two decodes in order; forge's own
strict decode stops at a join (truehd-check=lenient goes on; libs/truehd/ERRATA.md
question 20 and entry 80). record <out.thd> <seconds> <bitrate> <device> codec=truehd takes a lossless stream of what the device hears (one to eight channels at 44.1, 48, 88.2, 96, 176.4 or 192 kHz, held as PCM for the take and coded when it ends, written as a bare .thd); live does not code TrueHD. monitor plays the decode of the presentation truehd-presentation= names, asking the output for the stream's own channel count and rate (a shared-mode device that does not take eight channels or 192 kHz says so, exit status 4). transcode reads a bare TrueHD or MLP stream (or a file with TrueHD alone) and writes AC-3 or E-AC-3: the decode of the presentation truehd-presentation= names, encoded as encode encodes a WAV, so the layout, the bitrate and the metadata mean what they mean there; the dialogue norm the stream stores for the presentation decoded is carried as the dialnorm (the 6 and 8 channel fields as they are, the 2 channel field less 6; a stream that stores 0, as FFmpeg's do, keeps the encoder's default), and dialnorm= or dialnorm=auto overrides it; it refuses AC-4, and nothing transcodes to TrueHD. fmp4 and play do not read TrueHD and say so by name (exit status 1). In a file with
several audio tracks the commands that read TrueHD take the first, and transcode, qc, fmp4, monitor and play take the
first of another codec, so a Blu-ray remux with its TrueHD track first is read as its AC-3 or E-AC-3 track; a file with TrueHD
alone is read by transcode and qc and refused by fmp4, monitor and play. The layouts
are FFmpeg's, a single oracle in each direction, and nothing has been played into a receiver or a disc player
(libs/containers/ERRATA.md).
truehd-encode <in.wav> <out.thd|out.mkv|out.mp4|out.ts> codes the PCM losslessly (libs/truehd's Encoder): what any
TrueHD decoder gives back is the samples that went in, bit for bit, which FFmpeg's strict decode and forge decode are both held
to. A WAV states its speakers in its channel mask (FL FR FC LFE SL SR is L R C LFE Ls Rs; a back pair is the surround pair
unless the file also has side speakers, in which case it is Lrs Rrs; a speaker TrueHD has no channel for is refused); a file
with no mask is taken in the order decode writes (L R C LFE Ls Rs Lrs Rrs). The input is read as 24-bit integers (16 and 24 bit
files exactly, anything wider rounded), and the encoder sends the low bits a 16-bit source leaves clear as an output shift. The
options, each only here:
| Option | What it sets |
|---|---|
truehd-downmix=none\|standard |
none (the default) puts the first two channels in substream 0 as they are, as FFmpeg's encoder does; standard makes the 2 and 6 channel presentations downmixes that the later substreams undo exactly, so truehd-presentation=2ch of the result is a stereo mix |
truehd-downmix-gains=C,S,LFE,R |
the four gains folded in, in dB from 0 to -60 or off: C into L and R, Ls and Rs, LFE, and Lrs and Rrs into the surrounds (default -3,-3,off,-3) |
truehd-restart=N |
access units between restart headers, 1 or 8 to 4096 (default 128, 107 ms at 48 kHz): a longer interval is smaller, a shorter one seeks quicker |
truehd-fir-order=N, truehd-matrix=on\|off |
the largest prediction order tried, 0 to 8, and whether channel pairs are decorrelated with a primitive matrix |
truehd-stereo-mode=stereo\|ltrt\|headphone |
the 2 channel mode the stream declares |
truehd-peak-rate=KBPS, truehd-rate-check=strict\|lenient |
the rate the stream is declared not to exceed (default 18000, Blu-ray's; at least 1000) and whether a stream that cannot be sent within it and TH spec §18's 75 ms is refused (exit 1) or written and counted |
truehd-bitrate=KBPS |
hold the stream to this bitrate over any 75 ms (1000 to 100000; the arrival model of TH spec §3.4 and §18 run at it, as well as at the declared peak rate). Default: the declared peak rate. On probe detail=rate it is the rate the model runs at |
truehd-rate-mode=strict\|shape, truehd-shape-bits=N |
truehd-atmos only. strict (the default) refuses a stream that does not fit; shape lets the object channels of substream 3 give up low bits, one at a time, in the restart intervals that do not fit, up to N (0 to 16, default 8). The 7.1 bed is never touched; the objects of a shaped interval are the input's rounded to a multiple of 2^k, so the encode is lossy for them there. Provisional |
truehd-major-sync=N |
access units between major syncs: 0 (the default; one at every restart header) or a multiple of truehd-restart=. The restarts between two major syncs have a restart header in every substream and no major sync |
truehd-evo-frames=all\|every:N\|first\|none |
truehd-atmos only. Which of the metadata frames (one every 1536 samples) get an evolution frame in the stream: all (the default), every N-th, the first, or none. The stream carries no per-frame tag, so a licensed decoder that checks it reports "Consecutive Evo frames fail security check" when two frames in a row fail; the stream's Atmos flag is set whenever it has object channels (TH spec §4.1.1) |
sign-objects, signing-key=PATH |
truehd-atmos: sign every evolution frame with the operator's key (signing-key=, or ICLFORGE_SIGNING_KEY[_FILE]), as E-AC-3's sign-objects does; ICL Forge's own scheme (docs/concepts/object-signing.md), not a Dolby tag, so a licensed decoder may still reject it. Without a key the stream is written unsigned |
verify |
decode every access unit with the library's decoder as it is coded and compare it with the input |
truehd-dialnorm-2ch=, -6ch=, -8ch= |
the dialogue norm of the 2, 6 and 8 channel presentation (TH spec section 12.5): 0 to 63 for 2 channels, 0 to 31 for the others |
truehd-mix-level-2ch=, -6ch=, -8ch= |
the mix level of each presentation, 0 to 63 (the specification gives no unit, so the number is written as it is) |
truehd-source-format-6ch=, -8ch= |
the source format of the 6 channel (0 to 31) and 8 channel (0 to 63) presentation; the 2 channel one has none |
truehd-control-2ch=, -6ch=, -8ch= |
on or off, the presentation's control-enabled bit |
truehd-heavy-drc-start-up-gain=, truehd-drc-start-up-gain= |
the two DRC start-up gains, signed: -32 to 31 and -64 to 63 (TH spec section 12.3) |
src=, map= and offset= take the channels of several WAVs, with the grammar of the other encoders and TrueHD's channel names for the places: map=<source>.<channel>:<place>,..., source 0 the positional input and each src= the next, channels
counted from 0, the place one of L R C LFE Ls Rs Lvh Rvh Lc Rc Lrs Rrs Cs Ts Lsd Rsd Lw Rw Cvh LFE2 in any case. map=0.0:L,0.1:R,1.0:C,2.0:LFE,2.1:Ls,2.2:Rs puts the
two channels of the input and the first channel of each of two src= files into 5.1. The places named have to make one channel assignment (TH spec section 13.1: the pairs
L R, Ls Rs, Lvh Rvh, Lc Rc, Lrs Rrs, Lsd Rsd, Lw Rw, and the singles C, LFE, Cs, Ts, Cvh, LFE2), and the stream's channels are in that assignment's order whatever the order of the map;
a set that is not one is refused with the sets nearest to it (map=0.0:L,0.1:R,0.2:C,0.3:LFE,0.4:Ls is "Ls needs Rs. The nearest sets are L R C LFE Ls Rs or L R C LFE"). A place named
twice, a source or channel that is not there, a source with no channel in the map, sources of two sample rates, src= with no map=, and an offset= that names a source not given
are refused (exit 1) and nothing is written. map= on a single WAV names its places over its channel mask. offset=<source>:<seconds> puts that much silence ahead of that source (without
map=, ahead of the one file), and a shorter source is padded with silence to the longest, not held at its last sample. layout= is not read. A project file's assignments and
sources' offsetSeconds become these options.
The status line gives the access units, restart intervals, bytes, the percentage of the PCM, and the substreams.
The channel meaning options are provisional, with no oracle until the DEE set. TH spec section 14.1 puts a dialogue norm, a mix
level, a source format and a control-enabled bit for each of the three presentations, and two DRC start-up gains, in the major sync, which
repeats at every restart; the options write them into every one, each refused by name outside its field's width, and a field left out is
0 (a control bit off), so a run that names none writes the stream it always wrote. FFmpeg's encoder writes zeros, so nothing outside this
library reads them. The specification gives a unit for the 6 and 8 channel dialogue norms only (n is -n dBFS), gives none for the mix level,
no table for the source format, no word on what a control-enabled bit gates, and does not say which presentation's value applies when;
forge writes and shows the numbers as they are and converts none of them
(libs/truehd/ERRATA.md, questions 51 to 55). No decoder
here applies them.
TrueHD Atmos (provisional; libs/truehd/ERRATA.md
entries 60 to 64). decode ... truehd-presentation=all writes the channels of substream 3 (12 to 16, in the order the stream carries them,
with no channel mask). With an objects_dir it also writes each channel as object_NN.wav, and with an adm_out (needs
-DICLFORGE_BUILD_ADM=ON) an ADM master with the beds as DirectSpeakers and the dynamic objects positioned by the update blocks of the
object audio metadata in the stream's evolution frames; channel i is object i (a dynamic-object-only programme with an LFE has the LFE
first). adm_out with another presentation is that presentation's bed alone. truehd-render=<layout> (a name such as 7.1 or 7.1.4,
or a list such as L,R,C,LFE,Ls,Rs,Lrs,Rrs) places the objects on a speaker layout with iclforge::render and writes the speaker feeds
as the output WAV instead of the channels; an object keeps its last position until the next update, which each speaker's gain reaches
over the update's ramp. truehd-atmos <objects.wav> <out> [paths.txt] writes the stream: the WAV's first channel is the LFE
(truehd-objects-lfe=off makes every channel an object), paths.txt is atmos-path's scene file for the objects after it (the
others stand in an even fan; an ADM master gives its own paths and takes no scene file), truehd-bed=<7.1 WAV> gives the bed (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 same renderer from the metadata the stream carries, so a decoder that plays the bed and one that
renders the objects play the same programme), and the other truehd- options are truehd-encode's. The metadata is one evolution frame
every 1536 samples. Its status line says so, and that the stream is provisional and unsigned.
metadata <in.thd> <out.thd> sets the same fields in a finished stream, with the same truehd- options, without re-encoding it: it
finds every major sync (they repeat at each restart, 128 access units by default), changes the named fields of each, and re-stamps each
one's CRC-16. No other check covers the major sync, so every other byte is copied as it is and the audio decodes to the same samples
(tools/checks/verify_truehd_interop.py holds FFmpeg's strict decode of the result to the original's); bytes the reader does not take for
an access unit are left alone. Fields not named keep the stream's values, a stream whose major syncs differ gets the change in each, and the
output may be the input or -. The status lines say how many major syncs were rewritten and show each field that changed as before and
after. It refuses by name, with exit status 1 and no output, an option of E-AC-3's metadata (dialnorm=, compr=, bsmod=, insert
and the rest), a call that names no field, a value outside its field's width, an MLP stream (its bytes at that place are not described),
and, for an AC-3 or E-AC-3 stream, any truehd- option. The same provisional marks apply as for truehd-encode.
normalize <in.thd> <out.thd> is the measurement-driven case: it decodes each presentation the stream has (2 channels for one substream, 6
for two, 8 for three), measures its integrated loudness with the BS.1770-5 Annex 3 weights loudness uses (from the speakers the major sync
names), maps it to a dialogue norm as E-AC-3's normalize maps it (ATSC A/85 section 8: the loudness negated and rounded, from 1 to 31, the
range the 5 bit fields hold, so a quiet programme is 31 and no field is written as 0), and writes it into that presentation's field of every
major sync, as metadata does, except that the 2 channel field gets the norm plus 6 and its control-enabled bit is set, as DEE writes
them (ERRATA question 51 and 54). No gain is applied to the audio: the stream is lossless, so only the fields change, and the mix level,
source format, the 6 and 8 channel control-enabled bits and DRC start-up gains are left as they were (E-AC-3's normalize leaves its mixing metadata alone
too). The status lines give each presentation's loudness and its dialogue norm before and after, and say for each whose control-enabled bit
is off that a decoder may not apply the field (metadata ... truehd-control-6ch=on sets it; whether any decoder reads the bit that way is
open). A stream with nothing above the -70 LKFS gate in some presentation is exit status 5 and writes nothing, a damaged stream is exit
status 2 (the measurement is strict), and normalize takes no option but quiet and verbose, refusing any other by name. Provisional,
with no oracle until the DEE set (libs/truehd/ERRATA.md, question 51).
Options a TrueHD or MLP run does not apply are refused, not dropped. decode of a TrueHD or MLP stream takes
truehd-presentation=, truehd-check=, truehd-reading= and the object-signing options verify-objects, gate-objects and
signing-key= (see below), and refuses every other option by name with exit status 1 and no output: the
output stage (channels=, downmix=, mix-lfe), drc= and drcmode=, programme=, the object outputs (objects_dir,
adm_out, bed-only), sign-objects and the verification flags (verify-content, check-content, syntax-trace=),
which never succeed without checking something. levels and loudness take the same two options, truehd-encode its own
and verify (the metadata, layout and multi-source options of the other encoders, such as dialnorm=, layout=, src= and
map=, are refused), probe takes json= and detail=evolution, structure and format (detail=frames and blocks have no TrueHD form), and mkv, mp4, ts, spdif and remux take
none (mainid=, asvc= and programme= describe a service of the AC-3 family). quiet and verbose apply everywhere. The
transform choices fast-mdct, fast-imdct and mode= change nothing for a codec with no transform, and are warned about.
TrueHD object signing: sign-objects, verify-objects, gate-objects. The evolution frame that carries a TrueHD stream's object
metadata has a protection field, and iclforge::truehd::signing writes and checks a keyed tag in it with the operator's own key
(signing-key=<path>, or ICLFORGE_SIGNING_KEY[_FILE]). metadata <in> <out> sign-objects signing-key=<path> signs every evolution
frame (alone, or together with the channel-meaning edits; no length changes). decode <in> <out> verify-objects signing-key=<path>
refuses the stream on a mismatch, and takes several signing-key= for a keyring. gate-objects is the permissive policy: a unit whose
tag verifies is kept, any other has its object layer removed and plays as the bed, and truehd-presentation=all is refused when
anything was gated. probe says without a key how many evolution frames carry a tag
(truehd.evolution.protection.tagged_frames). This is iclforge's own scheme, not a Dolby tag: a licensed decoder holds other keys and
will not accept these tags as Dolby-authentic. See Object signing.
AC-4 content signing: ac4-sign, ac4-verify¶
An AC-4 stream can carry one signature over the whole stream, made with the operator's own P-256 key
and certificate chain and written after the last sync frame, so a signed file plays as the unsigned
one. Nothing signs or checks unless it is asked to, the key and chain are yours (nothing of any
issuer's ships), and a signature that checks out against a chain nothing you trust vouches for is
reported as chain unanchored, never as valid. The API and the checks are in
Signing.
forge ac4-sign in.ac4 signed.ac4 content-key=signer.key content-chain=chain.pem publisher-uuid=<your publisher UUID>
forge ac4-verify signed.ac4 trust-anchor=root.pem # exit 0: valid and anchored
forge ac4-verify signed.ac4 # exit 6: checks out, chain unanchored
forge ac4-verify signed.ac4 unanchored-ok # exit 0, still reported as unanchored
forge ac4-verify signed.ac4 check-content # print what it finds, exit 0
forge ac4-verify signed.ac4 trust-anchor=root.pem verify-content # also holds the signer information to CS spec 5.3
forge ac4-verify signed.ac4 trust-anchor=root.pem verify-content expect-publisher-uuid=<your publisher UUID>
forge ac4-encode in.wav out.ac4 192 sign-content content-key=signer.key content-chain=chain.pem
forge decode signed.ac4 out.wav verify-content trust-anchor=root.pem # refuses before it decodes
sign-content (on ac4-encode, and on atmos-encode, atmos-adm and atmos-iab with codec=ac4)
signs the file after it is written. The key and chain are checked first, with a throwaway digest, so a
key that does not belong to its chain or a signed-date= outside the certificates' validity fails
before the encode and writes nothing. It is refused for - (a pipe), for E-AC-3 output and for an
MP4: signing an MP4 is out of scope in CS spec v2.6 (§8.3.2), which names no box that carries a
signature, so ac4-sign and sign-content exit 1 saying so and ask for the raw .ac4 stream
instead. verify-content on decode stops (exit 2) unless the signature, the chain and an anchor
all check, before anything is decoded; check-content prints the checks and plays on. The exit code
of ac4-verify is 0 for valid and anchored, 6 for anything else; the reason is the result: line
it prints under the verdict: valid, untrusted (it checks out, nothing you trust vouches for the
signer), no-signature, unreadable, chain-rejected, signature-invalid, content-altered,
metadata-altered or refused-by-policy. A signature made with your own key does not chain to
Dolby's or PACE's trust root; see Object signing.
Who signed. A signature names its publisher, product and platform (CS spec v2.6 §5.3). ac4-sign
and sign-content take them as publisher-uuid= (the UUID of your PACE publisher account),
publisher-name=, product-id=, product-name=, wrapper-name=, os-name=, os-version= and
os-description=; the signing application, its version and its commit are written for you, as are a
fresh 128-byte nonce and the time of signing. A publisher-uuid= that is not a UUID is
refused. The UUID is the PACE publisher account's, carried out of band; it is not in the signing
certificate (§5.3 as of v2.6), so it is not compared with the certificate. Without publisher-uuid=
the signature is made and a warning says why a strict verifier will refuse it. signed-date= writes another date than now, which §5.3 does not allow
("the actual signing time"); it is for credentials whose certificates have expired, and warns when it
is more than five minutes from the clock. ac4-verify prints what the signature says about its
publisher, product, platform and application, and two findings, signer nonce and publisher UUID,
which do not change the verdict. verify-content makes them count: a nonce that is not 128 bytes, or
a publisher UUID that is missing or malformed, makes the signature INVALID. expect-publisher-uuid=
(repeat it for more) names the publisher accounts you accept: a signature naming another is a note
in ac4-verify and makes the signature INVALID with verify-content. Without it the UUID is
reported and compared with nothing, and is never refused for being absent from the certificate.
verify-time= says when every certificate must be valid: now, signed (the date the signer wrote,
which is only as good as the signer), ignore, or an instant YYYY-MM-DDTHH:MM:SS in UTC. Left out,
ac4-verify and verify-content judge at now, which is the specification's (§6.1 steps 3 and 4),
and check-content, which reports and carries on, judges at the signed date. The report names the
time it used and why. The leaf must carry the title
Code/Content Signer unless leaf-title= says otherwise (any checks none). pin= takes a
certificate's SHA-1 (40 hex digits) or SHA-256 (64) fingerprint and trusts that certificate wherever it
appears in the chain; trust-anchor= takes a certificate file; trust-key= takes the signer's P-256
public key (a PEM "PUBLIC KEY" block or DER, which openssl pkey -in signer.key -pubout writes) and
trusts a chain whose signing certificate carries it. All three repeat. The options are listed in
options and grammars; an option that says how to
sign or check, without the command that signs or checks, is refused rather than dropped.
probe shows a signature without a key and without checking it: a content sig line in the table
and a stream.content_signature member in the JSON (null without one; otherwise verified: false,
readable, size_bytes, problem, signer, signer_serial, signed_date, signing_method,
certificates, publisher, application). The trailer is not a parse error.
Damaged frames: conceal=¶
decode, monitor and spatial stop on a frame that will not decode. conceal= substitutes
audio for it instead, reconstructed from the previous block's overlap so there is no discontinuity
at either join:
forge decode recovered.ac3 out.wav conceal=repeat # repeat-and-fade
forge decode recovered.ac3 out.wav conceal=mute # window-ramped silence
Either way the run reports how many frames or access units were concealed. Off by default: a decode that hides a damaged frame looks exactly like one that had nothing to hide. See Decoding → Concealing it instead.
decode takes conceal= for AC-4 too. A concealed AC-4 frame is the last good frame's spectrum
again, faded 20 dB for each 32 ms lost as the AC-3 and E-AC-3 decoders fade, or silence, through
the decoder's own transform and output stages; the QMF-domain tools pass it through. The frames
that wait for an I-frame after a change of source, which otherwise write nothing, are concealed
the same way. A frame that fails before any frame has decoded still stops the run.
Lost frames: strict¶
A decode that loses frames or units keeps going and exits 0, and says so where it always has: an AC-4 stream's frames that wait for an
I-frame ("N frames waiting for an I-frame produced no output, of T in the stream; the output holds the other M"), the concealed N of T
line under conceal=, TrueHD's counters of the units a lenient decode waited on or skipped. A script reads that from stderr. strict
makes it the exit status:
forge decode programme.ac4 out.wav strict # exit 2 if any frame was lost after the first one decoded
forge decode damaged.ec3 out.wav conceal=repeat strict
forge decode disc.thd out.wav truehd-check=lenient strict
With strict, once everything that could be decoded has been written (the WAV is the same as without it), the run exits 2, an input
fault, when any of these happened after the first frame or unit decoded: an AC-4 frame waited for an I-frame (the decoder dropped state,
which is a fault in the stream or the decoder), a frame or unit was concealed (AC-3, E-AC-3 or AC-4 under conceal=), or a TrueHD decode
under truehd-check=lenient skipped bytes the reader could not take for a unit, could not read a unit, or had units wait for a restart
header. The message gives the count and what it was made of. The frames that wait before the first one decodes do not count: a stream
cut in the middle of a group of pictures has leading frames that wait for the first I-frame by design, and strict leaves it alone. Without
strict nothing changes: the exit status, the output and the warning are what they were. A TrueHD decode that stops at a failed check
(the default, truehd-check=strict) already exits 2; strict matters for the lenient one. strict is decode's alone, and another
command given it refuses it as an unknown option.
probe — what the stream says about itself¶
Every other inspection here goes through the audio: levels and qc decode the whole
programme to measure it, and decode reports an object count on its way past. probe asks
the other question — what the bitstream declares — and answers it without reconstructing a
single sample:
file programme.ec3
codec E-AC-3 (bsid 16)
sample rate 48000 Hz
bsmod 0 (complete main)
layout 3/2 + LFE (acmod 7, lfeon 1)
renders 6 channel(s): L C R Ls Rs LFE
blocks 6 per syncframe (numblkscod 3)
substreams 1 per access unit
independent id 0, 3/2 + LFE, 63 syncframe(s), -
access units 63 (63 syncframe(s)), 112896 bytes
duration 2.016 s
bit rate 448.0 kbit/s measured
rate control constant (1792 .. 1792 bytes per access unit)
dialnorm -31 dB
compr absent
dynrng absent
dmixmod absent
EMDF payload id(s) 11 (OAMD), 14 (JOC)
object audio 5 object(s): bed LFE only, 4 dynamic, in 63 frame(s)
complexity 5
JOC present
authenticity no tag
CRC 63 of 63 syncframe(s) valid
tools 378 block(s) parsed
delta ba 372 of 378 block(s)
skip field 63 of 378 block(s)
exponents reuse 1890, D15 378, D25 0, D45 0
It reads a stream in two tiers, and the distinction is the point. The header tier —
syncinfo plus the whole of bsi — answers for every syncframe whether or not its audio is
readable, so a stream this decoder refuses is still described in full. The parse tier runs
the real decoder with the inverse transform switched off, which is where the dynrng words,
the EMDF payload ids, the object layer and the per-block tool usage come from. A syncframe the
parse tier declines is counted and reported (parse errors in the table, parse_failures in the
JSON); the header tier's answers for it stand. On a stream the decoder reads throughout, such as
testdata/external-baseline/eac3-51-256/dee.ec3, the parse tier accepts every syncframe and
the tool lines show what the encoder used: coupling, spectral extension and AHT there.
Exit code is 0 only when every syncframe passed its CRC and the parser accepted it, so
probe works as a pipeline gate without anything having to read its output:
Every failure exits 1, an unreadable file or bytes that are no stream among them; the 2 that
Exit codes gives an input problem is not what probe returns.
Memory is flat in the length of a bare AC-3 or E-AC-3 stream: input is pulled through a fixed
window rather than loaded, and the per-frame dump is written as the walk produces it. Probing a
two-hour file costs what probing a two-second one does. - in place of the path reads the stream
from stdin, so probe sits in a pipe. An AC-4 stream and a container are read whole before they
are walked, so their memory grows with the file.
Per-frame and per-block detail¶
detail=frames adds one entry per access unit — byte offset, size, timestamp, and each
syncframe's own header, CRC state and object layer. detail=blocks adds every block's coding
tools and exponent strategies underneath: the C++ counterpart of tools/references/eac3_parse.py,
and what a codec bug report actually needs.
access unit 0 @ 0 (768 bytes, t=0.0000s)
independent id 0 @ 0: 768 bytes, 2/0 stereo, crc ok, dialnorm -31 dB
blk 0: cpl+dither+remat exp [D45 D45 cpl:D45]
blk 1: cpl+dither exp [D15 D15 cpl:D15]
blk 2: cpl+dither exp [reuse reuse cpl:reuse]
JSON output (json=1)¶
json=1 emits the same walk as a JSON document instead. The schema is a stable contract —
sibling tooling is built on it (an HLS/DASH manifest check comparing a dec3 box against the
real substream map is the natural next consumer), so the rules below are commitments, not
description.
The switch is the json=1 token. There is no --json: a bare token the command line does not
recognise as an option is taken for a positional argument and never read, so
forge probe programme.ec3 --json exits 0 and prints the table.
Versioning. The top-level schema member names the contract: "iclforge.probe/1". Within
one version, members are only ever added; an existing member never changes its type, its units
or its meaning, and never disappears. A member that does not apply to a given stream is present
and null (or false/[]), never omitted — a consumer must not have to tell "no such key"
apart from "no such thing". A change that would break any of that changes the version.
Ordering. access_units is written before stream, because the summary is only complete
once every unit has been walked and the per-frame dump has to stream. JSON member order carries
no meaning, so this costs a consumer nothing — but do not build anything that depends on the
opposite order.
Units. dialnorm_db/dialnorm2_db are reported in dB (negative), not as the
transmitted 1..31 code — the field means −1..−31 dB LKFS and that is what a delivery spec is
written in. compr, compr2, dynrng and dynrng2 are the raw 8-bit words, because their
meaning is a non-linear gain curve (§7.7) and a range of gains is not a well-defined thing to
report. bitrate_kbps is measured over the whole stream; nominal_bitrate_kbps is AC-3's
declared Table 5.18 rate and is null for E-AC-3, which has no such field.
Top level:
| Member | Type | Meaning |
|---|---|---|
schema |
string | "iclforge.probe/1" |
generator |
string | The forge version that wrote it |
file |
string | The input path as given |
container |
object or null |
What a Matroska, MP4 or MPEG-TS input says of its audio track; null for a bare stream |
access_units |
array | Present only with detail= — see below |
stream |
object | The summary |
container, for a container input: format ("matroska", "mp4" or "mpegts"), codec_id (the
Matroska CodecID or MP4 sample entry, such as "A_EAC3", "ec-3" or "ac-4"; null for
MPEG-TS), track, language, samples, sample_rate_hz and channels (each null where the
container does not state it, as MPEG-TS does not), other_tracks (an array of the tracks the
file declares and the command reads none of, in file order and up to 64: track, kind of
"audio", "video", "text" or "other", codec_id as the container names it, such as
"avc1", "tx3g" or "S_TEXT/UTF8", language, and protection: null for a track that is not protected, and for an MP4 track whose sample entry is enca or encv (Common Encryption, which this build does not decrypt) an object of entry_type, scheme ("cenc", "cbc1", "cens", "cbcs", or null if the entry states none), original_format (such as "ec-3", or null), default_kid (8-4-4-4-12 hex, or null without a tenc), default_iv_size, crypt_byte_block, skip_byte_block and has_clear_entry; empty for a file with no other track and for MPEG-TS),
and two members of which the one for another format is null. mp4: timescale, movie_timescale, edits and codec_box, the sample
entry's dac3, dec3 or dac4 as type, bytes, fscod, bsid, bsmod, bsmod_label,
acmod, lfeon, bit_rate_code, data_rate_kbps, independent_substreams, num_dep_sub,
chan_loc, asvc, asvc_label and complexity_index (a dac4 reads as zero in the fields that
are AC-3's and E-AC-3's, and null for the complexity index where the box sends none).
mpegts: program_number, pmt_pid, stream_type, signalling, packet_size and service,
the decoded AC-3 or E-AC-3 descriptor (bsmod, bsmod_present, full_service, bsid, mainid,
priority, asvc, mix_metadata), null where the stream has none. Hearth's media
information writes the same codec_box members.
stream:
| Member | Type | Meaning |
|---|---|---|
codec |
"ac3", "eac3" or "ac4" |
Which codec: from bsid for the first two, from the sync word for AC-4, whose stream has its own shape (below) |
bsid, bsmod |
int | §5.4.1.3 / §5.4.2.1 as transmitted; bsmod_label names it (Table 5.7) |
sample_rate_hz |
int | 48000/44100/32000, or Annex E's 24000/22050/16000 |
reduced_rate |
bool | The rate came from fscod2 (§E2.3.1.3) |
acmod, lfeon |
int, bool | As transmitted; layout_label names the pair |
numblkscod, blocks_per_syncframe |
int | §E2.3.1.4; always 6 for AC-3 |
coded_channels |
int | What the independent substream itself codes |
rendered_channels |
int | What the program renders, every dependent's chanmap unioned in (§E3.8.2) |
layout |
array of string | Table E2.5 locations, in order. Empty for 1+1 dual mono, which has no layout |
substreams |
array | One entry per (stream_type, substream_id) identity, with its own bsid/bsmod/acmod/lfeon/numblkscod/chanmap and the syncframes that carried it |
substreams_per_access_unit |
int | Substreams in the first access unit |
access_units, syncframes, bytes |
int | Extent |
duration_seconds |
float | From the coded block counts, not a container timestamp |
bitrate_kbps |
float | Measured over the whole stream |
nominal_bitrate_kbps |
int or null | AC-3's declared rate; null for E-AC-3 |
variable_bitrate |
bool | Access units differ in size |
access_unit_bytes |
{min, max} |
The spread behind that flag |
metadata |
object | dialnorm_db, dialnorm2_db, compr, compr2, dynrng, dynrng2, each {present, min, max} with min/max null when present is false; and dmixmod, {present, code, label}: the first Table D2.2 preferred downmix the lead programme's independent substream sends, as its 0–3 code and its name ("not indicated", "Lt/Rt", "Lo/Ro" or "reserved"), with code/label null when no syncframe sent one |
objects |
object | complexity_index (TS 103 420 §8.3.2.2, from addbsi), oamd, joc, emdf_payload_ids, and the program the first OAMD payload described: total, dynamic, bed, bed_mask, lfe, plus the frames that carried one |
authenticity |
{present, tagged_syncframes} |
Whether frames carry an authenticity tag. Answered without a key — where the tag lives is fixed by the container, and only whether it matches needs the key (that is decode ... verify-objects) |
integrity |
object | crc_valid, crc_failures, parse_failures, first_parse_error |
tools |
object | blocks parsed, then how many of them used coupling, enhanced_coupling, spectral_extension, block_switch, dither, rematrixing, delta_bit_alloc, skip_field; aht_syncframes and transient_prenoise_syncframes are counted in frames, since Table E1.3 decides them per frame; exponent_strategy totals reuse/D15/D25/D45 over every coded stream of every block |
access_units[] (with detail=): index, byte_offset, bytes, start_seconds, and
syncframes[] — each with its own byte_offset, bytes, stream_type, substream_id,
bsid, bsmod, acmod, lfeon, numblkscod, dialnorm_db, compr, dmixmod, chanmap, crc_valid,
authenticity_tag, parse_error and objects. With detail=blocks each syncframe also carries
frame_tools (Table E1.3's frame-level gates, aht_streams, snroffststr,
per_block_exp_strategy) and blocks[] — per block: parsed, coupling,
enhanced_coupling, spectral_extension, block_switch and dither (per-channel bit masks),
rematrixing, delta_bit_alloc, skip_field, skip_bytes, exponent_strategy (one entry per
coded channel, LFE last) and coupling_exponent_strategy.
AC-4¶
probe auto-detects AC-4 (iclforge::ac4) by its first byte — 0xAC rather than AC-3/
E-AC-3's 0x0B — so forge probe stream.ac4 needs no extra flag, and works on - (stdin) the
same way. It reads the sync frame, table of contents, presentation and substream-group framing —
channel-coded, A-JOC-coded, direct-coded-object and OAMD substream groups alike — and has every
frame read by the decoder (iclforge::ac4) without decoding its audio, for what only the
substreams carry: each presentation as the decoder sees it, and the metadata of the one it would
decode. There is no detail=frames/detail=blocks equivalent (see
Verification for what the inspector's reading does and does not
cover, including the narrower evidence behind the A-JOC/object/OAMD path).
That is a stream DEE encoded, committed with the tests:
file testdata/external-baseline/ac4-51-film-96/dee.ac4
codec AC-4
access units 120 (120 sync frame(s)), 62160 bytes
CRC 120 of 120 valid
bs version 2
sample rate 48000 Hz
frame rate 23.438 fps, 2048 samples a frame at 48000.00 Hz
bit rate 96.0 kbps
I-frames 7, every 1 to 24 frames
splices 0
presentations 1
5.1
presentation 0 id 0, md_compat 1, L R C LFE Ls Rs; main; selected
dialnorm -19 dBFS
loudness -18.6 LKFS integrated
true peak -5.7 dBTP
DRC profile 2, modes 0 default profile, 1 default profile, 2 default profile, 3 default profile
dialogue enh. method 0, C up to 9 dB
downmix Lo/Ro centre -3 dB, surround -3 dB; Lt/Rt centre -3 dB, surround -3 dB
frame rate is Part 1 Tables 83 and 84's, with the frame length and the rate a frame is coded
at; I-frames counts the frames whose substreams need nothing from an earlier one, and the
spacing between them; splices counts the frames whose sequence_counter does not continue the
stream, where a decoder forgets what it held.
json=1 writes stream.codec == "ac4" and a dedicated stream.ac4 object — deliberately not
the AC-3/E-AC-3 stream shape above with its acmod/bsmod/numblkscod/etc. fields nulled out one
by one. Those fields belong to a different codec family and do not apply; stream.ac4 is
additive to the schema, and a consumer branches on stream.codec first the way any
discriminated-union JSON shape is read. stream.ac4: bitstream_version, sample_rate_hz,
frame_rate_index, n_presentations, substream_groups[], and presentations_v0[] for the
legacy bitstream_version <= 1 path (empty for every stream observed so far — see the
Verification link above). Each presentations_v0[] entry carries presentation_version and
substreams[], whose entries are a chan substream's members (below) with its role beside
them. Each substream_groups[] entry carries b_substreams_present,
b_channel_coded, oamd (null unless the group is object-coded and carries an OAMD substream:
b_oamd_ndot, substream_index and oamd_common_data, below), and substreams[]. Each
presentations_v0[] entry also carries
decoded, the decoder's reading of it, with the members of a presentations_v1[] entry (below).
Each substream entry is a tagged union —
kind ("chan", "ajoc" or "obj") says which one of chan/ajoc/obj is non-null, the
other two null:
- chan: channel_mode, channel_mode_name, ch_mode, bitrate_kbps, substream_index,
original_content (b_4_back_channels_present/b_centre_present/top_channels_present —
whether channels channel_mode implies exist are real content or encoded silence, e.g. a 5.1.4
source carried in a 7.1.4-coded substream).
- ajoc: b_lfe, b_static_dmx, n_fullband_dmx_signals, static_objects[],
oamd_common_data (below), n_fullband_upmix_signals, upmix_objects[], sf_multiplier,
bitrate_kbps, substream_index.
- obj: objects[], b_dynamic_objects, sf_multiplier, bitrate_kbps, substream_index.
- Every object list entry (static_objects/upmix_objects/objects) is {kind: "bed"|"dyn"|
"isf", lfe, ajoc_coded}.
The decoder's reading adds, after those:
frame_rate:fps,frame_lengthandinternal_sample_rate_hz;bitrate_kbps, over the whole stream;iframesandiframe_interval_frames(minandmax, null for fewer than two I-frames);splices.presentations_v1[], one per presentation of the last frame's table of contents:index,presentation_id,presentation_version,presentation_config,md_compat,enabled,alternative,pre_virtualized,name,language,channels(the speakers it decodes to,L,R,C,LFE,Ls,Rsand so on),substream_groups,decodable,selectable, andmembers[]:substream,role(main,music_and_effects,dialogue,dialogue_enhancementorassociated),group,content_classifier,language,channels.selected_presentation: the index of the presentation the decoder would decode by default, null where it would decode none.metadata, that presentation's as the stream sent it up to its last frame:presentation(its index),loudness(dialnorm_dbfsand Part 1 clause 4.3.12.3's further values, each null where the stream sends none),drc(eac3_profile,modes[]with each decoder mode's output level range and how it compresses,applied_mode),dialogue_enhancement(method,left,right,centre,max_gain_db) anddownmix(the Lo/Ro and Lt/Rt centre and surround gains,lfe_db,preferred, the loudness corrections), each null where the stream sends none.
An A-JOC substream's oamd_common_data() (§6.2.8.1), present when its
b_oamd_common_data_present flag is set, is read as part of the table of contents, and probe
reports it as oamd_common_data on the substream's entry. A group's own OAMD substream
(oamd_substream(), §6.2.2.4, which an object group can have, direct-coded or A-JOC) carries a
second oamd_common_data(): the decoder reads it from the frame, and probe reports
the first one the substream sends as oamd_common_data on the group's oamd member. Both are the
same object: b_default_screen_size_ratio, master_screen_size_ratio_code (null with the default
ratio), b_bed_object_chan_distribute, and a flag for each of the optional trim(),
bed_render_info() and headphone() of its add_data, trim_present, bed_render_info_present
and headphone_present, without their own fields. Either is null where the stream sends none. The
rest of an OAMD substream's payload, its timing and each object's metadata, is not reported.
stream.integrity has the same four members as the AC-3/E-AC-3 shape: crc_valid,
crc_failures, parse_failures and first_parse_error. Two of them hold something different
here. crc_valid is a boolean, true when no sync frame failed its CRC, where AC-3/E-AC-3 give the
number of syncframes that passed. parse_failures is 0 or 1, because the walk keeps only the
first error; first_parse_error names that error (truncated, lost_sync or
unsupported_bitstream_version) and is null when there was none. Exit code follows the same
rule as AC-3/E-AC-3: 0 only when every sync frame's CRC passed and every frame parsed. A content
signature after the last sync frame is not an error here (stream.content_signature describes it).
qc is loudness's bitstream-aware counterpart: loudness measures a source WAV before encoding, qc measures what a stream actually delivers after encoding and decoding it back, and checks that against what the stream's own metadata claims:
qc: programme.ec3 (E-AC-3, 3/2 + LFE, 48000 Hz, 938 access unit(s), 30.02 s)
layout=bed (BS.1770 Annex 1, Table 3 weights over the Table 5.8 bed)
measured (BS.1770-4 gated / EBU Tech 3342 / BS.1770-4 Annex 2):
integrated loudness -22.87 LKFS
loudness range 4.31 LU
true peak -1.62 dBTP
embedded metadata:
dialnorm 24 (claims dialogue at -24.00 LKFS)
compr absent
dialnorm check:
claimed -24.00 LKFS (from dialnorm 24)
delta +1.13 dB (measured - claimed; positive = measured is louder)
measurement-derived dialnorm would be 23, not 24
Add preset=<name> (or preset=all) to gate that same measurement against a named delivery spec instead of just reporting it — see Options & grammars for the exact preset numbers and the primary source cited for each, and this page's own exit-code note below. The presets are ebu-r128-s2, atsc-a85, atsc-a85-streaming, netflix and apple-music-atmos; each verdict prints the document version and date it was judged against.
layout= chooses which soundfield is metered. The default, layout=bed, measures the independent substream's own Table 5.8 bed through BS.1770 Annex 1's basic algorithm — which is all qc has ever measured, and on an Atmos or 7.1.4 stream that leaves every dependent substream's height, wide and rear channel out. It now says so rather than reporting the bed as though it were the whole programme. layout=rendered measures the assembled program instead, through BS.1770-5 (11/2023) Annex 3's extended algorithm, which weights each channel by its position and so has a weight for every Table E2.5 location:
qc: atmos.ec3 (E-AC-3, L C R Ls Rs Lrs Rrs Vhl Vhr Lts Rts LFE, 48000 Hz, 62 access unit(s), 1.98 s)
layout=rendered (BS.1770-5 Annex 3, weighted by channel position)
For a plain 5.1 stream both settings give the same number, by construction — see Options & grammars for the weighting table and the one Table 5.8 layout where the two algorithms disagree.
Neither layout= setting sees a dynamic object's own position — both meter channels, and this project's own encoder folds every object onto the flat 5.1 ring at encode time regardless of where it was authored. objects=<layout> re-renders a dynamic-object-only programme's objects by their own OAMD position instead, onto a chosen layout, per ITU-R BS.1770-5 Annex 4:
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)
See Options & grammars for why this needs a dynamic-object-only programme and what a bed-and-objects one gets instead. It reads an E-AC-3 stream's JOC objects: qc given objects= with an AC-4 stream refuses the run (exit 1), and an AC-3 stream is refused too (exit 2). layout= and preset= work on AC-4 as on the other two.
qc's exit code is 0 only when the file decodes cleanly and (if a preset was given) every requested gate passes, which is what makes it usable as an actual CI/pipeline QC step: forge qc out.ec3 preset=ebu-r128-s2 || echo "loudness QC failed". With no preset= at all it only ever measures and reports (no verdict to fail), so a plain forge qc <file> is non-zero solely on an input error. The two non-zero halves are now distinct: 6 means a gate failed (a result), 2 means the stream could not be read (a fault) — see Exit codes below, so a pipeline can react differently to each:
forge qc out.ec3 preset=ebu-r128-s2
case $? in
0) echo "in spec" ;;
6) echo "out of spec" ;;
*) echo "qc could not run at all" ;;
esac
qc of a TrueHD or MLP stream¶
A TrueHD or MLP stream has an integrity gate where the other codecs have a clean decode, and the same preset gates on the loudness. The stream is decoded leniently so that every failure is counted and reported, not only the first:
integrity (TH spec 6.2 parity and CRC, 7.3 lossless check, 18 data rate):
access units 2400 read, 0 byte(s) skipped, 0 unreadable PASS
checks 0 failed (check nibble, major sync, restart header, parity, segment CRC) PASS
lossless check 36 interval(s) ok, 0 failed PASS
data rate 18.00 Mbit/s declared (field 6000, ...), largest unit 3.30 Mbit/s, 0 unit(s) start before the unit ahead has arrived (worst 0.00 ms short) PASS
stream end 1 terminator word(s) at most in a substream, 0 not in the last unit, 0 illegal word(s) after the last block, 0 zero_samples count(s) of 4096 or more PASS
integrity verdict: PASS
It fails on a unit or a byte the reader does not take for an access unit, on any failed check of any substream, on a restart interval
whose lossless check fails (two streams joined end to end fail at the join: libs/truehd/ERRATA.md, question 20), and on a stream that
cannot be sent within the peak rate it declares and TH spec section 18's 75 ms, by the model the encoder keeps itself to. The declared
rate is the peak-rate field in bits per second, (raw x sample rate + 8) >> 4 (TH spec v3.9 section 4.4, ERRATA question 12); the rate
check is provisional all the same, since the model is the encoder's own and no player has been asked. It also fails on a stream's ending
that a player refuses (TH spec section 16.5; the DEE findings report spec-answers-2026-11-04, D10, which holds each rule as verified against a licensed
player): a terminator word (terminatorA with its zero_samples count, or 0xD234D234) in an access unit that is not the last, anything but zero bits
after the last block of the last unit that is not one of those words, and a zero_samples of 4096 or more. A stream with no word at its end is as
good as one with it. The decoder is as lenient as it was and takes all of these; qc only counts them. A word in the last unit that begins 0xD234
and is neither form is the 'illegal word' of the line; a word right after the last block, with zeros after it, counts as a word, and the object
substream's 0x1234 is not looked at. Then, for each presentation the stream has (2, 6 and 8 channels for one,
two and three substreams), the integrated loudness, loudness range and true peak with the BS.1770-5 Annex 3 weights loudness uses, and
the dialogue norm the stream carries beside the measurement (as E-AC-3's qc does: the claim, the difference, and the norm the
measurement implies, noting a presentation whose control-enabled bit is off). preset= judges the largest presentation, or the one
truehd-presentation=2ch|6ch|8ch names; the others are reported and not gated. The comparison of the dialogue norm with the measurement
is a report and not a gate, as it is for E-AC-3, and it is provisional with no oracle until the DEE set (libs/truehd/ERRATA.md,
questions 51 to 55). The exit status is 6 when the integrity gate or a preset gate fails, 2 when nothing reads as a TrueHD stream, and 0
otherwise. layout=, objects=, programme= and the rest are refused by name. An MLP stream is checked and measured too; its bytes
at the channel meaning's place are not described, and the report says so.
Stream tools — an encoded stream in, an encoded stream out¶
Everything above takes PCM. These five take an already-encoded AC-3/E-AC-3 elementary stream
(transcode AC-4 too), and four of them never touch a coded coefficient at all.
| Command | What it does |
|---|---|
transcode |
Decode and re-encode. The only one here that re-encodes, because DD+ and DD are different codecs and nothing else bridges them — the route to an optical link or an AC-3-only HDMI sink, which had no route at all before. It also goes between AC-4 and AC-3 or E-AC-3, either way — see below |
metadata |
Rewrite dialnorm, compr, bsmod, dsurmod on an existing stream and re-stamp its CRCs (a TrueHD stream takes the truehd- options of its channel meaning instead). The audio bytes are copied through untouched. A field the stream does not transmit is refused, naming insert; with insert an E-AC-3 stream gets the field added to every independent substream, and each syncframe that gains one grows by a word or two (the rate rises by about 16 bits a frame at most). An AC-3 stream cannot take it, nor can a frame with block start information or auxiliary data |
normalize |
The measurement-driven case of the above: decode to measure BS.1770-4 integrated loudness, write the dialnorm ATSC A/85 §8 implies, change nothing else (for a TrueHD stream, see below) |
cut |
Extract on access-unit boundaries (a TrueHD or MLP stream: from the first major sync at or after the start) |
cat |
Join streams end to end (TrueHD or MLP: each input must open with a major sync and match in shape) |
transcode carries the source's metadata across rather than resetting it:
dialnormverbatim. §5.4.2.8 says it "shall affect the sound reproduction level", so a transcode that reset it to 31 would play a programme up to 30 dB loud on a levelled system.dialnorm=<n>ordialnorm=autooverrides it.<n>is written verbatim;automeasures the source with the same BS.1770 passnormalizemakes, not the routed or folded output. The encoders do not write the value 0, which §5.4.2.8 reserves, so a source carrying it indialnormordialnorm2stops with an error untildialnorm=ordialnorm2=names a value.comprverbatim — the source's own 8-bit word is stamped back onto each encoded frame rather than re-derived. §7.7.2's ceiling describes the programme, not this generation's coding. Passingheavyasks for a freshly derived one instead.- The mix metadata, converted: AC-3 carries two coarse levels in
bsiand E-AC-3 carries the richermixmdategroup, so crossing between them maps the Lo/Ro pair (or the Lt/Rt pair, whendmixmodsays that is the intended downmix) onto the nearest level the target format has, by linear coefficient rather than by table position.dmixmodand the LFE mix level carry across as they are. dynrngdoes not carry. It is a per-block word derived from the signal, with nobsifield to stamp it into the waycomprhas, so a re-encode has to produce its own — passdrc=<profile>for that. The command reports what the source carried, so the difference is visible rather than discovered.
A layout AC-3 cannot code (7.1, 5.1.4, 7.1.4) folds down to 5.1 per §7.8 using the mix levels
just carried across, and says so on stderr — it is a real change to what the listener hears, not
a detail. The output codec comes from the output name's suffix (.ac3/.ec3/.ac4);
codec=ac3|eac3|ac4 covers stdout and any name the suffix cannot speak for. The input may be a
Matroska, MP4 or MPEG-TS container, as for decode.
transcode and AC-4¶
An AC-4 source becomes one programme: the presentation presentation=, presentation-id=,
language= and associated= choose, as decode
chooses one, its substreams mixed at dialogue-gain= and associated-gain=. It is decoded as
coded, with no output level and so no DRC, because ETSI TS 103 190-1 clause 5.7.9.4 asks a
transcoder to apply none and to hand the AC-3 or E-AC-3 encoder the DRC profile the stream names
for it instead (drc_eac3_profile; libs/ac4/ERRATA.md records why that is the field the
clause means). What carries:
dialnorm, to the dB: AC-4 sends it in steps of 0.25 dB, AC-3 and E-AC-3 in whole dB, so -23.5 dBFS becomes 24.dialnorm=<n>anddialnorm=autooverride it,automeasuring the presentation as coded.- The DRC profile.
drc_eac3_profile's film standard, film light, music standard, music light or speech becomes the re-encode'sdrc=, which computes itsdynrng; its "None" and the reserved values mean none.drc=<profile>overrides it. - The downmix values. The Lo/Ro and Lt/Rt centre and surround gains become E-AC-3's mixing
metadata (a surround gain of 0 dB, which E-AC-3's table reserves, goes to -1.5 dB), or AC-3's
two
bsilevels from the pair the stream prefers; Lt/Rt for Pro Logic II, which A/52 has no code for, goes as Lt/Rt; and the LFE's gain, in AC-4's half-dB steps, goes half a dB up to E-AC-3's whole dB.
A 7.X presentation keeps its last pair in E-AC-3, at the Table E2.5 locations AC-4's speakers
have: the back pair as Lrs/Rrs, the wides as Lw/Rw and the top front pair as Vhl/Vhr.
AC-3 has none of them, so for AC-3 the element folds to 5.X as AC-4 folds it (TS 103 190-1 Table
219), and channels=5.1 asks for that fold for E-AC-3 too. A [layout] argument is routed from
the decoded channels as it is from a WAV file.
The other way, an AC-3 or E-AC-3 source's dialnorm goes to AC-4 in whole dB, and its downmix
values to AC-4's (Part 2 clause 6.2.9's custom downmix data) where the output is 5.X: E-AC-3's
mixing metadata and AC-3's Annex D levels are the same values AC-4's tables hold, AC-3's two
bsi levels become the Lo/Ro pair, dmixmod the preferred downmix, and the LFE's whole dB goes
half a dB down to AC-4's steps, so the two directions undo each other. The source's dynrng and
compr words name no profile, so the AC-4 stream sends DRC only when drc=<profile> names one.
AC-4's encoder takes mono, stereo, 5.0 and 5.1 at 48 or 44.1 kHz: a source of 3/0 to 3/2 without
an LFE becomes 5.0, a wider one folds to 5.1 per §7.8, and 1+1 (two programmes AC-4 would need two
presentations for), 32 kHz, and the AC-3 and E-AC-3 options with no AC-4 counterpart (heavy,
drc2=, dialnorm2=, mixmeta, infomdat, annexd) are refused. The bitrate defaults to 192
kbps for AC-4 and 448 for AC-3 and E-AC-3.
forge transcode broadcast.ac4 optical.ac3 448 language=en
forge transcode programme.ec3 programme.ac4 256 drc=film-light
cut and cat move whole access units — an E-AC-3 access unit being an independent substream
plus its dependents, never one syncframe. A start time inside a unit names that whole unit; a
cut is never a split. That makes the round trip exact:
forge cut programme.ac3 head.ac3 0 0.512
forge cut programme.ac3 tail.ac3 0.512
forge cat rejoined.ac3 head.ac3 tail.ac3
cmp programme.ac3 rejoined.ac3 # identical
cat takes its output first, unlike every other command here, because the input list is
variadic. It refuses inputs whose codec, sample rate, coding mode, LFE presence, rendered
channel count or substream-per-unit count differ from the first — a decoder walking the join has
no way to be told the format changed.
strmtyp 2, a convertible substream (§E2.3.1.1, "previously coded in AC-3"), is an
independent substream like any other to all five: metadata and normalize rewrite its fields
and keep the blkid and frmsizecod it carries, cut and cat move its access units whole, and
probe names the AC-3 frame size code it was converted from. What is not here is the conversion
to or from AC-3 that gives the type its name: the standard specifies the signalling and no process,
and nothing in this project produces or consumes a type 2 stream.
AC-4 and the four that copy. metadata, normalize, cut and cat frame AC-3 and E-AC-3
syncframes and do not read AC-4: given an AC-4 stream they stop with exit 2 (lost sync:
expected 0x0B77). strip-objects refuses an AC-4 stream the way it refuses AC-3 (exit 2, only
Annex E frames can carry an object layer).
What metadata cannot do: only fields already on the wire can change. compr lives behind
compre and E-AC-3's bsmod/dsurmod behind infomdate; a stream that did not transmit one
has no bits to overwrite, and inserting them would re-frame the syncframe, which is a re-encode
by another name. Such a request is refused with a reason rather than half-applied. This
project's own E-AC-3 encoder never sets infomdate, so bsmod/dsurmod are AC-3-only in
practice; dsurmod additionally exists only for coding mode 2/0 (§5.4.2.7).
Projects — a Forge project file, run¶
| Command | What it does |
|---|---|
project |
Encodes what a Forge project file (.forgeproj, the format) says: the sources, the channel plan, the assignments and the encode settings, by running the commands they stand for. forge project song.forgeproj writes the stream (or the container's file) beside the project, named for it; forge project song.forgeproj out.ac3 says where, and print shows the commands it would run and runs none of them. A project of codec truehd runs forge truehd-encode (and mkv, mp4, ts or spdif for a container) |
forge project examples/karaoke/auld-lang-syne/auld-lang-syne.forgeproj out.ac3
forge project examples/karaoke/auld-lang-syne/auld-lang-syne.forgeproj print
It is the line the Forge GUI's command bar shows for the same settings, so the
commands are the ones that already exist and nothing is done differently: the same parsing, the
same refusals, the same bytes. The project's encode settings are the command line's own words
(dialnorm=, drc=, bsmod=, ...), its tools and vbr are the tokens eac3-encode takes,
and a key forge knows that the window has no control for is passed through as it was written.
A project says what to encode, not where: its paths are relative to its own folder.
AC-4 is ac4-encode with the project's own words (frame-rate=, codec-mode=, dialnorm=, ...),
and into an MP4 file it is the one command, which writes the file itself, as the window's line does.
An AC-4 object session is atmos-encode ... codec=ac4 with its scene, src=, map= and offsets.
With more than one source the project says where each channel goes (bed and assignments, which
the window writes when it saves), because the commands refuse a channel nobody placed. A karaoke
project that names its sources' parts (backing, melody, vocal1, vocal2) and says nothing
else of the layout does not have to: the parts are laid out where Annex C's Table C.2.1 puts them,
with the service set to bsmod 7 unless it names one, which is what the window's Karaoke flow
does for the same parts. A file that is not a project, or is a newer version than this forge
reads, is refused with its reason and exit code 2; a project with nothing to encode, or something
forge cannot run, exits 1.
Containers¶
| Command | What it does |
|---|---|
spdif |
Wraps AC-3, E-AC-3 or AC-4 as IEC 61937 bursts inside a playable PCM16 WAV — the stream's bsid, or its AC-4 sync word, decides which, and the E-AC-3 carrier runs at four times the content sample rate. AC-4 goes in IEC 61937-14's bursts, the smallest of AC-4, AC-4 HBR4 and AC-4 HBR16 that holds the stream's largest frame, on the link its frame rate gives (HBR16's as eight channels at a quarter of the link rate). An E-AC-3 stream with a second independent substream (a second language, an audio description) goes in as one programme, as play sends it: programme=<0..7>, or the first the stream carries (said as programme 0 of 2 (0, 1)), cut out and renumbered as substream 0 when it is not 0 already — never both programmes' bursts one after the other, which a receiver would lock onto as the main at half speed. For feeding a receiver through an ordinary audio path |
unspdif |
The inverse of spdif: reads IEC 61937 bursts back and writes the AC-3, E-AC-3 or AC-4 elementary stream inside them. Takes the WAV spdif writes, a capture of an S/PDIF or HDMI input, or a bare dump of carrier bytes with no RIFF header at all — the data type in Pc decides AC-3, E-AC-3 or AC-4, and both 16-bit word orders are read. Nothing is re-encoded: the output is what the source sent, byte for byte. - works on either end — a capture tool piped straight in, the stream piped straight out — with the report going to stderr, same convention as encode/decode |
mkv |
Wraps AC-3 or E-AC-3 as Matroska, reading format/packet boundaries/sample rate/channel count from the bitstream itself so the container can't be told the wrong ones. The input may itself be a container — Matroska/MP4/MPEG-TS are sniffed by content, not by name — which is what makes mkv/mp4/ts container-to-container remuxers as well as encode targets. AC-4 is refused: Matroska's codec specification registers no codec ID for it, and a file under one of this project's invention would be one no other reader could name. So is an AC-3 core with E-AC-3 dependents (A/52 §E2.3.1.2): A_AC3 covers bsid 10 and below and A_EAC3 11 to 16, and neither names a stream that is both. A stream with several programmes keeps its first, with a warning — the muxer writes one track — and programme=<0..7> picks another, renumbered as substream 0 |
mp4 |
Wraps AC-3, E-AC-3 or AC-4 as a single-file MP4/ISOBMFF (an AC-4 input takes TS 103 190-2 Annex E's ac-4/dac4 path, with the Annex E.13 codecs string reported), writing a spec-correct dac3/dec3 sample-entry box (fscod/bsid/bsmod/acmod/lfeon, plus the Atmos complexity-index extension for JOC content) read straight off the bitstream — never off whatever a container INPUT declared, which is the dec3-repair case: a source with a broken or missing Atmos dec3 flag gets a correct one on the way out. A stream with several programmes (§E2.3.1.2's independent substreams) keeps every one: an E-AC-3 sample is the syncframes of every substream present (TS 102 366 F.2), the dec3 carries one block for each, and data_rate is their sum; programme=<0..7> writes that programme alone, renumbered as substream 0, for a player that takes only the first. An AC-3 core with E-AC-3 dependents is an ec-3 entry whose dec3 carries the core's bsid, and chan_loc is filled in from the dependents' chanmap (Table F.6.1) |
ts |
Wraps AC-3, E-AC-3 or AC-4 (DVB profile only — EN 300 468 Annex D.7; atsc is refused for AC-4) as an MPEG-2 Transport Stream (PAT + PMT + one PES-wrapped audio PID), identified per whichever broadcast profile the optional third argument names — dvb (the default) or atsc. Every programme of a multi-programme stream rides in each PES payload (A/52 Annex G §3.3), which is what the descriptor's substream1-substream3 fields describe; programme=<0..7> writes one alone. See below |
demux |
The inverse of mkv: reads a container and writes the bare AC-3/E-AC-3 elementary stream inside it (an AC-4 track as sync frames), which is what every other command here takes as input. The container is identified by its own magic bytes, never by the file name — a rip called title00.mkv that is really something else, or one with no extension at all, is the normal case. Unlike the wrapping commands it streams: the reader is fed in 64 KiB chunks and each access unit is written as it comes out, so peak memory is a chunk plus a frame whatever the file's duration. Matroska/WebM, MP4 (plain and fragmented) and MPEG-2 Transport Stream (188/192/204-byte packet grids; DVB, ATSC and registration-descriptor codec signalling all read). An MP4 whose moov follows its mdat is read from a file path by walking the boxes and jumping over mdat, then reading each sample where the sample table says, in the same bounded memory; from a pipe it is refused with an explanation rather than read wrong, since a pipe cannot go back for the table. An MP4 whose audio track is protected with Common Encryption (an enca sample entry) is refused, exit 2, and nothing is written: the error names the track, its scheme, its original format and its default KID (track 2 is protected (cenc, original format ec-3, default KID a1b2c3d4-e5f6-0718-293a-4b5c6d7e8f90); decryption is not supported), and a track that holds a clear sample entry beside a protected one (a clear lead-in) is refused whole. probe, decode, qc and the other commands that open an MP4 say the same. A Matroska audio track that declares ContentEncryption, and an MPEG-TS audio PID whose packets have transport_scrambling_control set, are refused the same way (exit 2). For MPEG-TS the destination gets the concatenated PES payloads rather than a guaranteed one-access-unit-per-payload split, since PES makes no such promise — the status line omits sample rate/channels for it, since a transport stream's PMT names the codec but not those |
remux |
Container-to-container in one step: mkv/mp4/ts under the hood, picked by out_path's extension (.mkv/.webm, .mp4/.m4a/.mov, .ts/.m2ts) since a file that doesn't exist yet has no bytes to sniff. The input is still identified by its own magic bytes, exactly as demux's. [dvb\|atsc\|bluray] is passed through when the target is a Transport Stream and ignored otherwise; without it a .ts is DVB for AC-3, E-AC-3 and AC-4 and Blu-ray for TrueHD and MLP, which only bluray carries |
fmp4 |
Writes fragmented MP4/CMAF — an init segment plus one media segment per fragment — alongside an HLS media+master playlist pair and a DASH MPD, all pointing at the same segments, ready for a real HLS/DASH origin or packager. [frames_per_fragment] defaults to 48 access units per fragment, about 1.5 s at 48 kHz. Atmos content signals itself automatically and completely: CHANNELS="<N>/JOC" in the HLS playlists, the two EC3_ExtensionType/EC3_ExtensionComplexityIndex supplemental descriptors ETSI TS 103 420 clause D.2 defines in the MPD, and the ceao compatibility brand its Annex E requires on the segments. Every representation also states its channel configuration, on the Dolby scheme TS 102 366 clause I.1.2.1 defines. fallback-51 additionally writes the paired 5.1 rendition. AC-4, bare or in MP4, is fragmented as ETSI TS 103 190-2 Annex H has a CMAF track: each fragment starts at an I-frame, the first once it holds frames_per_fragment frames; each sample that is not an I-frame is listed with its flags; the track counts in Table E.1's time scale (240 000 at 29.97, 59.94 and 119.88 fps); its brands are ca4m and ca4s; and the manifests carry the codecs parameter, the channel configuration (Annex G's Table G.1, or the Dolby 2015 scheme) and the frame rate of the presentation with the widest compatibility. A stream Annex H.1.2 does not allow in a CMAF track is refused, naming the rule |
ts broadcast profiles¶
ATSC and DVB both register AC-3/E-AC-3 for MPEG-TS carriage, with different, non-interoperable signalling — so a stream satisfies one of them, never a bit of each:
dvb (default) |
atsc |
|
|---|---|---|
AC-3 stream_type |
0x06 (PES private data) |
0x81 (A/52 Annex A §A4.1) |
E-AC-3 stream_type |
0x06 |
0x87 (A/52 Annex G §G3.1) |
| AC-3 descriptor | AC3_descriptor, tag 0x6A (ETSI EN 300 468 Table D.6) |
AC-3_audio_stream_descriptor, tag 0x81 (A/52 Table A4.1) |
| E-AC-3 descriptor | enhanced_AC-3_descriptor, tag 0x7A (Table D.7) |
E-AC-3_audio_descriptor, tag 0xCC (A/52 Table G.1) |
Either way the descriptor's identification fields are read off the bitstream, not guessed: the
service type (bsmod), the channel mode and rendered channel count, the surround mode
(dsurmod), bsid, whether mixing metadata is present, and which independent substreams the
stream uses. Two values are not in any bitstream, because they describe how services in a
multiplex relate rather than what one stream contains, so they are omitted unless given —
and checked against the stream's own bsmod either way: asvc= on what Table 5.7 calls a main
service, or mainid= on what it calls an associated one, is a usage error rather than a
descriptor that quietly says the wrong thing.
| Option | What it says |
|---|---|
mainid=<0-7> |
The main-service number this service is (only valid on a main service) |
asvc=<mask> |
Which main services an associated service may be reproduced with, one bit each — decimal, 0xNN, or a comma-separated list of main-service numbers (asvc=0,2) |
Reading a .ts back out (iclforge::containers::mpegts::demux/Reader) decodes the same descriptor into
ReadStream::service — see muxing-and-sinks.md
for what does and does not survive the round trip.
Live & hardware¶
Needs the platform's capture, passthrough, monitor or spatial backend — see the per-OS Platform notes pages (Windows, Linux, Raspberry Pi, macOS, Android) for what's actually confirmed against real hardware on each OS.
| Command | What it does |
|---|---|
devices |
Lists capture endpoints (microphones, playback-device loopbacks) |
outputs |
Lists render endpoints and whether each supports AC-3/E-AC-3 passthrough |
identify |
Walks the identify tone across an output's speakers: pink noise on one rendered channel at a time, placed by the routing patch, so which speaker each channel reaches can be heard rather than assumed. The stream is opened at the device's own channel count and each rendered channel placed by the patch — see identify below |
record |
Captures from a device straight to a file, metering live. layout=/codec= choose the shape (any layout up to 7.1.4, AC-3 or E-AC-3; with codec=ac4, AC-4 in mono, stereo, 5.0 or 5.1), container= the wrapper (raw, mkv, ts, spdif, fmp4), watchdog= how long a silent device is tolerated. If the endpoint turns out to be bitstreaming IEC 61937 rather than delivering PCM (an HDMI/S/PDIF capture card, or a loopback of a player set to bitstream), record recognises that within about a quarter of a second and writes the elementary stream instead of encoding the bursts as if they were audio — see passthrough capture below |
play |
Exclusive-mode IEC 61937 passthrough of an existing file, bare or inside a container — bsid decides AC-3 vs. E-AC-3. When a device_index is named, play follows the sink: a source format it rejects gets transcoded to AC-3 or decoded to PCM automatically instead of refused — see Following the sink below. AC-4, which no receiver found takes over IEC 61937, is decoded and played as PCM, as monitor plays it (follow=off, which asks for passthrough alone, refuses it with exit 4) |
monitor |
Decodes an existing file, bare or inside a container, and plays it on an ordinary, non-bitstreamed output — the shared-mode preview path. For an Atmos-mode stream, this plays the 5.1 bed and reports the object count found: the decoder reads TS 103 420's object layer (OAMD/JOC) but this path does not render or export objects, so this is what a legacy decoder hears, not unmixed objects — use decode with objects_dir for the object audio itself. An AC-4 stream plays the presentation presentation= and the rest choose, with decode's output level, DRC, dialogue enhancement and downmix options; on an endpoint with fewer channels than the presentation it folds by the stream's own downmix. It plays the channels a presentation decodes to: the layout renderer that puts a presentation's objects on speakers belongs to decode (and to Hearth), not to monitor or play. An E-AC-3 stream with a second independent substream (a second language, an audio description) plays one programme, as decode does: programme=<0..7>, or the first the stream carries, said as programme 0 of 2 (0, 1). play sends a receiver that programme alone, cut out and renumbered as substream 0 when it is not already. |
spatial |
Decodes an E-AC-3 stream's object layer and hands the objects to the platform's spatial renderer, each at its own OAMD position — the one playback path that renders objects as objects rather than as a bed. Windows only today; see spatial below |
live |
Capture → encode → optional live monitor and/or IEC 61937 passthrough, running continuously, still writing the file record always has. Everything record takes, plus a second clock-conformed capture device (capture2=), an object-slot budget and map= binding (objects=, mode=atmos), and a parallel 5.1 AC-3 leg for an AC-3-only receiver (downmix=) |
live's device arguments: monitor_device/passthrough_device take -2 (default, leaves that
leg off), -1 (the default render endpoint), or an index from outputs. Either or both legs may
run alongside the file live always writes.
live mode (also shared with atmos): channels (default) encodes the captured channels onto
layout= — stereo by default, anything up to 7.1.4 — placing them by direction the way encode
places a file's; atmos pans capture channels into a 5.1 bed as objects, moving each one every
frame the same way atmos's synthetic orbit does, unless positions= names a real live position
source instead — see Live object positions over OSC below. layout=/codec= describe a
channel session only; mode=atmos always encodes the TS 103 420 shape and refuses either.
Take shape and durability. record and live both take layout=, codec=,
container=raw|mkv|ts|spdif|fmp4 (cmaf is an accepted alias for the last) and
watchdog=<seconds> (see
Options & grammars).
codec=ac4 encodes AC-4 (ETSI TS 103 190) in mono, stereo, 5.0 (layout=L,C,R,Ls,Rs) or 5.1 at
48 or 44.1 kHz, with dialnorm= and drc='s profile, an I-frame every 24 frames. raw writes its
sync frames with their CRC, ts the DVB signalling ts writes, spdif IEC 61937-14's bursts,
and fmp4 a CMAF track fragmented at I-frames as fmp4 fragments one; mkv is refused, as the
mkv command refuses AC-4. live's monitor decodes the AC-4, and its passthrough receiver gets
the parallel 5.1 AC-3 leg below, since no receiver found takes AC-4 over IEC 61937.
All five containers are written incrementally, as the take runs, through the same
RecordingSink the GUI's own takes go through — so a take costs one frame of memory rather than
the whole session, and a crash an hour in leaves an hour of playable file. A capture device that
stops delivering audio ends the session as a failure (exit 5) rather than leaving it looking
healthy with nothing coming in; whatever was already written stays on disk.
Objects on a live session. live mode=atmos allocates its object slots once, at session
start — objects=<N> sets the budget, map= binds capture channels to slots with the same
obj/objm/none grammar the Format tab's assignment table uses (see
Options & grammars). A slot with nothing bound to
it is carried silent rather than changing the object count a decoder read from the first access
unit.
Live object positions over OSC. positions=<scheme>:[<bind>:]<port> (mode=atmos
only — refused with mode=channels, since there are no objects to place) swaps the built-in
synthetic orbit for a real live position source: a show-control rig, a DAW, or any OSC 1.0 sender
addressing this session's objects over UDP. The token is scheme-prefixed on purpose — only osc
exists today, but a MIDI source (positions=midi:...) or a desktop game controller
(positions=gamepad:...) can land as new schemes later without a grammar change. Neither MIDI
nor gamepad is implemented yet.
<bind> is local (the default — binds 127.0.0.1, loopback only), any (binds 0.0.0.0,
every interface — a real security-relevant choice, not just a technical one: it opens the port to
whatever else can already reach this machine, not just this process), or a dotted-quad IPv4
literal. Never a hostname — there is no DNS resolution, so starting a session never blocks waiting
for one to resolve. <port> is 1-65535.
positions=osc:9000 # loopback, port 9000 (the default bind)
positions=osc:any:9000 # every interface
positions=osc:192.168.1.50:9000 # bind to one specific local address
Once bound, the listener understands one address space, <n> 0-based and matching scene order:
| Address | OSC type tag | Arguments |
|---|---|---|
/object/<n>/xyz |
,fff |
x, y, z (float32) — the same room-anchored axes atmos-path's own scene grammar uses (see x/y/z above and Library → Spatial & Atmos) |
/object/<n>/gain |
,f |
linear gain (float32), not dB |
/object/<n>/lfe |
,f |
linear lfe_send (float32) |
/object/<n>/release |
, |
no arguments — hands the object back to the orbit's own starting point |
Any other address, or a message with the wrong argument count or type, is silently dropped and
counted rather than treated as fatal to the session — a show-control rig sends plenty of traffic
this listener has no use for, and none of it should end a take. A /gain or /lfe message that
arrives before that object's first /xyz is held pending rather than applied or dropped, and takes
effect the moment a position follows it.
A bind failure — most often the port already in use — refuses the whole session (exit 4,
kExitUnavailable) rather than silently falling back to the orbit. That is deliberate, and
different from monitor=/passthrough=: those are output legs whose absence still leaves a
correct file behind, but positions= is an input — a silent fallback would put a different
scene in the recorded file than the one asked for, discoverable only at playback.
An object nothing has addressed yet holds exactly where the orbit's own formula would have started
it at t=0 — still spread apart from its siblings (objects sharing a direction are exactly what JOC
cannot separate, which is why the orbit spreads them at all) — at this session's own gain law
(0.7 / sqrt(N), the same one the orbit itself uses). A session with positions= on but nothing
yet addressing some of its objects therefore degrades gracefully: those objects sit still and
audible, never silent, never snapped to room centre.
Status lines at session start and end report what actually happened (the text is in
apps/forge/cli/src/commands/live_audio.cpp, searchable as "positions:"):
positions: OSC on 127.0.0.1:9000, objects 0-3 (/object/<n>/xyz|gain|lfe|release)
...
positions: 812 datagrams, 796 updates applied, 12 dropped
Testing it. Any OSC 1.0 sender works — TouchOSC, a DAW's OSC output, or a few dependency-free lines of Python:
import socket, struct
def osc_xyz(obj, x, y, z):
addr = f"/object/{obj}/xyz".encode() + b"\0"
addr += b"\0" * (-len(addr) % 4) # pad to a 4-byte boundary
tags = b",fff\0\0\0\0" # ",fff" padded the same way
return addr + tags + struct.pack(">fff", x, y, z)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(osc_xyz(0, 0.8, 0.2, 0.0), ("127.0.0.1", 9000))
That starts a 60-second object session listening on loopback port 9000; the Python snippet above
moves object 0 to x=0.8, y=0.2, z=0.0 — front-right of the room, at listener height — while it
runs.
An AC-3-only receiver. When the session's stream needs E-AC-3 but the chosen
passthrough_device only bitstreams plain AC-3, live sends it a parallel 5.1 AC-3 encode of the
bed the main plan already computed, while the file and the monitor still carry the full stream.
An AC-4 session's receiver always gets that leg. downmix=off restores the plain refusal.
identify — hearing which speaker a channel reaches¶
Every other playback command hands audio to an output and trusts that the channels arrive where
they are meant to. identify is the one that checks. It plays pink noise on one rendered channel
at a time — the level an AVR's own test tone uses, and band-limited to 30–80 Hz for an LFE feed so
a subwoofer is not asked for midrange — and prints which channel and which output each burst went
to:
forge identify # the default endpoint, its own speakers, 2 s each
forge identify 0 7.1.4 3 # endpoint 0 from 'outputs', a 7.1.4 layout, 3 s each
forge identify 0 - 2 1,0,2,3,4,5 # the same, with the front pair swapped
forge identify 0 5.1 2 - -30 # quieter: -30 dB RMS instead of -20
The stream is opened at the device's own channel count rather than the programme's, and each
rendered channel is placed at the output a routing patch names
(iclforge::audio::PcmOutput, iclforge::render::Routing). That is what makes the check meaningful: an
eight-channel HDMI endpoint is driven as eight outputs, not as six channels for a mixer to
spread, and a channel with nowhere to go is reported as not patched instead of vanishing
silently.
The patch is built from the endpoint's speaker mask where the backend reports one, so a 5.1
programme on a 7.1 device lands on its front, centre, LFE and side pair and leaves the rear
pair silent — which is what the mask says those outputs are, and not what counting outputs from
zero would give. layout of - walks the device's own speakers; a named layout walks that
instead, which is how a narrower device shows what it cannot place.
A tone heard from a speaker other than the one the line names means the room is wired
differently from the patch. Pass a patch of your own to match it: one token per rendered channel,
each an output index or -.
spatial — objects on the platform renderer¶
spatial decodes an E-AC-3 stream's object layer and submits each reconstructed
object to the operating system's own spatial renderer at the position its OAMD carries, instead
of folding the objects into a bed first. On Windows that renderer is
ISpatialAudioObjectRenderStream, reached through iclforge::audio::SpatialObjectSink; no other
backend in the tree implements one, so on Linux, macOS and Android the command is listed and
reports itself unavailable — the same treatment the capture and passthrough commands get where
their backends are missing (Needs::kSpatial in apps/forge/cli/src/main.cpp, answered by
libs/audio/src/backend/<os>/audio_backend.cpp).
forge spatial programme.ec3 # the default endpoint
forge spatial programme.ec3 2 # an index from 'forge outputs'
Two refusals come before anything is decoded. A plain AC-3 input is rejected because only E-AC-3
carries the object layer, with the error naming monitor as the command that plays an AC-3 bed;
an AC-4 input gets the same refusal (exit 2), since spatial reads E-AC-3's object layer alone
and does not take AC-4's objects.
An endpoint with no spatial format enabled on it — GetMaxDynamicObjectCount reading zero — is
rejected with exit 4, rather than quietly falling back to an ordinary render path: that
fallback would make spatial indistinguishable from monitor while claiming to be something
else.
Every dynamic object goes out at its own position, converted from TS 103 420 §4.2.1's
room-anchored cube to the renderer's listener-relative metres; the bed's LFE goes out as a static
object, which is the only shape it can take (§6.3.2.2 never makes the LFE a JOC output, so it is
only ever a coded channel). The axis correspondence is exact. The metre scale is not: OAMD's cube
carries no absolute size, so the room half-extents in apps/forge/cli/src/commands/live_audio.cpp — 2 m to
each side wall, 2 m front and back, 1 m to ceiling and floor — are a plausible small room rather
than a measured one. Moving an object moves it in the right direction by the right proportion, at
an approximate absolute distance. The session prints its object count and endpoint at the start,
and the access units played, active dynamic objects and underruns at the end.
spatial builds its iclforge::ac3::DecoderConfig from the same options decode and monitor do, so the
decode-side tokens above (drc=, heavy, conceal=, fast-imdct=off) reach it, and
verify-objects checks each frame's object signature here as it does there, and gate-objects
renders the objects of the frames that verify and the bed of the rest. Two do not reach it:
run_spatial leaves fast-mdct=off and joc-domain= out of the config it builds, so the JOC
reconstruction on this path always takes the defaults — the fast forward MDCT, in the QMF domain.
The §7.8 output-stage tokens (channels=, downmix=) have no purpose here, since what reaches
the renderer is the objects rather than a fold — and they are not safe to assume harmless either:
run_spatial takes the bed's LFE from the decoded channel list's last entry, and a fold replaces
that list with its own output. What such a run actually submits has not been checked, so leave
both tokens off this command.
What is confirmed against hardware and what is not is set out on the Windows page: the sink has activated and rendered this project's own Atmos stream against an endpoint with Windows Sonic enabled, and the no-spatial-format refusal was confirmed against two endpoints. Nobody has yet listened and confirmed that the objects arrive from where their positions say they should.
Following the sink¶
When play is given a device_index, it first asks what that sink actually
accepts before committing to a format — its own EDID/ELD-carried CEA-861 Short Audio
Descriptors where a backend can read them (real today only on ALSA — see
Linux), the same live probe outputs uses everywhere else, noted on
stderr when that fallback happens. A source format the sink rejects then gets an automatic
fallback instead of a plain refusal:
- E-AC-3 on an AC-3-only sink is transcoded to AC-3 first (
transcode, run against a temporary file and cleaned up afterwards — dialnorm,comprand the mix metadata carry across exactly as a directforge transcodecall would), then that AC-3 plays the way a plain AC-3 source file always has. This is the "no 5.1 PCM over optical" case: an optical link can carry compressed AC-3 up to 640 kbit/s but never multichannel PCM, so a 5.1 E-AC-3 source has no other way through — what used to takeforge transcode in.ec3 tmp.ac3 448followed byforge play tmp.ac3 <device_index>is now one command. - A sink that bitstreams neither AC-3 nor E-AC-3 falls back to decoded PCM instead —
forge monitor's own path, which folds a wide programme down to the endpoint's real channel count per §7.8 rather than handing it to a shared-mode mixer to average down however it sees fit. - A sink that accepts neither a bitstream fallback nor PCM gets the plain refusal
playhas always given.
follow=off disables all of the above and restores that plain refusal unconditionally — 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 either, and it is taken at its word exactly as before.
AC-4 takes none of these 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 with follow=off, which
asks for passthrough alone, it refuses the stream (exit 4).
live container=fmp4: the output path names a folder, written as the session runs rather than
at the end — init.mp4 first, then a segment*.m4s for each fragment as it closes, with
audio.m3u8/master.m3u8/manifest.mpd rewritten each time. While the session is running those
manifests are live-shaped (no #EXT-X-ENDLIST, a type="dynamic" MPD with an
availabilityStartTime), so the folder is a servable origin mid-session; a clean stop flushes the
trailing partial fragment and closes both to their VOD/static forms. fmp4-window=<n> lists only
the last n segments, for an origin that deletes segments behind itself. Nothing is held in
memory beyond one fragment, unlike container=mkv/raw, which still accumulate the take. See
Options & grammars for the full
grammar.
live capture2=<index>: the capture_device positional stays the session's clock master, paced
exactly as it always has been; capture2= adds a second, independently-clocked device (see
Options & grammars for the full grammar) whose
stream is resampled to track the master, with the measured drift printed at session end.
Passthrough capture¶
A capture endpoint fed IEC 61937 hands the bursts over as ordinary PCM. Nothing in any capture
API says "this is Dolby Digital", so a recorder that takes the samples at face value encodes
noise. record and live both look for the burst framing — a Pa/Pb preamble every
repetition period with a 0x0B77 syncframe behind it — over roughly the first quarter-second of
each session, and act on what they find:
recordswitches to writing the elementary stream. Nothing is re-encoded, thebitrateargument stops applying, and the output is bit-identical to what the source sent. The carrier already gone past is kept, so the recording starts at the first burst rather than a quarter-second into it. A device running at a rate AC-3 cannot encode at — 192 kHz is exactly the E-AC-3 carrier's 4× — is no longer refused outright: that rate is now checked only once the bitstream question has been answered no.livestops with an error namingrecordandunspdif. A live session mixes, resamples a second device into lockstep, meters, monitors and can pan objects, none of which mean anything applied to burst data; switching modes mid-session would produce a file whose first quarter-second is a different thing from the rest.
For a capture already saved to disk, unspdif does the same job offline.
None of this has been confirmed against a real HDMI or S/PDIF capture device — see
Windows for exactly what is and is not verified
against hardware. What is verified is the framing itself, both ways, against FFmpeg's spdif
muxer as an independent oracle.
Self-description & scripting¶
| Command | What it does |
|---|---|
help |
With no argument, the whole usage listing. With a command name, just that command's row and the option grammars it actually uses — not the ~130 lines of prose an argument error used to print. help exit-codes prints the exit-code table below. |
man |
A section-1 groff man page on stdout, generated from the same command table. cmake --build writes it to forge.1 and cmake --install puts it under share/man/man1. |
completions |
A completion script for bash, zsh, fish or powershell on stdout, generated from the same table plus the option list. Installed under the conventional per-shell directories; the Homebrew formula places the bash and fish halves through Homebrew's own helpers. |
forge <command> --help (or -h) is forge help <command> spelled the other way round, and
works even when the rest of the command line would not have satisfied that command.
Every command also takes quiet (no status output at all — errors and, for a - output, the
payload) and verbose (the stderr progress line whatever the run's length). See
Options & grammars.
Exit codes¶
| Code | Meaning |
|---|---|
0 |
Success |
1 |
Usage — a bad or missing argument, an unknown command or option, or a configuration the encoder cannot express |
2 |
Input — unreadable, absent, or not a valid stream |
3 |
Output — the destination could not be created, written or finalized |
4 |
Unavailable here — this build or machine cannot run the command at all |
5 |
Runtime — the run started and then failed (a capture dropout, an output device that went away, a measurement with nothing to measure) |
6 |
A QC gate failed |
7 |
Internal — an exception escaped a command |
forge help exit-codes prints the same table with a sentence on each; see
Options & grammars for the full descriptions and a worked
qc example.
Next¶
Options & grammars — the options encoding commands take after their
positional arguments (and which commands ignore which), plus the full layout, tools and
vbr grammars.