1.2 KiB
Streams
mux.js uses a concept of streams
to allow a flexible architecture to read and manipulate video bitstreams. The streams
are loosely based on Node Streams and are meant to be composible into a series of streams: a pipeline
.
Stream API
Take a look at the base Stream to get an idea of the methods and events available. In general, data is push
ed into a stream and is flush
ed out of a stream. Streams can be connected by calling pipe
on the source Stream
and passing in the destination Stream
. data
events correspond to push
es and done
events correspond to flush
es.
MP4 Transmuxer
An example of a pipeline
is contained in the MP4 Transmuxer. This is a diagram showing the whole pipeline, including the flow of data from beginning to end:
You can gain a better understanding of what is going on by using our debug page and following the bytes through the pipeline:
npm start
and go to http://localhost:9999/debug/