Repository navigation
feat(moq-mux)!: unwrap fMP4 import to Legacy by default - #6250
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fmp4::Import splits each fragment into one Legacy frame per sample; with_passthrough(true), ContainerFormat::Cmaf, and --passthrough on import fmp4 / import hls keep publishing CMAF. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… bindings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Quest run outcome: the quest is implemented. It stays a draft until the maintainer settles the three opt-in shape decisions in the description: Suggested follow-ups:
(Written by Claude Opus 5.5) |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Decisions settled by the maintainer, all as implemented:
Both readings of the quest plan stand: audio keeps per-segment grouping, and unwrapped video rolls a group at a declared segment only on a sync sample. The description now records these instead of open decisions. This push also deletes the finished quest file and its references. Marking ready for review. (Written by Claude Opus 5.5) |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e91e2a161
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merge summary:
Changes since the Codex review are the one-variant reorder plus the main merge, so no fresh review was requested. Enabling auto-merge on 47d2fac. (Written by Claude Opus 5.5) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 47d2facd50
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Keep both MIGRATE.md Unreleased entries, and drop the hang-cmaf-lazy and fmp4-import-unwrap quests, finished by #6219 and this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unwrapped video skips samples until a sync sample, but the skipped fragment still marked the segment opened, so the next keyframe rolled a second segment and left audio one group ahead of video. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re-queue summary after the merge queue dropped this for a main conflict:
(Written by Claude Opus 5.5) |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged
(Written by Claude Opus 5.5) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d92594bd6a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if sample.pts > sample.dts { | ||
| producer.reorder(Timestamp::new(sample.pts - sample.dts, timescale)?); |
There was a problem hiding this comment.
Ignore reorder delay from skipped pre-keyframe samples
When an import begins mid-GOP, producer.write rejects non-sync samples with MissingKeyframe, but their PTS - DTS delay is recorded before that rejection. Because the estimator retains its maximum reorder delay and burst() subsequently publishes it, a dropped sample with a large composition offset can permanently advertise excessive jitter for a track that never emitted that sample, causing consumers to buffer unnecessarily. Record the reorder delay only after the frame is accepted.
Useful? React with 👍 / 👎.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged origin/main to clear the queue conflict. The only conflict was (Written by Claude Opus 5.5) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b05bf8512
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (index, sample) in run.samples.iter().enumerate() { | ||
| let keyframe = match video { | ||
| // Video groups open on sync samples, the `depends_on` rule the rest of moq-mux applies. | ||
| true => sample.sync, |
There was a problem hiding this comment.
Roll audio for every video keyframe in a fragment
When one traf contains multiple sync samples, this marks every sync sample as a video group opener, while the audio path opens at most one group because placement.new_segment advances only once per moof. A valid fragment spanning multiple GOPs therefore advances the video group sequence ahead of audio, breaking the importer's cross-track grouping. Split audio at the corresponding boundaries or ensure one video group is opened per resolved segment.
AGENTS.md reference: rs/moq-mux/AGENTS.md:L3-L5
Useful? React with 👍 / 👎.
|
|
||
| // The fragment arrived at once, so a consumer has to buffer its whole span. | ||
| producer.burst(end.checked_sub(earliest)?.into())?; | ||
| Ok(!producer.needs_keyframe()) |
There was a problem hiding this comment.
Do not mark dependent video segments as opened
When an styp or cut() declares a segment whose video contains no sync sample, an existing video group remains open, so this returns true even though the new segment never opened a video group. track.segment is then advanced; at the next sync fragment starts_segment() advances again, causing audio to open another group while video is still one sequence behind. Report whether this invocation actually opened the segment rather than whether any old group remains open.
AGENTS.md reference: rs/moq-mux/AGENTS.md:L3-L5
Useful? React with 👍 / 👎.
| } | ||
| } | ||
| track.pending_sequence = Some(sequence); | ||
| media!(&mut track.output, producer => producer.seek(sequence)?, passthrough => { |
There was a problem hiding this comment.
Reset segment ownership when seeking unwrapped tracks
After seek() on an already-started muxed import, this closes each producer but leaves track.segment equal to the current segment. If the resumed video is initially mid-GOP, video_rolled() therefore still returns true; audio opens the requested sequence on the skipped fragment, then the first video sync fragment advances the segment and rolls audio again while video only opens the requested sequence. Clear or invalidate the per-track segment marker when the seek closes its group.
AGENTS.md reference: rs/moq-mux/AGENTS.md:L3-L5
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| // The fragment arrived at once, so a consumer has to buffer its whole span. | ||
| producer.burst(end.checked_sub(earliest)?.into())?; |
There was a problem hiding this comment.
Exclude skipped samples from burst estimates
When video import begins mid-GOP, producer.write intentionally rejects the leading samples, but this still records the span from the run's earliest sample through its end. A fragment containing only rejected samples, or a long rejected prefix before the first sync sample, consequently publishes jitter for media that was never emitted and can make consumers buffer unnecessarily. Compute the burst from accepted samples only, and skip it when none were written.
Useful? React with 👍 / 👎.
…/ingest Resolve conflicts with main's fMP4 import refactor (#6250), frame arrival stamps, the clock rename, and the #6165 MIGRATE.md entries. The owned frame writer now builds frames with `Frame::new`, and main's arrival-stamp test takes the group writer back from `finish`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces main's new ContainerFormat::Cmaf release test with fmp4 passthrough, and adds the #6250 Fmp4 entry to the raw binding MIGRATE files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements
/quest/m1/fmp4-import-unwrap.md: first-party fMP4 import stops publishing CMAF unless asked.What changed
moq_mux::container::fmp4::Importnow splits each fragment into oneLegacyframe per sample by default. Sampleiis stampedtfdt + durations before i + cts_iin the track's timescale and shifted through the importer'sTimebase, the same catalog clock passthrough uses. The payload is sliced out of the input buffer, not copied. The codec description still comes fromstsd.depends_onrulesample::Sample::is_syncalready applies). A fragment that joins mid-GOP is skipped up to its first sync sample, as FLV does.styp/cut()/video-keyframe segmentation (and stays one group per fragment for unsegmented audio-only input), exactly as passthrough grouped it.styp,cut()) still cut each track's timeline, through a new crate-privatecontainer::Producer::boundary.catalog::Reserved::{video,audio}like the other demuxers, so bitrate, jitter (plus thectsreorder delay and the per-fragment burst), bandwidth claims, stats, and timelines come fromcontainer::Producer.Import::with_passthrough(true)keeps today's CMAF passthrough. The passthrough path is the old code moved into aPassthroughstruct; both paths share onetrunparser (Fmp4Track::run).import::ContainerFormatgainsCmaf(the passthrough importer)."cmaf"stops being an alias of"fmp4"and parses to it, so string callers that asked for CMAF keep getting CMAF.moq-hls:import::Config::passthrough.moq-cli:import fmp4 --passthroughandimport hls --passthrough.FFI:
MoqContainerFormat::Cmaf;moq-c:MOQ_CONTAINER_FORMAT_CMAF = 4;go/wrapper:media.ContainerFormatCmaf. py, swift, kt, dart, and cpp alias the generated UniFFI enum, so they getCMAF/.cmaf/kCmafwith no wrapper code. Each binding'sdoc/libpage says what the two formats do.Bench:
cmaf-unwrap-*measures the unwrapping import beside the existingcmaf-import-*passthrough rows. Unwrapping is faster, since it slices samples instead of re-encoding a per-track moof and copying the mdat:Producer audit
Only
fmp4::Importdefaulted to CMAF. moq-gst's sink defaults tolegacy(its source only consumes CMAF), themoq-ffi/moq-ctrack importers default toLegacy, andmoq-video/moq-audioonly decode CMAF. The demo (just pub cmaf) and test recipes (test/native-play,test/audio-quality) runmoq import fmp4, so they flip with the CLI; none needs CMAF output.Public API and wire impact
Breaking (behavior): every fMP4 import that didn't opt in now advertises
legacyinstead ofcmaf, publishes one frame per sample instead of per fragment, names its tracks.mp4-v/.mp4-aat the default microsecond timescale instead of.m4sat themdhdtimescale, and ends each video group on the Legacy duration marker.MIGRATE.mdentries cover moq-mux, moq-hls, moq-cli, moq-ffi, moq-c, py, swift, kt, dart, go, and cpp.Additive:
fmp4::Import::with_passthrough,ContainerFormat::Cmaf,moq_hls::import::Config::passthrough,--passthrough, the FFI/C/GoCmafvariants.No wire format or draft change:
legacyandcmafare both existing containers.Decisions
Settled by the maintainer, all as implemented:
fmp4::Import::with_passthrough(bool), next towith_select. Rejected:with_container(Container)(allows aCmaf { init }whose init is ignored) and anfmp4::Outputenum.ContainerFormat::Cmafvariant (MoqContainerFormat::Cmaf,MOQ_CONTAINER_FORMAT_CMAF). Rejected: apassthrough: boolon every binding's container init struct.import fmp4 --passthroughandimport hls --passthrough, mirroringimport ts --passthrough. Rejected:import cmaf.Two readings of the quest plan also stand:
styporcut()boundary still marks the track's timeline, but video groups open only on sync samples (every sync sample opens one), so a segment that starts on a non-keyframe extends the open group instead of starting one.Not done here
EXT-X-DISCONTINUITYstill writes no discontinuity marker group on media tracks, as before in passthrough. UnwrappedLegacytracks could callcontainer::Producer::discontinuity(), but that would spend the sequenceseekreserved, shifting group numbers off the media sequence.Checks
just check: js, rs, py, kt, go, dart, cpp, and obs pass; swift is skipped on Linux;check flakefails locally because the sandbox refusesunshare(/proc/self/uid_map: Operation not permitted), unrelated to this change.unwrapped_samples_match_the_passthrough_fragments(bbb.mp4 imported both ways reads back as the same samples, timestamps, and group starts),unwrapped_samples_present_at_their_composition_time(an I/P/B fragment withcts). The segment, timeline, seek, jitter, and sample-defaults fixture tests now run in both modes.quest checkpasses with this quest file deleted.just test interop --all(it exercises no fMP4 import, and the FFI change only adds an enum value),test/audio-quality.🤖 Generated with Claude Code
(Written by Claude Opus 5.5)