[x264-devel] Optimizing values for consistent "chunk" size with Apple HLS
Gil Pedersen
gil at cmi.aau.dk
Sat Feb 23 12:20:07 CET 2013
On 21/02/2013, at 16.51, Robert Reinhardt [theMAKERS] <lists at themakers.com> wrote:
> I do a lot of adaptive streaming encoding for Apple HLS deployment, typically with a streaming media server like Wowza Media Server which "transmuxes" H.264 content on the fly to various segmented HTTP streaming formats (HLS, HDS, Smooth Streaming). In most of my research on x264, I've found that setting the average bitrate and the max rate to the same value will essentially produce CBR output from x264, but unless I severely cap the buffer size, Apple's HLS tools (which I use to confirm consistency of CBR output) report chunk sizes that are higher than the average and max values, thereby raising the bandwidth required for the stream to be higher than what was desired during encoding.
>
> In my understanding of the VBV buffer size, I would expect to be able to use a kbits value that is the avg/max rate * the GoP size in seconds, since that's the size of each chunk created in the segmenting process. For example, if the avg/max video bitrate is 600Kbps for a 29.97fps video and the GoP is 180 frames (6 seconds), I would think that the VBV buffer could be 600Kbits * 6 = 3600Kbits. However, the output from such an example will have chunks that exceed the average chunk size. In a long battery of tests I've done, I typically need to use anywhere from 91-97% of the allocated video bitrate for avg/max bitrate and 5% of the allocated video bitrate for the vbv-buffer size. For example, if the video is targeted for 1400Kbps, with 128Kbps for audio, that leaves 1272Kbps for video bitrate. However, I can only have a sustained rate of 1272Kbps (or lower) if I use a value that is 91-97% of that 1272kbps for avg/max rate, and 5% of that 1272kbps for the vbv-buffer size. At le
> ast, this is all from the perspective of how Apple's mediafilesegmenter reports the maximum bitrate during the chunking process.
>
> Has anyone else on this list used x264 and the mediafilesegmenter tool in this way to validate CBR output? I'd appreciate any feedback from the list.
The segmenter will accurately report the size of individual segments.
The fluctuations you are seeing are caused by adjustment to the VBV buffer level, which it can be at different levels at the start and end of your GOP (usually between 50% and 80%).
Regards,
Gil
More information about the x264-devel
mailing list