mafintosh / mafintosh/mp4-stream

Stop listing after `stream` atoms

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
215
Forks
22
PR merge metrics
No merged PRs in 30d

Description

1MiB MP4 Sample: http://www.sample-videos.com/video/mp4/240/big_buck_bunny_240p_1mb.mp4

MP4 structure:

> ftyp (32 bytes)
> free (8 bytes)
> mdat (1046699 bytes)
> moov (6904 bytes)

Code snippet:

``` javascript
var mp4 = require('mp4-stream')
var fs = require('fs')

var decode = mp4.decode()

fs.createReadStream('video.mp4')
.pipe(decode)
.on('box', function (box, next) {
console.log('found box (' + box.type + ') at ' + box.offset + ' (' + box.length + ')')
if (box.container) {
console.log('box has child boxes (will be emitted next)')
}
if (box.stream) {
console.log('box has stream data (consume stream to continue)')
box.stream.resume()
}
next() // call this when you're done
})
```

Result:

> found box (ftyp) at 0 (32)
> found box (free) at 32 (8)
> box has stream data (consume stream to continue)

Stop listing after `free` atom.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the supplied 1MiB MP4 sample and the shown mp4.decode() pipeline. Start at the decode entry point and trace the `box` callback after `box.stream.resume()` and `next()`. Done means the decoder continues listing boxes after the `mdat` stream, including the `moov` atom described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
audio-video-rtc
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.