8 Way Run has posted the next part in their guide to streaming. Parts 1 and 2 talked about hardware and audio/visual equipment. This part focuses more on the software end of things. It talks about DirectShow capability, software choice, encoder settings, frames and frame rates, and a whole bunch of other stuff that you probably didn’t know goes into making a successful stream. Here is a small sample of what they had to say.
Now before I can talk about b-frames, I need to explain what a keyframe means. A “keyframe”, sometimes called an “i-frame” is the technology behind video encoding. A keyframe is a frame which is radically different from the frame before-hand; such as a scene change. Instead of recording each frame one by one, which can lead to large file sizes, what modern encoders do is only record the keyframes, and then for subsequent frames, it simply records the “changes” between the new frame and the previous frame. These intermediate frames are sometimes called predictive frames, or “p-frames”.
Less “change” on a new frame means less data has to be set aside to record actual frame information, and the remaining available data in your target bit rate can be used to enhance the visual quality of the frame. This is why video with less movement on screen seems to be in higher quality than a video with more movement, even though they both may technically have the same bit rate. There are downsides to keyframes however…
When viewing a video, you can’t “seek” to a non-keyframe, as non-keyframes don’t have all the visual data needed to render the scene. This is why sometimes when you seek in a video, you can hear the scene playing, but it may take a second or two for the video to catch up; because its waiting for the next keyframe. To rectify this, you can define keyframe frequencies in your encoder. While keyframes are generally automatic, based on scene changes, the keyframe frequency will force a keyframe refresh at the set interval.
How often should you set your keyframe frequency? Well if you set it too often, you lose the advantage of keyframes, which lowers the quality of your video. Set it too long, and you’ll limit people’s ability to jump right into your stream without having to wait a bit before the video starts registering. For a good experience, I recommend setting your keyframe frequency to about every 5-8 seconds. If you’re running your stream at 30fps, that means you will generate a new keyframe automatically every 150-240 frames.
So what is a bi-directional predictive frame, or “b-frame”? If an keyframe is the technologybehind video encoding, b-frames are nothing short of magic… they can time travel! While a p-frame references changes from the previous frames, a b-frame can also look for changes from upcoming frames. By doing this, the encoding algorithms can enhance image quality by up to an additional 15-20%! But there is a catch, there is always a catch!
An inherit error in the way AVC codecs such as h.264 handle b-frames is that they often like to use b-frames as a reference piece, instead of sticking to keyframes. So sometimes your recorded videos will be corrupted for the first few seconds of your video until it reaches the first keyframe. Then you have YouTube which will try to decode these b-frames when you upload your videos, and when it doesn’t find a first keyframe, it will add it’s own gray frame. In FMLE and Wirecast, if you want to disable b-frames, you have to switch back to the h.264 baseline profile.
To read the full article, head on over to 8wayrun.com and stay tuned for the next part which will be a question and answer session with curious streamers.
Source: 8 Way Run