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.