Adds E-AC-3 / Dolby Atmos (E-AC-3 JOC) support across the MP4 extractor and muxer.#3317
Adds E-AC-3 / Dolby Atmos (E-AC-3 JOC) support across the MP4 extractor and muxer.#3317rexjin-meta wants to merge 4 commits into
Conversation
|
Findings
|
5f86373 to
c00a263
Compare
|
Hey @FongMi and @snow2405 , Thanks for the reviews — addressed both comments:
Also added a unit test asserting the ec-3 fourcc on the audio sample entry. This PR will laser focus on enabling muxer to write atmos. |
|
cc: @andrewlewis This PR is the new attempt for my previously closed PR: #3312 (comment) |
c00a263 to
a6c9a99
Compare
|
Updated the PR to fix the extractor and muxer together, as suggested. Extractor: BoxParser now preserves the raw dec3 (EC3SpecificBox) payload in Format.initializationData when parsing the MP4 dec3 box — mirroring the existing av1C/dOps handling (box body without header). This is the piece that was missing. Muxer: implements the dec3 box + ec-3 fourcc and adds AUDIO_E_AC3 / AUDIO_E_AC3_JOC to the supported audio MIME types. With the extractor change in place, the default Transformer now correctly stream-copies E-AC-3 / Atmos (instead of transcoding), and it no longer risks the missing-csd-0 failure — the two changes are consistent across extractor, muxer, and transformer. Tests: added an end-to-end Mp4MuxerEndToEndParameterizedTest pass for sample_eac3.mp4 and sample_eac3joc.mp4; regenerated the extractor golden dumps (they now include the dec3 initializationData); BoxesTest covers dec3 wrapping, the ec-3 fourcc, and the missing/empty csd-0 guards. |
a6c9a99 to
94271bc
Compare
|
Reworked per your suggestion. Added FormatSpecificTransmuxingData (a Metadata.Entry in media3-container, boxType + raw data). The extractor now attaches the dec3 payload to Format.metadata instead of initializationData, so the E-AC-3 decode path is unchanged; the muxer reads it back from Format.metadata to write the dec3 box. Tests: BoxesTest covers dec3 wrapping, the ec-3 fourcc, and missing/empty-payload guards; Mp4MuxerEndToEndTest + FragmentedMp4MuxerEndToEndTest do a full Mp4Extractor → mux → re-extract round trip for mple_eac3(.mp4|joc.mp4). Extractor golden dumps regenerated. Made the entry general (boxType + data) rather than E-AC-3-specific — open to either. |
Introduce FormatSpecificTransmuxingData, a typed Metadata.Entry that
carries a raw MP4 box payload (the box body, without header) so it can be
reproduced when transmuxing without re-encoding.
Extractor: when parsing the MP4 dec3 (EC3SpecificBox), attach its payload
to Format.metadata as a FormatSpecificTransmuxingData("dec3", ...) entry
instead of Format.initializationData. This keeps E-AC-3's decode path
unchanged (no csd-0 is injected) while preserving the bytes for muxing.
Muxer: implement the dec3 box and ec-3 fourcc in Boxes.java, reading the
payload from the FormatSpecificTransmuxingData metadata entry, and add
AUDIO_E_AC3 / AUDIO_E_AC3_JOC to the supported audio MIME types in
Mp4Muxer and FragmentedMp4Muxer. The default Transformer can now
stream-copy (transmux) E-AC-3 / Dolby Atmos audio.
Tests:
- BoxesTest: dec3 box wrapping for AUDIO_E_AC3 and AUDIO_E_AC3_JOC, the
ec-3 fourcc, and guards for missing / empty dec3 payload.
- Mp4MuxerEndToEndTest and FragmentedMp4MuxerEndToEndTest: Mp4Extractor-
driven transmux of sample_eac3.mp4 and sample_eac3joc.mp4 (reads via
Mp4Extractor so Format.metadata is preserved).
- Extractor golden dumps regenerated to carry the dec3 metadata entry.
|
Hey @rexjin-meta |
Adds E-AC-3 / Dolby Atmos (E-AC-3 JOC) support across the MP4 extractor and muxer.