Important Encoder Settings for Your Live Stream

By Max Wilbert

6 Min Read

banner image featured
author avatar

Max Wilbert

Max Wilbert is a passionate writer, live streaming practitioner, and has strong expertise in the video streaming industry.

Share this post

Sign up for a 14-Day trial.

  • Start streaming in minutes
  • 10 GB of free bandwidth on us
  • No credit card required

    Being able to stream live video over the Internet is a complex technical endeavor. It requires a good understanding of a number of working parts. That’s why our blog is here – to help you understand these systems so you can make the right choices when it comes time to make an important broadcast.

    The focus of this blog will be on the encoding side of live streaming. Specifically, we are going to examine the settings that you should program into your encoder. But first, let’s provide a very brief introduction to what the encoder is, for those who want to build their base knowledge first.

    Purpose of a Live Streaming Encoder

    Live streaming of digital video is all about encoding. Encoding relates to video compression and formats. In a raw state, the digital video would simply consist of a string of still images that would be displayed sequentially while an audio track plays in the background.

    However, this method of streaming video uses large amounts of space. A single minute of raw or uncompressed high-definition video footage can use up multiple GB of storage space. When footage starts getting 30, 60, 90 minutes in length or longer, file sizes become far too big to deal with.

    The solution is compression: a mathematical method of “throwing out” unnecessary data. Video compression reduces file sizes by throwing out data for sections of the video that don’t change from frame-to-frame. For example, if a corner of the video is black for 10 minutes straight, most of that actual data can be tossed and replaced with a reference like, “make this corner black for the next 300 frames.”

    A live streaming encoder reduces bitrate, or size, of the streaming video to make it feasible to send this content over the Internet.

    High levels of compression can severely reduce the quality of a video, making it look more pixelated. Many different “codecs” (or standards for encoding/decoding compressed video) have been developed over the years, and are available to combat this issue.

    Streaming-Optimized Media

    However, there is another element when it comes to encoding: streamability. Neither raw video or most compressed video formats are optimized for streaming over the Internet. Streaming formats use special markers and containers to ensure that video can be delivered piece by piece without any glitches or errors. Therefore, encoders not only compress video but also change it into formats suitable for streaming. With this basic understanding, we’re ready to actually set up an encoder for a live stream.

    Encoder Settings for Live Streaming

    Setting up an encoder can be confusing, but once you understand what the various settings mean for your stream, it’s actually quite easy. Here, we will list out a number of the most common settings found on various encoder platforms.

    These may vary by application, so if you encounter a setting that you don’t understand, refer back to the documentation for your platform. Alternatively, post here in the comments and we’ll do our best to help you sort out the problem.

    Selecting the Source

    The first element in setting up any live encoder is to select the source media. This could be an IP webcam, an HDMI input from a camera, or even static media files located on your computer. Audio sources will similarly be either microphone (standalone or built into your camera) or audio files.

    If you’re working in a multi-camera situation, your source may be a single feed coming from your live-switching apparatus. Alternately, your encoder platform might support live switching on its own –  vMix platforms, for example, support live switching.

    Either way, be sure to select the appropriate video and audio sources for the content you wish to broadcast. One common pitfall to avoid here is selecting the wrong source, such as selecting the built-in microphone on your laptop as an audio source for your broadcast.

    Video Codec

    software-vs-hardware-encoder

    The next selection to consider is what “codec” (or compression scheme) you would like your encoder to create and broadcast. The most common codec for live streaming is called H.264 and is supported on almost every modern video-capable device. Some upcoming codecs, which promise to reduce file size while maintaining quality, include H.265 and VP10.

    However, sticking with the standard H.264 is your best bet for now. One variation you may see is called x264. This is simply a particular method of encoding H.264 video. Encoding with x264 often uses fewer CPU resources than other methods, but you can test this before you get started.

    A Note on Multiple Streams

    Note that many of the settings described below are applicable for users with different Internet connection speeds. Many modern live streamers choose to broadcast multiple, simultaneous streams of the same content, with each encoded to a different bit rate (the amount of data sent per second). These can be delivered to users with slow, medium, and fast Internet connections to provide each with the best possible experience.

    Audio Codec

    You’ll need to select which audio codec to send in your stream as well. The most common settings are MP3 and AAC, audio formats that almost every device can support. We recommend AAC in almost every case as it is required by Apple’s iOS devices.

    Audio Sample Rate

    Another common audio setting you will have to select is the “audio sample rate.” This simply refers to the number of audio measurements taken per second during a given recording. We recommend that you set the sample rate to 44100 kHz for every live stream. This is a standard across most audio equipment and recordings.

    Video Resolution

    The resolution of your stream refers to the size (measured in pixels) of the video frame. The most common video sizes in use today are:

    • 426 x 240 (240p)
    • 640 x 360 (360p, Low Definition)
    • 854 x 480 (480p, Standard Definition, or SD)
    • 1280 x 720 (720p HD)
    • 1920 x 1080 (1080p, or Full HD)
    • 3840 x 2160 (known as 4K or Ultra HD)

    The resolution you choose for your video depends on several factors. First, all your equipment must support your maximum chosen resolution, including in speed and storage space. Higher-resolution footage takes a lot more processing power to encode.

    Second, your Internet speed must be able to accommodate your chosen resolution. While the resolution isn’t strictly linked to bitrate, higher resolution videos do require more bandwidth in order to look good. It’s no use sending an HD video connection if your bandwidth can’t support that level of quality at that resolution.

    Video Frame Rate

    The frame rate simply refers to the number of still images captured per second by your cameras. This is commonly 29.97 frames per second (rounds up to 30 fps), but 25 and 24 fps are also common. Some sporting events and other broadcasts dealing with rapid movements choose to broadcast at 60 fps to make the action appear crisper. If in doubt, stick with 30 fps.

    A related setting is keyframe frequency or keyframe interval. This should be equal to 2 or 3 seconds in every scenario in order to have the best image possible.

    Streaming Protocol: HLS, RTMP

    Live streaming videos are sent via a number of protocols that evolve over time. The most common and longstanding of these is called RTMP. The RTMP, or Real-Time Messaging Protocol, is a Macromedia (Adobe) standard for streaming video, audio, and metadata over the Internet in real-time. Most encoders, including those from the OBS project, Wirecast, vMix, and Adobe’s own Flash Media Live Encoder, can use RTMP.

    RTMP is a flexible and robust standard, but it’s not always sufficient today. That’s because it requires viewers to use devices that have Flash Player installed on their device. Increasingly, Flash is being retired in favor of more reliable and secure video delivery protocols, and many mobile platforms – most notably, iOS on iPhones and iPads – don’t support Flash.

    However, RTMP feeds are still the standard method for getting a stream from your encoder to the distribution servers. With the right video streaming host, a single RTMP feed from your encoder can be converted to other, more compatible standards, such as HLS and HDS, automatically on the server end.

    Here at Dacast, we use Akamai’s Stream Packaging for Universal Streaming service for this process. Akamai’s Stream Packaging ingests an RTMP stream from your encoder and automatically transcodes it to both HLS and HDS in near real-time, preparing the stream for any device format. This process does result in a minimal 30-45 second delay on the feed.

    Video Bit Rate

    Perhaps the most important setting in the whole encoding process is the bit rate. The bit rate is the bottom line that determines how much data your broadcast will consume. Whatever you set the maximum bit rate to, your data rate won’t rise higher than that.

    Bit rates are measured in bits per second, but more commonly in Kilobits per second (8 Kilobits = 1 kilobyte). Bit rate essentially determines how much bandwidth your broadcast will use. A higher number of Kilobits per second uses more data. This is critical for a number of reasons relating to Internet speed.

    First, your upload speed must be fast and stable enough to sustain an upload at this speed for the duration of your broadcast. Generally, we recommend that your upload speeds be capable of reaching speeds at least double of what you expect to need.

    Here are common recommendations for bit rates for various video resolutions:

    • 360p video: 400 Kbps – 1000 Kbps
    • 480p video: 500 Kbps – 2 Mbps (1 Mbps = 1000 Kbps)
    • 720p video: 1.5 – 4 Mbps
    • 1080p video: 3 – 6 Mbps

    Keep in mind, too, that your total bandwidth requirements will be the total of all your streams added together. So if you’re streaming a 360p stream, a 720p stream, and a 1080p stream, plus the audio for each, you may be streaming a total of nearly 12 Mbps of data. This means your Internet connection needs to be capable of sustained upload speeds of 24 Mbps.

    CBR vs. VBR

    One question is whether to use a constant bit rate (CBR) or variable bit rate (VBR). Using VBR means your data use will decline if the video content being transmitted at a given moment doesn’t contain much information. In contrast, data use will be higher if there is a lot of action on the screen.

    Using CBR tends to result in a more steady, reliable stream as VBR can cause big spikes in data usage. However, using VBR can reduce your total bandwidth usage, which can reduce costs. We recommend using VBR to make sure the image will remain clear if there is a lot happening on the stream.

    Audio Bit Rates

    Audio bitrate is also something you will need to set. We recommend the following settings:

    • For 360p video: 64 Kbps audio, mono
    • For 480p video: 128 Kbps, stereo
    • For 720p video: 128 Kbps, stereo
    • For 1080p video and above: 256 Kbps, stereo

    “Mono” or “stereo” refers to the number of audio channels: either one or two. This setting may be referred to as a “channel.” Choose the settings appropriate for your resolution as listed above.

    Buffer Size

    This advanced setting has to do with how video data is cached in the brief moments before it is broadcast. A higher buffer size can increase the quality of motion, but can actually increase your data rate at a given moment above your chosen bit rate.

    While this won’t affect your overall bit rate (the algorithms will compensate by reducing data usage at other times), it can cause quality issues for some viewers. We recommend you set the buffer size to the same as your bit rate to ensure smooth transmission and no spikes in data use.

    Linking to Your Live Video Host

    Now that you’ve learned how to configure the video and audio settings on your encoder, the final step is to link your encoder to the ingestion server. On the Dacast platform, you’ll be provided with four pieces of information when you create a stream: a “stream name,” a “stream URL,” a login code, and a password. You can input this information in your encoder to connect to Dacast’s servers and begin your upload.

    Other Settings

    When setting up your encoder, you may encounter a few other settings. Here’s an explanation for some of the settings found in the Adobe Flash Media Live Encoder. Other encoders should have similar settings.

    • “Input Size” and “Output Size” refer to the resolution of the video coming in from your camera(s), and the resolution you prefer to output as a live stream.
    • “FMS URL” is the URL of your media ingestion server.
    • “Stream” is often the box into which you will enter your “stream name.”
    • “Save to file” allows you to you simultaneously save your broadcast to a storage drive.

    Hardware vs. Software Encoders

     

    There are multiple types of encoders that can be divided into two main categories: hardware and software. Hardware encoders are dedicated devices used for encoding live streams. They’re powerful, reliable, and can have great features like built-in live mixing software. Leading providers of hardware encoders include vMix and Teradek. However, these are often very expensive.

    Software encoders are great alternatives for smaller budgets. Software encoders are simply applications like any other that can be installed on a desktop or laptop computer. You’ll need to ensure this computer is powerful enough to handle the live video stream before you rely on it during a broadcast. As we always say: test, test, test!

    One free example of a software encoder is Adobe’s Flash Media Live Encoder. This software package provides plenty of tools to get a live stream up and running. Another example is OBS or Open Broadcaster Software. This package is powerful, configurable, and can be installed on almost any computer. You can learn more about OBS and download the application on their project website.

    Any Questions?

    Configuring an encoder can be a confusing process. Lucky for you, we’re here to help! Sound off in the comments if you have any questions about this process.

    author avatar

    Max Wilbert

    Max Wilbert is a passionate writer, live streaming practitioner, and has strong expertise in the video streaming industry.

    Free 14-Day Trial

    • Start streaming immediately
    • No credit card required
    • 10 GB of bandwidth
    Read Next

    Read Next

    article featured

    How to Create Video-on-Demand Platforms that Help Your Business

    author avatar

    Max Wilbert

    13 Min Read

    article featured

    How To Build a Live Streaming App on iOS and Android [2023 Update]

    author avatar

    Max Wilbert

    12 Min Read

    article featured

    OTT Hosting and Video Delivery: 10 Best Solutions for 2023

    author avatar

    Max Wilbert

    16 Min Read

    Subscribe Now

    Stay up-to-date with the latest features and product releases. Cool tips, expert advice and more.