Optimizing Video Encoding Settings for Your Use Case

February 26, 2019 by

Optimizing Encoding Settings for Your Use Case

 

We recently looked at video codecs and how encoding works. Today, we’re discussing some video encoding best practices based on your broadcast event. Read on for common terminology and some recommended settings.

 

Encoding Best Practices

It’s important to understand what you’re trying to deliver when configuring a live stream. The right encoding settings depend entirely on your use case.

For example, music events require the best audio possible. Security cameras? Not so much. And while video chats don’t need to be streamed in 4K, maximizing quality takes first place for many high-profile broadcasts.

The perfect encoding configurations for your live stream might be ill-suited for another’s. This brings us to the first step when setting up your encoder: considering the specifics of your streaming scenario.

You’ll want to optimize for:

  •  Audience
  • Use Case
  • Venue or Location
  • Available Bandwidth
  • Degree of Motion

 

Video Quality vs. Bandwidth

High-quality videos make for bandwidth-intensive streams. And in today’s digital world, bandwidth means money. What’s more, your internet speed must be able to handle the bandwidth you’re trying to encode.

Encoding low-bitrate streams whenever possible helps minimize costs. We recommend adjusting the following attributes based on your unique broadcast.

  1. Frame Rate
  2. Keyframe Interval
  3. Audio Bitrate
  4. Overall Bitrate

By configuring the above settings, you’ll encode streams more efficiently and distribute them more cost-effectively. Let’s start by defining these terms.

 

Frame Rate

Frame rate refers to the speed at which each frame is shown. The lower the frame rate, the choppier the video.

Smooth HD streams use 60 frames per second (fps), meaning that each second of video contains 60 distinct images.

Going with a standard value like 25 or 29.97 fps is often a safe bet. Reducing the frame rate even further can help minimize overall bitrate when quality doesn’t matter. For remote cameras used to capture security footage, a frame rate of about 10-15 fps works fine.

 

Keyframe Interval

A key frame interval, also called an i-frame interval, is an encoding setting that determines how often the whole picture is transmitted.

When a stream is encoded, only some frames show the complete picture. The initial (key) frame includes a complete image, while subsequent (delta) frames only depict changes from that image. This helps reduce redundant data and lower the bandwidth.

If your video stream depicts static scenes such as a news desk or talk show, then a keyframe interval of two seconds would suffice. But action-packed streams of sporting events require a shorter keyframe interval of around one second.

 

Audio Bitrate

Crystal-clear audio matters. Viewers will abandon a stream altogether if they can’t hear what’s going on. For this reason, it’s also important to allocate bandwidth to the audio segment.

That said, audio plays a bigger role in some streams than others. You’ll want to use a higher audio bitrate for a news broadcast than for a sporting event. While perhaps counterintuitive, this has to do with how your audience is engaging. When it comes to the news, viewers listen to what the reporter has to say. With sporting events, they watch the game.

 

Overall Bitrate

Overall bitrate is one of the hardest things to balance against quality and the type of streaming event. In most cases, engineers attempt to push the bitrate as high as possible in an attempt to get the best picture quality.

There are two issues with this approach:

  1. Encoding high-bitrate streams without sufficient bandwidth and resources can corrupt the video.
  2. Viewing high-bitrate streams without sufficient bandwidth can result in dropped video frames.

You’ll want to consider whether or not you’re sending adaptive bitrate (ABR) video streams. With ABR, the player chooses a bitrate that it can comfortably support. That way, every viewer gets a good experience regardless of their connectivity.

In most cases, the adaptive renditions will be configured in the server and not from the encoder. But you’ll need to configure the keyframe interval to support ABR. Use a keyframe of one or two seconds for these streams — regardless of what you’re recording.

 

Recommended Encoder Configurations

We recommend customizing the keyframe interval, frame rate, audio bitrate, and video bitrate to your streaming scenario. That way, you’ll encode a suitable stream in the most efficient manner possible.

Below are a few standard recommendations based on use case, degree of motion, audience, and available bandwidth.

 

Sports and Gambling Events

Sports and gambling events require a short keyframe interval to accommodate the pace of movement, which also allows you to tune down the latency. The audio bitrate doesn’t need to be as high since the action is on the field.

  • Keyframe Interval: 1 second
  • Frame Rate: 29.97/25 fps
  • Audio Bitrate: 128-192 kbps
  • Adaptive Bitrate Streaming: Yes

 

News Desk and Talk Show Streams

The bitrate doesn’t need to be very high for talk shows. Less motion in the video allows for a lower frame rate.

  • Keyframe Interval: 1-4 seconds
  • Frame Rate: 29.97/25 fps
  • Audio Bitrate: 192-256 kbps
  • Adaptive Bitrate Streaming: Not essential

 

Security Cameras

When it comes to security cameras, quality isn’t important. You can keep all the settings low to speed things up.

  • Keyframe Interval: 4 seconds
  • Frame Rate: 10-15 fps
  • Audio Bitrate: 64-128 kbps
  • Adaptive Bitrate Streaming: No

By understanding what you’re trying to deliver before configuring your encoder, you’ll improve delivery and provide a better streaming experience to viewers.

 

Just Getting Started?

New to streaming? Get started with a free developer trial of the Wowza Streaming Engine™ software or the Wowza Streaming Cloud™ service. Both solutions integrate with a variety of encoders, including the free Wowza GoCoder™ mobile app and SDK.

 

Additional Resources

Encoding Best Practices for Wowza Streaming Cloud
Optimize the Video Bitrate for Wowza Streaming Engine
Video: Connect an RTMP Encoder to Wowza Streaming Engine