gpac / mp4box.js

JavaScript version of GPAC's MP4Box tool
https://gpac.github.io/mp4box.js/
BSD 3-Clause "New" or "Revised" License
1.92k stars 325 forks source link

How to add MOOV atom to mp4? #340

Open hypo-thesis opened 1 year ago

hypo-thesis commented 1 year ago

I need an example where I can add MOOV atom to an arraybuffer. Thanks.

hughfenghen commented 1 year ago

file.addTrack will create moov box.

const moovBox = file.boxes.find(({type}) => type === 'moov')

const ds = new mp4box.DataStream()
ds.endianness = mp4box.DataStream.BIG_ENDIAN
moovBox.write(ds)

// ds.buffer  is moov box binary data