feat(moq-mux): synthesize fMP4/CMAF init for AV1 video#1804
Merged
Conversation
The fMP4/CMAF init-segment writer could only synthesize a sample entry for H.264 and H.265; everything else fell through to UnsupportedSynthesis. Remuxing an AV1 MoQ broadcast to fMP4 (moq-cli subscribe/accept --format fmp4) therefore failed with "can't synthesize CMAF init for video codec AV1(...)". Add the AV1 case so synthesize_video_trak builds an av01 sample entry carrying an av1C box. A new av1c_from_av1 helper is the inverse of the existing av1_from_av1c (import direction), mapping the catalog AV1 config (profile, level, tier, bit depth, chroma subsampling, monochrome, sample position) into the AV1CodecConfigurationRecord. config_obus is left empty: moq-video publishes AV1 with the sequence header inline in the bitstream (the .av01 in-band case, like hev1/avc3), so the decoder reads it from the keyframe rather than the config record. Adds an AV1 export round-trip test plus unit coverage for the bit-depth flag inversion, and brings the moq-mux doc's supported-codec list up to date (it also omitted VP8/VP9). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
moq-mux's fMP4/CMAF init-segment writer could only synthesize a sample entry for H.264 and H.265; every other codec fell through toUnsupportedSynthesis. Remuxing an AV1 MoQ broadcast to fMP4 therefore failed:This adds the AV1 case so
synthesize_video_trakbuilds anav01sample entry carrying anav1Cbox.Changes
rs/moq-mux/src/codec/av1/mod.rs: newav1c_from_av1helper, the inverse of the existingav1_from_av1c(import direction). Maps the catalogAV1config (profile, level, tier, bit depth, chroma subsampling, monochrome, chroma sample position) into anmp4_atom::Av1c. Adds abitdepth_flagshelper (inverse ofbitdepth) for the(twelve_bit, high_bitdepth)flag pair.rs/moq-mux/src/container/fmp4/mod.rs:synthesize_video_traknow handlesVideoCodec::AV1, building anav01sample entry +av1C.config_obusis left empty. moq-video publishes AV1 with the sequence header inline in the bitstream (the.av01in-band case, analogous tohev1/avc3), so the decoder reads it from the keyframe rather than the out-of-band config record. The catalog's color fields (color primaries / transfer / matrix / full range) have no slot inav1C; they live in the sequence header OBU.doc/lib/rs/crate/moq-mux.md: brought the supported-codec list up to date (it also omitted VP8/VP9, which were already supported).Public API
No public surface changes.
av1c_from_av1/bitdepth_flagsarepub(crate); the new arm is inside apub(crate)function. No wire or breaking change.Branch targeting
Targets
devper CLAUDE.md: this is a catalog/container-format area change inmoq-mux.Test plan
cargo test -p moq-mux(265 passed) — newav1_source_to_cmaf_export_synthesizes_av01round-trips a synthesized init back to anav01sample entry with a well-formedav1C(emptyconfig_obus), plusbitdepth_flags_round_tripandav1c_round_trips_catalog_fieldsunit tests.cargo clippy -p moq-mux --all-targets -- -D warningscargo fmt --all --checkRUSTDOCFLAGS="-D warnings" cargo doc -p moq-mux --no-depsmoq-cli accept ... --format fmp4+ffprobe: not run locally (this Windows box lackspkg-config/ffmpeg for the full-workspace build); covered by the export round-trip test.(Written by Claude)