Skip to content

feat: add per-track segmentation init mode#549

Merged
DenizUgur merged 1 commit into
gpac:mainfrom
lideen:feat/per-track-init-segmentation
May 26, 2026
Merged

feat: add per-track segmentation init mode#549
DenizUgur merged 1 commit into
gpac:mainfrom
lideen:feat/per-track-init-segmentation

Conversation

@lideen

@lideen lideen commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds a new segmentation initialization mode to support one init segment per fragmented track while preserving the existing combined-init behavior.

The main motivation is Media Source Extensions (MSE) integration: playback setups that require simultaneous multi-audio playback need one MediaSource (containing its SourceBuffer) per track, which in turn requires one init segment per track instead of a single combined init segment.

Note

This behavior aligns with historical usage, per-track initialization used to be the default behavior.
It stopped being the default in commit 77247e1 (fix: segmenting will also multiplex the fragmented tracks, Jul 8, 2025), first released in v1.3.1.

initializeSegmentation now supports:

  • initializeSegmentation() / initializeSegmentation('combined') (default):
    returns a single init segment containing all selected fragmented tracks.
  • initializeSegmentation('per-track'):
    returns one init segment per selected fragmented track.

Documentation

Updated README.md segmentation docs (it seems to have been stale documenting the old behavior before 77247e1):

  • documented initializeSegmentation(mode) with supported values ('combined' and 'per-track')
  • updated examples to reflect current return shapes
  • fixed the setSegmentOptions anchor link

@DenizUgur

Copy link
Copy Markdown
Member

@lideen Could you resolve the conflicts and add a changeset? I can then merge this, thanks.

@lideen lideen force-pushed the feat/per-track-init-segmentation branch from a9613c4 to d2f3e15 Compare May 25, 2026 11:15
@changeset-bot

changeset-bot Bot commented May 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ddeed03

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mp4box Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@lideen lideen force-pushed the feat/per-track-init-segmentation branch from d2f3e15 to 16b15bd Compare May 25, 2026 11:19
@lideen lideen force-pushed the feat/per-track-init-segmentation branch from 16b15bd to ddeed03 Compare May 25, 2026 11:20
@lideen

lideen commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

@DenizUgur

@lideen Could you resolve the conflicts and add a changeset? I can then merge this, thanks.

done, thanks

Comment thread tests/segmentation.test.ts
@DenizUgur DenizUgur added this pull request to the merge queue May 26, 2026
@DenizUgur DenizUgur removed this pull request from the merge queue due to a manual request May 26, 2026
@DenizUgur DenizUgur added this pull request to the merge queue May 26, 2026
Merged via the queue into gpac:main with commit 4199d94 May 26, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request May 26, 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.

2 participants