Skip to content

fix(web-ui): improve AC-3/E-AC-3 demux and MP4 remux#604

Merged
stackia merged 4 commits into
mainfrom
fix/web-ui-ac3-eac3-demux
Jul 1, 2026
Merged

fix(web-ui): improve AC-3/E-AC-3 demux and MP4 remux#604
stackia merged 4 commits into
mainfrom
fix/web-ui-ac3-eac3-demux

Conversation

@stackia

@stackia stackia commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix AC-3/E-AC-3 parser sampling frequencies and validate frame headers before accepting syncwords
  • Compute and propagate audio bitrate; emit btrt boxes and Dolby-compatible ftyp for AC-3/E-AC-3 init segments
  • Fix E-AC-3 decoder config generation and per-frame sample duration (256 * num_blks / sampling_frequency)
  • Buffer incomplete AC-3/E-AC-3 frames across PES payloads (matching AAC behavior) and detect E-AC-3 metadata changes
  • Rebuild embedded web UI assets

Test plan

  • Play a live TS stream with AC-3 audio in the web UI player
  • Play a live TS stream with E-AC-3 audio in the web UI player
  • Verify audio sync and continuity across TS packet boundaries
  • Confirm MSE init segment plays without codec errors in browser devtools

Correct sampling rates and E-AC-3 config generation, carry incomplete
frame data across PES payloads, emit Dolby ftyp/btrt boxes, and rebuild
embedded web assets.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Revert embedded_web_data.h to main; rebuild separately when merging.
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-604.eastasia.1.azurestaticapps.net

Fix lint failure from an overlong f-string line in build_services_m3u.
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-604.eastasia.1.azurestaticapps.net

1 similar comment
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-604.eastasia.1.azurestaticapps.net

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves Dolby Digital (AC-3) / Dolby Digital Plus (E-AC-3) handling in the Web UI MPEG-TS pipeline so that demuxed audio frames are more reliably parsed across PES boundaries and remuxed into MP4 init segments that are more compatible with browser MSE playback.

Changes:

  • Add bitrate propagation into MP4 metadata and emit Dolby-oriented ftyp plus btrt boxes for AC-3 / E-AC-3 sample entries.
  • Improve AC-3 / E-AC-3 demux: validate headers more defensively, compute correct sample durations (including E-AC-3 num_blks), and carry incomplete frames across PES payloads.
  • Extend E-AC-3 metadata change detection and propagate bitrate into init-segment generation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
web-ui/src/mpegts/remux/mp4-generator.ts Adds Dolby-specific ftyp selection and emits btrt based on propagated audio bitrate for AC-3/E-AC-3.
web-ui/src/mpegts/demux/ts-demuxer.ts Buffers incomplete AC-3/E-AC-3 frames across PES payloads, adjusts duration math, detects E-AC-3 metadata changes, and propagates bitrate into MP4 metadata.
web-ui/src/mpegts/demux/ac3.ts Fixes AC-3/E-AC-3 sampling-frequency tables, validates frame headers before accepting syncwords, and computes per-frame bitrate/config values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread web-ui/src/mpegts/demux/ts-demuxer.ts
Comment thread web-ui/src/mpegts/demux/ts-demuxer.ts
Return early when timing cannot be derived because codec metadata is not
yet initialized and the PES payload has no PTS, avoiding NaN timestamps.
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-604.eastasia.1.azurestaticapps.net

@stackia stackia merged commit 709102e into main Jul 1, 2026
10 checks passed
@stackia stackia deleted the fix/web-ui-ac3-eac3-demux branch July 1, 2026 16:54
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.

2 participants