Issue Reading QT Compressed mdat Box
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 20/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, typescript
- Domain
- audio-video-rtc
Research direction
The error occurs while parsing the mdat box in mp4.js. Start at the check around line 2520 (if (start + size > stream.getEndPosition())) and follow how MultiBufferStream computes the end position for large files. Reproduce with an MP4 whose mdat sits at the end and is larger than the initial buffer; success is the box parsing without the 'not found in buffered data' error. No tests are named in the issue.
Written by the indexing model from the issue text.
Description
Hi. I have a 3.8 gig MP4 file, which plays fine in the Quicktime player. However it produces the below error message in MP4Box when it hits the mdat box, which is at the end of the file. This occurs when using the demo page as well as in my own implementation. Some numbers:
Overall file size: 3818408565
Start position of mdat: 45329
Size of mdat: 3818363236
End position (stream.getEndPosition()): 8388608
I believe the relevant error messages are:
[BoxParser] Not enough data in stream to parse the entire "mdat" box
[MultiBufferStream] Position 3818408565 not found in buffered data
The situation is set up when the following returns false (looks like end position is wrong?):
if (start + size > stream.getEndPosition()) { //...
Below are the full logs. Any ideas? I'm happy to help however I can, and thanks for the great library.
Logs:
Appending buffer with offset 0
mp4.js:25 [0:00:03.759] [MP4Box] Processing buffer (fileStart: 0)
mp4.js:20 [0:00:03.759] [MultiBufferStream] Appending new buffer (fileStart: 0 - Length: 8388608)
mp4.js:20 [0:00:03.760] [MultiBufferStream] 1 stored buffer(s) (0/8388608 bytes): [0-8388607]
mp4.js:20 [0:00:03.761] [MultiBufferStream] Stream ready for parsing
mp4.js:20 [0:00:03.761] [MultiBufferStream] 1 stored buffer(s) (0/8388608 bytes): [0-8388607]
mp4.js:20 [0:00:03.761] [MultiBufferStream] Found position in existing buffer #0
mp4.js:20 [0:00:03.762] [MultiBufferStream] Repositioning parser at buffer position: 0
mp4.js:20 [0:00:03.763] [BoxParser] Found box of type ftyp and size 32 at position 0
mp4.js:20 [0:00:03.764] [MultiBufferStream] 1 stored buffer(s) (32/8388608 bytes): [0-8388607]
mp4.js:20 [0:00:03.764] [BoxParser] Found box of type moov and size 40266 at position 32
mp4.js:20 [0:00:03.765] [BoxParser] Found box of type cmov and size 40258 at position 40
mp4.js:30 [0:00:03.765] [BoxParser] Unknown box type: cmov
mp4.js:30 [0:00:03.765] [BoxParser] cmov box writing not yet implemented, keeping unparsed data in memory for later write
mp4.js:20 [0:00:03.766] [MultiBufferStream] 1 stored buffer(s) (40298/8388608 bytes): [0-8388607]
mp4.js:20 [0:00:03.767] [BoxParser] Found box of type free and size 5023 at position 40298
mp4.js:30 [0:00:03.767] [BoxParser] free box writing not yet implemented, keeping unparsed data in memory for later write
mp4.js:20 [0:00:03.767] [MultiBufferStream] 1 stored buffer(s) (45321/8388608 bytes): [0-8388607]
mp4.js:20 [0:00:03.768] [BoxParser] Found box of type wide and size 8 at position 45321
mp4.js:30 [0:00:03.768] [BoxParser] Unknown box type: wide
mp4.js:30 [0:00:03.768] [BoxParser] wide box writing not yet implemented, keeping unparsed data in memory for later write
mp4.js:20 [0:00:03.768] [MultiBufferStream] 1 stored buffer(s) (45329/8388608 bytes): [0-8388607]
mp4.js:20 [0:00:03.769] [BoxParser] Found box of type mdat and size 3818363236 at position 45329
mp4.js:2520 are start + size greater than end position?
mp4.js:2521 start: 45329 size: 3818363236 endPosition: 8388608
mp4.js:20 [0:00:03.769] [MultiBufferStream] Found position in existing buffer #0
mp4.js:20 [0:00:03.770] [MultiBufferStream] Repositioning parser at buffer position: 45329
mp4.js:30 [0:00:03.770] [BoxParser] Not enough data in stream to parse the entire "mdat" box
mp4.js:5253 the box:
mp4.js:5254 B…r.Box {type: "mdat", size: 3818363236}
mp4.js:20 [0:00:03.773] [MultiBufferStream] 1 stored buffer(s) (45337/8388608 bytes): [0-8388607]
mp4.js:20 [0:00:03.775] [MultiBufferStream] 1 stored buffer(s) (8388608/8388608 bytes): [0-8388607]
mp4.js:20 [0:00:07.269] [MultiBufferStream] Position 3818408565 not found in buffered data
mp4.js:6418 Uncaught TypeError: Cannot read property 'duration' of undefined
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 390
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 8
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
-
mp4box.js — 20-byte `sgpd` box with large `entry_count` causes unbounded loop and heap OOM abortOpen
Difficulty 2/5 1-3 hours Newbie friendliness 77/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
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 40/100
Maintainers usually reply within 1 day
Similar issues
-
The sample email preview's ResizeObserver is never disconnected and keeps raising errors after leaving SettingsPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
area:ui bug effort:S priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Typo in WSL project description on Projects pagePossibly taken @akhil9tiet claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 75/100
microsoft/opensource.microsoft.com#1066 · 1 comment ·
-
ArcGIS Maps SDK for JavaScript c-carousel calcite-design-tokens enhancement impact - p3 - not time sensitive needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Esri/calcite-design-system#15565 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
linkwarden/linkwarden#1891 ·
Maintainers usually reply within 1 day