Skip to content

audiocogs/mp4.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mp4.js

A streaming MP4 demuxer in JavaScript, for av.js.

Example

Like all av.js demuxers, mp4.js is a writable stream that you pipe mp4 data to. It emits 'track' events, each with a readable stream containing the data for that track.

The following example shows how you might extract just the audio track to a file.

import {MP4Demuxer} from 'mp4';
import fs from 'fs';

fs.createReadStream('movie.mp4')
  .pipe(new MP4Demuxer)
  .on('track', function(track) {
    console.log(track.type, track.format)
    
    if (track.type === 'audio') {
      track.pipe(fs.createWriteStream('audio.out'));
    } else {
      track.discard();
    }
  });

License

MIT

About

Streaming MP4 demuxer for av.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published