What’s the right keyframe interval?

Interesting post came from the StreamingMedia Advanced list today:

Question:  Anyone have any advise on key frame placement in h264 flash?

I felt like I should know the answer to this, so I pulled together the following:

Answer: Interesting question. For single file streaming, make sure that keyframes at scene changes are enabled. In terms of interval, ESPN uses one key frame about every ten seconds (but this is VP6): https://streaminglearningcenter.com/articles/details-of-espns-new-higher-resolution-vp6-files.html

YouTube inserts one every 2 seconds (H.264). https://streaminglearningcenter.com/articles/youtube-does-720p-hd-using-h264.html

On their H.264 videos, Apple inserts a keyframe anywhere from one every three seconds to one every ten seconds. I generally insert a keyframe every ten seconds in the videos that I encode and that’s what I recommend.

Adaptive Streaming

If you’re encoding for multiple file adaptive streaming, however, you may want shorter intervals and may want to disable keyframes at scene changes (unless you’re sure they will occur consistently in all streams.)

Here’s what Adobe says: “Keeping a constant video keyframe interval instead of a variable keyframe interval ensures that the keyframes in the streams are not very far away from one another. Since the server switches streams on a video keyframe, having them too far away could cause a delay in the switch to happen on the server side.”  http://www.adobe.com/devnet/flashmediaserver/articles/dynstream_on_demand.html

From another Adobe page – “A shorter keyframe interval lets the server switch streams more quickly, which means that the client can have a smaller playback buffer.”
http://help.adobe.com/en_US/FlashMediaServer/3.5_Deving/WS5b3ccc516d4fbf351e63e3d11a0773d56e-7fea.htmlhttp://help.adobe.com/en_US/FlashMediaServer/3.5_Deving/WS5b3ccc516d4fbf351e63e3d11a0773d56e-7fea.html

Here’s what Wowza says. “Multi-bitrate video on demand streaming to Flash, the iPhone/iPod touch and Silverlight requires that you have multiple files pre-encoded to the desired bitrates for streaming. For stream switching to occur properly, the key frames of each of the files must be aligned.” http://www.wowzamedia.com/forums/showthread.php?t=6466

Here’s what Ben Waggoner from Microsoft says about Smooth Streaming – “Smooth Streaming requires that all bitrates start have Closed GOPs (Group of Pictures – a keyframe and all the frames that reference it) starting on the same frame every few (typically 2) seconds.”  http://blogs.iis.net/benwagg/archive/2009/01/17/expression-encoder-2-service-pack-1-amp-ndash-intro-and-multibitrate-encoding.aspx

I’ve not produced files for adaptive streaming, so would be interested in comments from anyone who has.

About Jan Ozer

Avatar photo
I help companies train new technical hires in streaming media-related positions; I also help companies optimize their codec selections and encoding stacks and evaluate new encoders and codecs. I am a contributing editor to Streaming Media Magazine, writing about codecs and encoding tools. I have written multiple authoritative books on video encoding, including Video Encoding by the Numbers: Eliminate the Guesswork from your Streaming Video (https://amzn.to/3kV6R1j) and Learn to Produce Video with FFmpeg: In Thirty Minutes or Less (https://amzn.to/3ZJih7e). I have multiple courses relating to streaming media production, all available at https://bit.ly/slc_courses. I currently work as www.netint.com as a Senior Director in Marketing.

Check Also

Take the Bitmovin Video Developer Survey

Contribute to the one of the most valuable sources of industry data by completing the …

Speech-to-text In Premiere Pro – Fast, Easy, Accurate, and Free

This video tutorial teaches you how to convert speech-to-text in Premiere Pro. I’ve been using …

Streaming Media 101: Training for App & Player Development/Testing Professionals

Leave a Reply

Your email address will not be published. Required fields are marked *