logoalt Hacker News

cowlevel • yesterday at 2:13 PM • 0 replies • view on HN

this is a telephone-game explanation of keyframes. Each video stream periodically includes a keyframe or I-frame (independent frame) which is a complete encoded picture in its own right. Other frames are P-frames which are diffs from the previous frame. A stream typically includes a keyframe every few seconds. If you want to accurately decode a stream starting in the middle of it, you need to start at the next keyframe.

Some players will take an initial placeholder image such as a grey screen and start applying P-frames on top of it anyway, which gives a corrupted image that still has some information (shapes of moving characters are often recognisable) until the keyframe comes. Others wait for the keyframe and display a black screen, a frozen screen or a loading spinner until then.

Related, if you've ever seen a low-bitrate stream whose quality seems to get really bad, then slowly fill in, then get really bad again, then slowly fill in again, repeating forever, that comes from a poorly tuned encoder that's not allocating enough bits to each keyframe (so the quality is bad) and then making up the difference in subsequent P-frames.