Best H.264 Encoder Settings for Live Streaming

Best H.264 Encoder Settings for Live Streaming

H.264 is a next-generation protocol for high definition video compression. Most newer encoders today are compatible with this protocol and suitable for live streaming with compact files. In most cases, particularly if you want to stream the best, highest-quality video content, you will want to use this protocol. Any of the encoders and webcam broadcast software products recommended here before, including Wirecast, VidBlaster, and Adobe Flash Media Live Encoder, are compatible with H.264.

Encoders allow for a fairly wide range of settings for video resolution quality, frame rate, audio bitrate, and other variables, as well as protocol, bitrate encoding type, pixel aspect ratio, and so on. What are the best settings for live streaming?

As you might expect, there’s no single set of “best H.264 encoder settings for live streaming.” For practical purposes, your choices are limited not only by your own upload bandwidth, but also by the connection speed available to your viewers. But with that caveat in mind, we can still say something about what settings are likely to work best for your broadcast.

  • High Speed Internet Rates in the United States
  • Video Resolution Settings
  • Bitrate
  • Frame Rate
  • Other Settings

High Speed Internet Rates in the United States

Average download speed in the United States varies widely by state, as the graphic on the linked site shows. Even allowing for that, individuals may have different download speeds available depending on what service they are using for internet connection. The speeds in the graphic are averages, and some people have considerably slower connections.

Best H.264 Encoder Settings for Live Streaming

Click to view a state-by-state breakdwon

In addition, many people will be viewing your broadcast from free wi-fi connections or over 4G smart phones. Those are quite a bit slower than high-speed home connections even the slower states. Starbucks wi-fi is the fastest, but it’s only 9 Mbps, while other sites typically are slower. The latest 4G download speeds clock in at about 6.5 Mbps, while 3G phones are under 2 Mbps. That should be considered the slowest speed at which anyone is likely to be viewing your video broadcast.

It makes no sense to broadcast at settings and speeds that your viewers won’t be able to use. For that reason, you need to keep in mind where your viewers live and what kind of connection and hardware they’ll be using. On the other hand, if you know that your audience has the technical ability to handle HD quality broadcasting, it’s also a good idea to know what settings will optimize that experience for them.

Video Resolution Settings

Best H.264 Encoder Settings for Live StreamingThe higher the resolution, the better quality viewing experience on any given platform. However, there’s a trade off, in that higher resolution also requires higher bandwidth to stream the video effectively.

Two common resolution settings for streaming are standard definition at 720 x 480 pixels (480p) and high definition at 1920 x 1080 pixels (1080p). In practice, this usually gets sampled down to a somewhat lower resolution, 640 x 360 pixels (360p) or smaller. Most resolutions are communicated based on their height, which is why its common to see HD TVs billed as 1080p.

It’s always necessary to consider data rate and resolution together, as the one limits the other. Streaming at a higher data rate allows higher resolution. But it’s also important to consider the download rate for viewers. For high definition streaming, all of your viewers should have an effective download rate of at least 5 Mbps. Higher bandwidth is a good idea. None of this is impossible with high-speed cable internet connections, which can run up to 100 Mbps, but this is divided among all users of any given account. Also, as noted above, some viewers may be trying to see your video on smart phones using 4G connections, which are a good deal slower, although with the latest 4G technology viewing HD video is feasible.

Most encoders allow settings of 1080p, 720p, 480p, 360p, and 240 pixels (height) and corresponding width. Setting this to the highest resolution that you are able to stream allows recipients to view the video in the best quality, but with higher bandwidth requirements for good, smooth reception without buffering.

It’s possible to broadcast simultaneously in SD and HD, but this requires sending two streams to your host service. It does not affect the download bandwidth requirement, but does require more upload speed than a single transmission.

Bitrate

Best H.264 Encoder Settings for Live StreamingThe bitrate refers to the rate of data transmission. The main thing to keep in mind is that you need a higher bitrate setting to effectively broadcast at higher definition and frame rate. Transmitting HD video at a low bitrate is pointless, since the transmission speed won’t allow the high quality you’re looking for.

For bitrates you have to walk a tight rope between video quality and user experience. As mentioned in our how to stop buffering article, buffering is something every live broadcaster should strive to avoid.

You don’t have to sacrifice quality for user experience if you do multi-bitrates, though. For example you can do a high definition, 2MB per second, feed alongside a standard definition 500kbps feed. That way you can cater to both an optimal quality and optimal user experience, depending on their connection speed. However, please note that multi-bitrate streaming requires a very fast upload speed. You want to double the total bitrate you plan to stream at. So in the above scenario you’ll want around a 5MB per second upload speed. If you have a lower connection speed yourself, consider a good middle ground. For example, 650kbps can present adequate quality without too much disruption from those with a slower connection speed. General rule of thumb is to offer your bitrate at something lower than 1MB per second if you are only doing a single bitrate stream.

Frame Rate

Best H.264 Encoder Settings for Live StreamingThe other main variable setting is frame rate. This is the number of “frames” — distinct images — that are transmitted each second. Video looks like a smooth moving image, but it’s actually a whole lot of still shots that are presented to your eyes at a rapid speed, so as to create the illusion of motion. Although the technology is digital rather than analog, the same principle applies here as with a roll of motion-picture film, which you can look at and see the individual photographs that are rapidly projected to create the illusion.

As with resolution, there’s a trade off between higher frame rates, which improve video quality, and higher bandwidth requirements. Most streaming video today has a frame rate of 24 frames per second (fps) or higher, with video running at 60 fps being at the very high end and rarely used. Dropping it much below 24 fps results in significant choppiness especially when fast motion is shown. That said, audiences are used to 30 fps, which is often called full frame. This is the general frame rate seen for a lot of televised content. Therefore 30 fps works as a good base, and if the motion does not look as smooth as desired, it can be slowly adjusted until the playback is optimal.

You will want to enable the  rate auto adjust in order to have the best image even if there is a lot happening on the screen, this is also called “variable bit rate” or VBR. A related setting is keyframe frequency or keyframe interval. This should be equal to 2 or 3 seconds in every scenario.

Other Settings

Besides resolution and frame rate, your encoding software allows setting the streaming protocol, video codec (of which H.264 is an example), audio codec, and other parameters for how the video and audio content is encoded and broadcast. Most of these other settings don’t affect video quality or bandwidth requirements in the same way as resolution and frame rate. Instead, they should be set to whatever your streaming platform requires.

For example, this page displays the encoder settings recommended for streaming through YouTube. Other services may have other requirements.

Conclusion

The settings on your encoder may seem a little daunting at first, but they shouldn’t be. There are two main things to remember. One is the trade-off between video quality (as determined by resolution and frame rate) and required bandwidth for both upload and download streaming. The other thing to keep in mind is your streaming platform and any required protocols for that. Once you have the settings figured out and tested, you can leave them along until something significant changes.

By Elise Lagarde.