Skip to content

fix(mux): derive missing video geometry - #2840

Merged
kixelated merged 3 commits into
mainfrom
codex/fix-mux-video-geometry
Aug 14, 2026
Merged

fix(mux): derive missing video geometry#2840
kixelated merged 3 commits into
mainfrom
codex/fix-mux-video-geometry

Conversation

@kixelated

@kixelated kixelated commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • derive missing H.264, H.265, VP8, VP9, and AV1 geometry from codec configuration or keyframes before authoring immutable fMP4/MKV headers
  • keep polling past provisional frames until both codec configuration and usable geometry are available, while allowing later catalog geometry to unblock export
  • teach the one-shot fMP4 muxer used by fetch-on-demand HLS to wait for and derive the same missing geometry from fetched keyframes
  • reject synthesized fMP4 video tracks with absent, zero, or unrepresentable dimensions instead of silently writing 0x0 metadata
  • surface malformed fixed codec metadata as an export error instead of waiting indefinitely for geometry that can never arrive

The root cause was that catalog dimensions are optional and may arrive independently from media, but the exporters treated codec readiness as sufficient to freeze their headers. A codec-only catalog could therefore produce a permanent 0x0 fMP4 init segment or an MKV header without geometry. The one-shot fMP4 path instead failed before fetching media because it tried to synthesize its init segment immediately. Both cases occur with in-tree RTC VP8/VP9 publishers, which do not currently put dimensions in the catalog.

Fixes #2797.

Public API changes

  • None. Geometry derivation and readiness tracking are internal to moq-mux.

Test plan

  • nix develop --command just fix
  • nix develop --command just check
  • nix develop --command just test (1,192 Rust tests and 50 Python tests passed)

No wire format or public catalog API changed, so the cross-package wire/draft sync rows do not apply.

(Written by GPT-5)

@kixelated
kixelated marked this pull request as ready for review August 14, 2026 21:11

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ec6e875c3

ℹ️ 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".

Comment thread rs/moq-mux/src/container/fmp4/mod.rs
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 600d4f82-fd67-4ade-9988-bd4ad6bf6b4a

📥 Commits

Reviewing files that changed from the base of the PR and between 9ec6e87 and 1b19ec7.

📒 Files selected for processing (6)
  • rs/moq-ffi/src/test.rs
  • rs/moq-hls/src/export/mod.rs
  • rs/moq-mux/src/container/fmp4/export_test.rs
  • rs/moq-mux/src/container/fmp4/muxer.rs
  • rs/moq-mux/src/container/group.rs
  • rs/moq-mux/src/container/source.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • rs/moq-hls/src/export/mod.rs
  • rs/moq-mux/src/container/fmp4/export_test.rs
  • rs/moq-mux/src/container/source.rs

Walkthrough

The change resolves video geometry from catalog metadata, codec descriptions, and encoded payloads. fMP4 and MKV exporters now wait for required geometry before emitting initialization headers. Legacy fMP4 synthesis uses resolved video configuration and rejects missing or invalid dimensions. AV1 sequence-header parsing now supports dimension extraction. Tests cover dimension discovery, initialization delays, error handling, and shared VP8 configuration setup.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address issue #2797 by requiring or deriving video geometry before fMP4 and MKV headers are finalized.
Out of Scope Changes check ✅ Passed The production changes and related tests remain within the linked issue scope of resolving missing video geometry during export.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title clearly summarizes the main change: deriving missing video geometry in the muxer.
Description check ✅ Passed The description directly explains the geometry derivation, readiness changes, validation, affected formats, and test coverage.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/fix-mux-video-geometry

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kixelated
kixelated force-pushed the codex/fix-mux-video-geometry branch from 9ec6e87 to bd1c8c6 Compare August 14, 2026 21:46
kixelated and others added 3 commits August 14, 2026 15:30
Co-Authored-By: GPT-5 <noreply@openai.com>
Teach the one-shot fMP4 muxer to wait for and derive missing video geometry before synthesizing an init segment, so fetch-on-demand HLS can bootstrap dimensionless VP8/VP9/AV1 catalogs from their keyframes. Share the codec parser with the streaming exporter and cover the HLS path with real VP8 media.

Co-Authored-By: GPT-5 <noreply@openai.com>
Treat permanent codec metadata parse failures as export errors instead of waiting indefinitely for dimensions that can never be resolved.

Co-Authored-By: GPT-5 <noreply@openai.com>
@kixelated
kixelated force-pushed the codex/fix-mux-video-geometry branch from 1b19ec7 to f4b26da Compare August 14, 2026 22:40
@kixelated
kixelated merged commit 817f8a7 into main Aug 14, 2026
3 checks passed
@kixelated
kixelated deleted the codex/fix-mux-video-geometry branch August 14, 2026 22:50
@moq-bot moq-bot Bot mentioned this pull request Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

moq-mux: fMP4 export writes a 0x0 init segment when a rendition has no dimensions yet

1 participant