Packetizing the Dolby AC-4 bitstream

A multiplexer packetizes only one raw AC-4 frame as an MP4 sample.

About this task

A seamless switch can be accomplished only at a random access point. The first sample of each segment must contain a random access point. A Dolby AC-4 elementary stream contains I‑frames to indicate random access points. Similar to the length of GOP for video streams, the I-frame interval for a Dolby AC-4 stream indicates the number of frames between two I‑frames.

The multiplexer must ensure that the first MP4 sample of each Dolby AC-4 media segment is an I-frame. A Dolby AC-4 media segment may contain one or more random access points.


  1. The multiplexer scans the bitstream to find the first I‑frame (a frame with the b_iframe_global value of 1). This I‑frame begins a Dolby AC-4 media segment.
  2. The multiplexer continues to scan the bitstream for preceding I‑frames and keeps track of the number of frames between two I-frames( I-frame interval).

    The I‑frame interval should be constant.

  3. When the multiplexer reaches the end of an I‑frame interval and accumulates a media segment size worth of AC-4 frames, the multiplexer adds the AC-4 frames to an MP4 segment.

    The media segment size is determined by packager settings and A/V alignment and segmentation rules.

  4. The multiplexer begins the next media segment with the next I‑frame.