GlossaryMuxing / demuxing

Muxing / demuxing

Muxing (multiplexing) is the process of combining separate video, audio and subtitle streams into a single container file, and demuxing is the reverse process of splitting them apart. An MP4 file, for example, holds a muxed video track and audio track that stay in sync. Players demux the file so each stream can go to the right decoder.

Why it matters

Muxing is what keeps sound, picture and subtitles in sync inside one file or stream. It also lets a business add new audio languages or captions without paying to re-encode the video. Muxing errors show up to viewers as audio drift, missing tracks or files that will not play.

How it works

  1. A muxer takes separately encoded streams, such as one video track and several audio tracks.
  2. It interleaves small pieces of each stream and stamps them with timing information so they stay in sync.
  3. It writes everything into a container such as MP4, MKV or MPEG-TS, with an index of the tracks.
  4. On playback, a demuxer reads the container and sends each stream to its own decoder.

What is the difference between muxing and encoding?

Encoding compresses video or audio, while muxing packs already compressed streams together into one container. An encoder decides how the picture is stored. A muxer only decides how the video, audio and subtitle tracks sit side by side in a file and stay in sync. Muxing is fast because nothing is compressed again.

Why is my audio out of sync after muxing?

Audio goes out of sync after muxing when the timestamps of the audio and video tracks do not line up. Common causes are tracks that start at different times, variable frame rate video, or a delay that was not carried over from the source. Most muxing tools let you set an audio offset to correct the gap without re-encoding.

Where it's used

OTT services mux dubbed audio tracks into a film without re-encoding the picture, and live sports streamers mux several commentary languages into one feed.

By the numbers