Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including mp4-box-encoding with all npm packages installed. Try it out:

var mp4BoxEncoding = require("mp4-box-encoding")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

mp4-box-encoding v1.3.0

mp4 box parser/unparser using abstract-encoding



This module provides encoders and decoders with the abstract encoding interface.

The module exports the interface for a generic box, including all headers and children (for container boxes) Encodings for many leaf (non-container) boxes, without headers, is available keyed by the box type:

var box = require('mp4-box-encoding')

var buffer = fs.readFileSync('myvideo.mp4')
// decode any box including headers
// decode the entire moov box and its children
var moov = box.decode(buffer.slice(24, 236989))

var moov.mfhd.mtime = new Date() // Change the modification time

// now this is an encoding of the modified moov box
var moofBuffer = box.encode(moov)

// decode the contents of just the stts box
var stts = box.decode(buffer.slice(609, 625))

These encodings are factored out of mp4-stream.




RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free