Skip to content
Romain Bouqueau edited this page May 28, 2015 · 3 revisions

Welcome to the mp4box.js wiki!

Use cases

ISOBMF read-only ("MP4Box.js simple"):

ISOBMF read-write ("MP4Box.js full"):

  • on the fly fragmentation
    • especially non-fragmented, fast start ('moov' before 'mdat')
    • non-fragmented, no fast start
    • users: P2P
  • sample extraction (fragmented or not modes)
    • users: extraction of TTML sample (to be processed by another library)

Constraints

  • provide MSE helper functions
    • RFC6381 about codecs
  • BPG image visualization
  • browser compatibility (IE10+, FF, Chrome, Safari)
  • Node compatibility
  • Large files (tested 7+GB)
  • input delivery independant
    • XHR (Node, Browser)
    • File (Node, Browser)
    • P2P
    • "Stream"
      • Progressive
      • W3C Streams

Code

Structure

  • 10+ JS files
  • API is callback based
    • sometimes also promises based? (when?)

Architecture

MP4Box.js is fed with ArrayBuffer 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 file).

+===============+===========================================================+
| Application   |                                                           |
+===============+===========================================================+
| MP4Box.js API | append() / SetExtractOptions() / Flush() / ...            |
+===============+===========================================================+
| MP4Box.js     | ISOFile: API                                              |
| MP4Box.js     |    MPEG4 'esd' / Box read | Box write / Sample management |
| MP4Box.js     | Data: ArrayBuffer abstract by: DataView or DataStream     |
| MP4Box.js     |                                or MultiByte Stream        |
+===============+===========================================================+
| Network       |                                                           |
| (controlled   |  Protocol independent: XHR, WebRTC DataChannel, File      |
| by the        |    => Stream API                                          |
| Application)  |                                                           |
+===============+===========================================================+

API

TODO

Build

  • Grunt
    • tasks: concatenate, uglify, code quality
    • MP4Box;js "simple" and "full" (see above)

Tests

  • QUnit
    • no MSE coverage (pass a buffer through MSE and check result - would help is regression in MSE)
    • many tests: extraction, buffer overlaps, ...
    • tests on box
  • automatic
    • Node
    • Browser
      • Headless PhantomJS wouldn't work (TODO: retry)
  • TODO: isomorphic when serializing to JS then re-writing boxes
  • Performances:

Problems

  • Workers / Concurrency
  • Re-entrency / Thread-Safety
  • 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