Lowercase '6b' in 'mp4a.6b' fails Chromium's canPlayType() check
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 73/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, typescript
- Domain
- audio-video-rtc, backend
Research direction
Start by tracing how mp4box.js derives and formats the RFC 6381 codec string for MP3 audio, then compare that path with the reported mp4a.6B output. Check for existing codec formatting tests and add a case using the provided MP4 sample or an equivalent fixture. Done when the reported codec preserves the uppercase B and the test verifies it.
Written by the indexing model from the issue text.
Description
I encountered this when parsing an MP4 containing MP3 audio with codec 'mp4a.6B'. (Thanks for the package! first time reporter here).
mp4box.js reports mp4a.6b, while MP4Box reports mp4a.6B (note the capital). Passing the lowercase one to Chromium's canPlayType() returns an empty string (i.e. not supported) and uppercase returns "probably".
This is because of the mapping in Chromium's source code here (line 64), it doesn't recognise the lowercase version in this particular audio codec. The justification of using the uppercase version is here in RFC 6381. So I think it makes sense for mp4box.js to also report mp4a.6B instead so applications can pass the reported codec from mp4box.js directly to browser capability checks (which is what I was trying to do).
Happy to contribute a PR to fix this if this is the direction maintainers think it should be taken (with some guidance ideally as I am not familiar with the codebase). Thank you.
To Reproduce
Using an MP4 containing MP3 audio with codec 'mp4a.6B' (audio_mp4a.6b.mp4 here):
mp4box.js (@2.5.0)
import { readFileSync } from 'node:fs';
import { createFile } from 'mp4box';
const buf = readFileSync(process.argv[2]);
const data = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
data.fileStart = 0;
const file = createFile();
file.onReady = info => console.log(info.audioTracks[0].codec);
file.appendBuffer(data);
file.flush();
node script.js audio_mp4a.6b.mp4
# mp4a.6b
MP4Box (GPAC version 26.07-revrelease)
MP4Box -info audio_mp4a.6b.mp4
# ...
# RFC6381 Codec Parameters: mp4a.6B
# ...
Chrome (157.0.0):
const audio = document.createElement('audio');
audio.canPlayType('audio/mp4; codecs="mp4a.6b"'); // ""
audio.canPlayType('audio/mp4; codecs="mp4a.6B"'); // "probably"
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 390
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 10
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from gpac/mp4box.js
-
hvcC write clears the reserved bits before min_spatial_segmentation_idcPossibly taken @bardrop claimed this 2 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 32/100
gpac/mp4box.js#551 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
gpac/mp4box.js#528 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
Similar issues
-
[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client areaPossibly taken @lijy91 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
libnativeapi/nativeapi#53 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
KilledByAPixel/LittleJS#188 ·
-
enhancement
Difficulty 2/5 Under an hour Newbie friendliness 88/100
stfc/goldilocks-agent#156 ·
Maintainers usually reply within 1 day
-
Add: BRIDGE Jazz SDOpenstreams:add
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
[BUG] iOS - Share extension crashes when the shared page contains "%s" or "% s" (NSLog format string)Possibly taken @kexhest claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
achorein/expo-share-intent#244 ·