Skip to content
Cyril Concolato edited this page May 29, 2015 · 3 revisions

Welcome to the mp4box.js wiki!

Use cases

ISOBMFF read-only:

ISOBMFF read-write:

  • on-the-fly fragmentation
    • especially non-fragmented, fast start ('moov' before 'mdat')
    • non-fragmented, no fast start
    • users: P2P

Requirements

  • Browsers compatibility (IE10+, FF, Chrome, Safari)
  • Node compatibility
  • Should handle Large files (tested 7+GB)
  • Should be input delivery independant
    • XHR (Node, Browser)
    • File (Node, Browser)
    • P2P
    • "Stream"
      • Progressive
      • W3C Streams API

Code

Structure

  • 10+ JS files
  • API is callback-based
    • Should we use Promises? (when?)

Architecture

MP4Box.js is fed with ArrayBuffer objects by the application. MP4Box.js is agnostic with the media it is fed, although it has expectations from its API (in particular the data is expected to be a remote ISOBMF) and a fileStart property indicates the offset in that file.

+===============+===========================================================+
| Application   |                                                           |
+===============+===========================================================+
| MP4Box.js API | append() / setExtractOptions() / flush() / ...            |
+===============+===========================================================+
| MP4Box.js     |                  ISOFile: API                             |
+               +=================+==============+==========================+
|               |    MPEG-4 'esd' |      Box     |  Sample                  |
|               |    Parsing      | read & write | management               |
+               +=================+==============+==========================+
|               |      DataView or DataStream or MultiByte Stream           |
+===============+===========================================================+
| Data          |                   ArrayBuffer                             |
+===============+===========================================================+
| Network       |                                                           |
| (controlled   |  Protocol independent: XHR, WebRTC DataChannel, File,     |
| by the        |                        Stream API                         |
| Application)  |                                                           |
+===============+===========================================================+

API

TODO

Build

  • Grunt
    • tasks: concatenate, uglify, code quality (jshint)
    • Conditional build (two targets): "simple" (box parsing only) and "full"

Tests

  • QUnit
    • many tests: extraction, buffer overlaps, simple box parsing ...
    • no MSE coverage (pass a buffer through MSE and check result - would help is regression in MSE)
  • Browser testing manually
  • Node testing: not yet, PhantomJS Bug
  • TODO: isomorphic when serializing to JS then re-writing boxes
  • Performances:

Problems

  • Test code in workers
  • Code is not yet re-entrant
  • Should return box size + 8

Future

  • Separate MP4Box.js "Simple" and "Full" and remove datastream.js (which is big) from "Simple"
  • Use ES6 (Classes, 'let' instead of 'var', ...)
    • dash.js plans to move to ES6
    • binders in Grunt to generate ES5 from ES6
Clone this wiki locally