Skip to content

fix: handle QuickTime wave/esds in mp4a codec derivation and fragmented init#550

Open
lideen wants to merge 2 commits into
gpac:mainfrom
lideen:fix/mov-wave-esds-init-segmentation
Open

fix: handle QuickTime wave/esds in mp4a codec derivation and fragmented init#550
lideen wants to merge 2 commits into
gpac:mainfrom
lideen:fix/mov-wave-esds-init-segmentation

Conversation

@lideen
Copy link
Copy Markdown
Contributor

@lideen lideen commented Feb 23, 2026

Description

I noticed some QT files were producing incomplete/incorrect audio codec strings and compatibility issues in my fragmented playback flows.

This PR improves handling of QuickTime-style audio sample entries in QT files where codec/config metadata is nested under wave.esds rather than exposed directly on the sample entry.

The underlying issue was about how mp4a sample entries can be structured in QuickTime files: mp4a.wave.esds instead of mp4a.esds.

This has two main issues:

  1. Codec derivation path for mp4a relies on direct esds
    • Nested wave.esds layouts fails to give the correct codec string.
  2. The current init segment generation does not work for nested wave.esds. The MSE apis expects init segments to have direct esds.

What changed

  1. mp4a codec derivation now supports nested QuickTime layout
    • For mp4a entries, codec derivation now resolves descriptor info from:
      • direct esds
      • nested wave.esds
  2. Init segment writing now normalizes mp4a.wave.esds layouts
    • During writeInitializationSegment(...), mp4a entries with nested wave.esds are normalized to direct esds representation.
    • Original in-memory parsed structures are restored after writing (no persistent source mutation).

@lideen lideen force-pushed the fix/mov-wave-esds-init-segmentation branch from e3642e6 to 514dbf1 Compare February 23, 2026 20:25
@lideen lideen force-pushed the fix/mov-wave-esds-init-segmentation branch from 514dbf1 to ca83fc2 Compare May 25, 2026 11:29
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 25, 2026

🦋 Changeset detected

Latest commit: ca83fc2

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

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

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

Copy link
Copy Markdown
Member

@DenizUgur DenizUgur left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution. Overall the PR looks good, I just have some small comments I've added below.

Comment thread src/isofile.ts

/* If the application needs to be informed that the 'moov' has been found,
we create the information object and callback the application */
we create the information object and callback the application */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you revert the whitespace changes in this PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't know about checking in the file to the repo. Can you add a test without using the fixtures or check if anything from file format conformance has a similar file?

I'll likely have a way to contribute test files in the future.

Comment thread src/isofile.ts
}

/** @bundle isofile-write.js */
private static normalizeAudioSampleEntriesForFragmentedInit(traks: Array<trakBox>) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need to filter wave out?

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