If you've decided to live stream content online, you must do a few things. Setting up the camera is the most obvious part of the process, but that’s only step one.
Streaming your live video content online requires encoding the video so that your company can transmit the data appropriately and transcode it for real-time consumption.
If you don’t know what video encoding is and why you need it, in this article, we’ll explain everything you should know so that you can live stream your content without any hiccups.
In the context of video, encoding is the process of taking raw video content — the content that your video device records — and transforming it into a format that’s compatible with an electronic device.
Encoding is not the same as transcoding, despite their similar names. The main difference between both concepts is that encoding refers to the process of taking your video content and making it easy to consume on a computer, phone, or tablet. On the other hand, transcoding takes an encoded video and decodes it in different sizes, resolutions, bitrates, and more.
Put in another way:
Read More: Video Transcoding: What is it, why is it important, and how can I do it?
At first, the need for encoding seems a bit redundant. You may think to yourself that video doesn't need to be changed from the format it's recorded. After all, when you record a video with your phone, it's immediately ready to playback afterward. That happens because your phone automatically encodes and decodes your video after it's recorded.
At some point, you must have downloaded a video that wasn't consumable on your computer or phone. You may recall the problem was tied to the "codecs" or the "format." Before we get into these concepts, we need to go over the details of what makes encoding necessary.
Video cameras record content so that each frame is a picture. Therefore, a video is a compilation of still images, much like hand-drawn animations.
The problem with this setup is that each second of a video is made up of 24 to 60 frames (also known as “frames per second” or “fps”). Multiply your recording’s fps by its amount of seconds, and you will get the total number of frames per video. Multiply that number by the size of each frame (which can vary from a few dozen to hundreds of kilobytes, or even megabytes), and you will get a massive number that will be impossible to playback and transmit online.
To overcome this issue, you encode your recording so that each frame is smaller and easier to play. Better yet, the video will be smaller while losing little to no quality.
Still, this explanation doesn't explain everything about encoding, so let's take a deeper dive into the technicalities of encoding.
Imagine you have recorded a two-minute video on your camera. When you connect your camera to your computer, the camera’s software will automatically:
These two steps are what encoding is all about. Let’s go over them individually to understand this even better.
Codecs are algorithms that transform a raw video file into an asset that you can consume on a device like a computer or a phone. What makes codecs crucial in the encoding process is that they compress a video file by using either of the two compression formats:
As the acronym suggests, codecs compress the file, so it’s easier to store and transmit, but they also decompress it to make it compatible with other devices. Some codecs can compress both video and audio files, while some can’t. In any case, codecs are always paired together so that you can compress both parts simultaneously.
There are dozens of codecs for each of the two compression formats, each with benefits and disadvantages. The five most popular ones are the following:
H.264 and H.265 are perfect for high-definition videos intended for live streaming. The drawback? They come with a costly license fee.
AV1 and VP9 are the best free alternatives capable of providing similar performance to the previous ones, with VP9 better suited if you plan to target Android devices.
An encoding video format is a file that contains (hence its name) the compressed audio and video file. It also includes the metadata, which allows the video player to use the audio and video codecs properly, among other things.
Although a video container and its extension aren’t necessarily the same thing, they are often treated as equal, with some of the most widely-used ones being:
Just as it happens with codecs, each encoding format carries its benefits and challenges. Some offer better compatibility with video players, while others focus on quality instead of compression.
Encoding a video is a relatively straightforward process that requires some planning to find the right codecs and formats for your needs. But when it comes to encoding for live streaming, things get a bit more complicated.
The first point is that the video content needs to be encoded fast so it can then be transcoded and transmitted online (what we call “streaming”). The compression format must be lossy to enable fast encoding. Sure, the quality may not be the highest, but it’s the most convenient for speed.
The codecs previously mentioned offer lossy compression, the most widely used being H.264.
Most smartphones come with a built-in encoder, making it easy to live stream from social media and messaging apps. However, specific encoding software and hardware may be necessary for companies that need high-quality live streaming.
Imagine that you want to live stream an event in a physical location, like a retail shop. You set up your cameras, lights, microphones, computer, and Internet connection.
Within the live streaming workflow, the encoder takes the raw digital data from the cameras and microphones and transforms them to be transcoded and appropriately streamed.
Since encoding live-streamed content requires a higher capacity than what we mentioned so far, you will need to set up a special hardware or software encoder.
Roughly speaking, encoding hardware is suited for professional broadcasting (think CNN or the BBC). Although it provides the most reliable and faster results due to the machine focusing solely on encoding, its costs and lack of upgrading options (e.g., switching) aren’t worth it for most streamers.
Live streaming encoding software offers a similar capacity at a much lower price. Even if the latency is higher, encoding software represents an effective alternative. There are many options available, three of the most popular being:
When selecting an encoding software, you need to guarantee it meets the following criteria:
Once you have chosen and set up your encoding software, you must connect it with your transcoding solution, such as the one Livepeer Video Services offers. This last part is crucial, as no matter how good the encoding may be, if it’s not properly ingested, packaged, and transported through the servers, your viewers will not enjoy your live stream.
To learn more about how crucial transcoding is and how you can set it up, check our guide on the subject:
Read More: Intro to Transcoding
Encoding costs are what accountants call “fixed costs” because they don’t change depending on your needs. The opposite is true with transcoding, as the more content you transmit, the more you will spend.
Consequently, your costs will depend on the encoding hardware or software you use. Fortunately, encoding doesn't cost as much as transcoding. And since encoding is crucial for live streaming, you should invest adequately in your hardware or software.
To give you an idea of what encoding hardware costs, here are three popular options and their costs:
You may also need to buy a video studio recorder to save the streamed content as encoders aren’t too good at this task (except when you only use them as a backup).
The options shared above already explain what you can expect to pay with regard to software. Higher-end solutions offer a mix of monthly plans (most charge between $9 to $50 a month) to high one-time fees — anywhere from $60 to $1,200.
We recommend you use OBS, which is free and popular. Better yet, you can integrate it with Livepeer Video Services in five easy steps as we explain in the following tutorial:
What did you think of this tutorial? Give us any feedback on how it can be improved and send over any questions you might have by emailing us at hello@livepeer.com. We’d love to help you stream using Livepeer.com!