Skip to content

fix(media): name variants that repeat by the codecs that differ - #616

Merged
linroid merged 2 commits into
mainfrom
fix/media-variant-labels
Oct 23, 2026
Merged

linroid merged 2 commits into
mainfrom
fix/media-variant-labels

Conversation

@linroid

@linroid linroid commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Found while listing real HLS streams with ketch --list-files.

Apple's fMP4 example (img_bipbop_adv_example_fmp4/master.m3u8) offers each picture with AAC, AC-3 and E-AC-3 audio. Two of them round to the same bitrate, so Ketch listed them as 540p · 2.2 Mbps (1) and 540p · 2.2 Mbps (2): nothing told users that one is AAC and the other E-AC-3. The apps' Quality picker shows the same names.

What changes

mediaVariantNames takes each variant's codecs (HLS CODECS, DASH codecs). When names would repeat, it adds the codecs that differ within that group, named as users know them (H.264, HEVC, AV1, VP9, AAC, AC-3, E-AC-3, Opus, …). Variants that declare the same codecs still get (1)/(2). Variant IDs don't change, so saved selections and --files IDs still resolve.

Before:

55c6e3af8a71     -  540p · 2.2 Mbps (1)
efc04e369e21     -  540p · 2.2 Mbps (2)
78832d664d6d     -  432p · 1.3 Mbps (1)
27e85d8c5d57     -  432p · 1.3 Mbps (2)

After:

55c6e3af8a71     -  540p · 2.2 Mbps · E-AC-3
efc04e369e21     -  540p · 2.2 Mbps · AAC
78832d664d6d     -  432p · 1.3 Mbps · E-AC-3
27e85d8c5d57     -  432p · 1.3 Mbps · AAC

Verification

  • ketch --list-files on the Apple stream from this branch prints the "After" list above.
  • New Mp4TracksTest.mediaVariantNames_tellRepeatsApartByTheCodecsThatDiffer; ./gradlew :library:core:jvmTest --tests '*Mp4TracksTest*' :library:hls:jvmTest :library:dash:jvmTest passes.
  • While testing, the AAC (270p) and AC-3 (432p) variants of that stream, the Mux TS stream, the Unified Streaming HLS video and audio-only variants, and Akamai's DASH bbb_30fps (180p) all downloaded. ffprobe shows the expected tracks and durations, with video and audio merged into one MP4 where they are separate.

Apple's bipbop example offers each picture with AAC, AC-3 and E-AC-3 audio,
and Ketch listed them as "540p · 2.2 Mbps (1)" and "(2)", so users could
not tell which was which. Variants whose names would repeat are now told
apart by the codecs that differ among them ("540p · 2.2 Mbps · E-AC-3"),
from the CODECS of HLS variants and DASH representations; numbers remain
for variants that declare the same codecs. IDs are unchanged.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T14:16:35.604925Z df41c1d PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Oct 23, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@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: df41c1dc39

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

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

 2 193 files  ± 0   2 221 suites  ±0   59m 45s ⏱️ + 3m 4s
15 259 tests +12  14 991 ✅ +12  268 💤 ±0  0 ❌ ±0 
18 610 runs  +12  18 342 ✅ +12  268 💤 ±0  0 ❌ ±0 

Results for commit fc2221e. ± Comparison against base commit 94bd6b5.

This pull request removes 1 and adds 13 tests. Note that renamed tests count towards both.
com.linroid.ketch.engine.HttpDownloadIntegrationTest ‑ download_ignoredRange_failsInsteadOfCorruptingFile[jvm]
com.linroid.ketch.core.media.Mp4TracksTest ‑ mediaVariantNames_readTheObjectTypeOfMp4aCodecs
com.linroid.ketch.core.media.Mp4TracksTest ‑ mediaVariantNames_readTheObjectTypeOfMp4aCodecs[jvm]
com.linroid.ketch.core.media.Mp4TracksTest ‑ mediaVariantNames_tellRepeatsApartByTheCodecsThatDiffer
com.linroid.ketch.core.media.Mp4TracksTest ‑ mediaVariantNames_tellRepeatsApartByTheCodecsThatDiffer[jvm]
com.linroid.ketch.engine.HttpDownloadIntegrationTest ‑ download_ignoredRange_restartsOverOneConnection[jvm]
com.linroid.ketch.engine.HttpDownloadSourceTest ‑ download_serverIgnoringAdvertisedRanges_restartsOverOneConnection
com.linroid.ketch.engine.HttpDownloadSourceTest ‑ download_serverIgnoringAdvertisedRanges_restartsOverOneConnection[jvm]
iosSimulatorArm64Test.com.linroid.ketch.core.media.Mp4TracksTest ‑ mediaVariantNames_readTheObjectTypeOfMp4aCodecs[iosSimulatorArm64]
iosSimulatorArm64Test.com.linroid.ketch.core.media.Mp4TracksTest ‑ mediaVariantNames_tellRepeatsApartByTheCodecsThatDiffer[iosSimulatorArm64]
iosSimulatorArm64Test.com.linroid.ketch.engine.HttpDownloadSourceTest ‑ download_serverIgnoringAdvertisedRanges_restartsOverOneConnection[iosSimulatorArm64]
…

♻️ This comment has been updated with latest results.

mp4a.<OTI> names other formats than AAC too: mp4a.A9 is DTS, mp4a.AD Opus,
mp4a.A5 AC-3. Variant names now read the object type indication (MP4RA),
keeping the manifest's spelling for types they do not name, and DTS's own
sample entries (dtsc, dtsh, ...) read as DTS.
@linroid
linroid merged commit cff39df into main Oct 23, 2026
14 checks passed
@linroid
linroid deleted the fix/media-variant-labels branch October 23, 2026 15:13
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.

1 participant