Video Encoding: The Definitive Guide [Updated for 2021]
Table of Contents
Video technology has undergone massive evolution in the past couple of decades. This growth has come simultaneously with the development of the internet.
While motion pictures—videos made of large collections of still photos—were fine in the age of VHS tapes and even DVDs, they made for excessively bulky files when videos became digital. It became difficult to upload and share with more modern types of hardware.
Video encoding was brought to life as a solution to aid in this technological transition.
Let’s break down video encoding for live streaming and talk about the importance of each moving part.
Table of Contents:
- What is Video Encoding?
- What are Codecs?
- Video Encoding vs. Transcoding: What’s the Difference?
- Understanding Adaptive Streaming and its Importance
- Video Quality vs. Size
- Streaming Video Encoding Glossary
What is Video Encoding?
In the most basic sense of the term, video encoding is compressing video files so that they are not saved as individual images but as fluid videos. Here’s one definition of video encoding.
“In video editing and production, video encoding is the process of preparing the video for output, where the digital video is encoded to meet proper formats and specifications for recording and playback through the use of video encoder software.”
What does Encoding a Video Mean?
We can answer what it means to encode a video with the following example. Imagine a basic flip-book. Photos are put together in a way that seems to move when you flip through the page quickly. That’s similar to how a video works.
In the early days of digital video, video files were all RAW video. This means that video files were a collection of still photos. For a video recorded at 30 frames per second, you had 30 photos per second of footage. That’s 1800 images per minute of video. As a result, video file sizes were massive.
The only sensible solution was to compress these videos, but the quality was lost through this process.
Engineers developed video encoding which provided a way to compress these files without compromising the quality.
What is Video Compression?
Video compression is using encoding to reduce the size of a digital video file.
It analyzes the content of a video to reduce the overall file size by determining which frames are essential and which can go. If two frames are basically identical, you can get rid of the data for one frame and replace it with a reference to the previous frame. In this simple example, you can reduce your video file size by about 50 percent.
All types of video compression use variations of this process to reduce file sizes. When we talk about video encoding, however, we’re referring to a specific type of video compression.
How Does Video Compression Work?
Video compression typically happens at the camera level. For example, smartphones, consumer-grade camcorders, and most professional camcorders record video in the H.264 video codec format.
This means that, as the camera is recording, the RAW images from the video sensor encode in real-time, typically using the H.264 format. This compressed—or encoded—video then records to the storage on the camera.
What are Codecs?
The tools that are used for video file compression and playback are called “codecs.” Codec stands for coder and decoder (co/dec). Usually a hardware device or computer software, a codec is a video encoder that encodes or decodes a digital data stream or signal. They compress raw video and audio files between analog and digital formats and make them smaller.
Different devices have different types of support for various streaming codecs. Have you ever downloaded a video then tried to play it to find that playback failed? You might not have had streaming software capable of playing back video encoded with that codec.
Today, the most common and best video codec is H.264. Just about every device in existence supports this protocol and it’s common for use with online video. However, there are several other codecs available, including MPEG-2, HEVC, VP9, Quicktime, and WMV.
Video Encoding vs. Transcoding: What’s the Difference?
It’s fairly common to hear the terms video encoding and transcoding used interchangeably. However, encoding and transcoding are not one and the same.
- Transcoding is the process of creating copies of video files in different sizes.
- Encoding refers to either the initial process of compressing RAW video or to the process of re-encoding a video into a different format.
Transcoding is always encoding, but encoding is not always transcoding. There are a variety of reasons why you might want to transcode or encode a video:
- Reduce file size
- Reduce buffering for streaming video
- Change video resolution or aspect ratio
- Change audio format or quality
- Convert obsolete files to modern formats
- Meet a certain target bit rate
- Make a video compatible with a certain device (computer, tablet, smartphone, smartTV, legacy devices)
- Make a video compatible with certain streaming software or service
The common purpose of all of these reasons is generally to create the best experience for viewers or to make the video content more easily accessible.
How to Encode a Video with Dacast’s VOD Solution
Dacast is a video hosting platform that is designed for advanced video hosting. This is an enhancement to Dacast’s basic streaming video encoding and uploading features. The VOD platform includes features such as an advanced bulk uploader and a Dropbox uploader.
Streaming video encoding comes with our online video platform. You simply have to indicate your preferred settings when uploading your video. The encoder software automatically transcodes your video into multiple different formats according to your indication.
Here is a more detailed look at how to encode video and how the encoding process works with Dacast:
Step 1: Create an “Ingest Recipe”
The first step in encoding your videos on the Dacast platform is to create an ingest recipe. For context, an ingest recipe is a group of encoding presets at which the platform will encode and deliver your videos.
Log into your online portal, and navigate to your encoding settings. Once you’re there, click the button labeled “Create New Recipe.”
When it takes you to the next screen, input a title at the top to name your recipe. Next, use the checklist to decide which renditions—or quality and size presets—you want to use for this ingest recipe.
Finally, check the box at the bottom if you want to use this as your default setting. Click the “Save and Close” button to finish.
Note that optimal visual quality (1080p) is best for HD video playback. Take into consideration that you’ll use more bandwidth this way and that viewers with slow internet connections might experience buffering issues.
Please select one of the following configurations and ensure your encoder is set up with these exact encoder settings to help prevent issues:
|Name||Low Definition||Standard Definition||High Definition||
Full High Definition
|Video Bitrate (kbps)||350 – 800||800 – 1200||1200 – 1900||1900 – 4500|
|Resolution Width (px)||640||854||1280||1920|
|Resolution Height (px)||360p||480p||720p||1080p|
Here are general guidelines based on resolution rates:
|Resolution||Best Use Case|
Good option if you want to save bandwidth and ensure smooth playback for viewers on slow Internet connections. Be aware that the visual quality will remain low.
High visual quality. Not recommended for full-screen playback.
Optimal visual quality, best for HD video playback. Beware that you’ll use more bandwidth, and viewers on slow Internet connections might experience buffering issues.
Ultra-high resolution 4k. The best possible quality, but most viewers don’t have sufficient internet speed to stream this content.
Step 2: Repeat as Necessary
For example, if you film most of your content at 1920 x 1080 resolution, 30 frames per second, and record using the H.264 video codec and AAC audio codec in the .MOV container format, you can create an ingest recipe for these preferences.
This recipe might transcode this video into three additional versions: one 720 pixels wide, one 480 pixels wide and one 240 pixels wide. You’ll also be able to maintain the original format. This will allow viewers to be served the optimal quality via adaptive bitrate streaming.
You likely will have times where you want to record footage with different settings. You can create a second ingest recipe for this preference. When you want to upload videos in a different format, just select the preferred recipe and your content will be automatically transcoded into your chosen formats.
Step 3: Upload Your Video Files
Dacast’s bulk uploader handles hundreds of video uploads at a time. Mix and match video file types and resolutions, and the system will expertly encode your videos to the highest quality possible using your chosen ingest recipes.
During this stage, you can choose to create audio-only versions of your video.
In addition to a variety of video qualities, you can also choose to add watermarks and generate thumbnails. Our tool also allows you to upload huge video files (50+ GB) with no interruption. The intelligent video uploader automatically pauses and resumes uploads when your network connection goes down, so you don’t have to worry about any data being lost.
The OVP platform also supports Dropbox upload. You can connect Dacast and your Dropbox account to set as many videos to upload as you desire. Once the Dropbox Uploader is active, a folder will appear for you in your Dropbox account where you can find all of your video files. Once they are there, the videos will automatically upload using your default ingest recipe.
Note: It’s Impossible to Increase Quality Retroactively
There is one common misconception that we need to clear up. Encoding can do a lot of things, but it cannot retroactively improve the quality of a video. After you upload a video file to Dacast (or any other streaming platform), there isn’t much you can do to increase its quality.
Attempting to encode the video into a larger resolution than you started with will only result in a very bad quality video.
Of course, there are ways to upscale video to larger sizes. However, this is a complicated and intensive process. It’s best handled using a dedicated application like Final Cut X, Adobe Premiere Pro, or another app.
Understanding Adaptive Bitrate Streaming and its Importance
Adaptive bitrate streaming—also known as “Adaptive bitrate” and “Variable bitrate”—the term refers to delivering an appropriate rendition of a video to the viewer based on the strength and speed of their internet connection.
If you’ve ever watched YouTube videos or Netflix on a smartphone in a moving vehicle, you’ve likely experienced adaptive bitrate streaming without realizing it. When the cellular signal is good, video quality is high. When signal strength drops, you’re automatically switched to lower video quality to avoid buffering.
The underlying technology behind adaptive streaming is transparent to you and your users. Dacast simply delivers the best version of your video—based on the versions created using your ingest recipe—to your viewer. This is known as multi-bitrate streaming, and it’s a premium feature in the online video industry.
Video Quality vs. Size
When it comes to video, you can’t always have both high quality and small size. In general, these represent a trade-off:
- High-quality video files are larger, take longer to upload, and require more bandwidth for viewers.
- Low-quality video files are smaller, take less time to upload, and require less bandwidth for viewers.
Imagine that your internet connection is a tube. The faster your connection, the larger the tube. Low-speed Internet connections have narrower pipes. Those large files need to squeeze through them. As a result, you run the risk of subjecting your clients to stuttering and buffering streams.
On the other hand, opting for lower-quality videos means they’re available immediately, no matter where your clients are watching them. However, the footage won’t look as good.
If you have your target bit rate in mind but are struggling to achieve desirable video quality, you’ll need to cut back in some respect.
All else being equal—for example, the same codec—there are four main contributing factors that determine video file size in relation to quality. These include:
- Time: longer = bigger files
- The number of pixels (resolution): larger = bigger files
- The frame rate: higher = bigger files
- The amount of motion present in the video: more = bigger files
What you cut back on will depend on what your audience needs and what you’re willing to cut back on.
Common Video Encoding Challenges
There are seven common encoding challenges that broadcasters find themselves facing. Here are a few solutions that may help you navigate encoding roadblocks that you may encounter.
1. My viewers tend to have slow Internet connections.
Video files tend to be larger files, so they require fast internet speed with great bandwidth to display the video properly. When the Internet connection is slow, the video starts stuttering and often displays in very poor quality.
With Dacast, you can use the analytics feature to determine where most of your viewers live. Then, the software will match that information with average internet speeds to get a sense of the average connection speed of your customers.
You can set your overall bit rate to match their download speed in order to achieve a reliable playback. We recommend a short trial and error test to determine which settings to use. This will help you determine how low you can get the bit rate of a video while maintaining the appropriate quality.
To conduct the test, you can start with a high frame width (say 1280px, which is 720p at the 16:9 aspect ratio) and a relatively low bit rate (around 512kbps). See how the video looks when encoded with these settings. If you are not pleased with the image quality, try either lowering the frame width or increasing the bit rate.
Also, be sure to encode multiple versions of your video. Adaptive streaming will ensure viewers get the best quality they can stream smoothly.
2. I want to save bandwidth.
The more often your videos play and the higher their quality, the more bandwidth you will need. Every Dacast pricing plan comes with a particular bandwidth limit. You can use the same approach as in the previous question to reduce bitrates to the lowest acceptable level. This will reduce your bandwidth consumption.
3. My encoded video has a larger file size than the original one.
While encoding can’t increase quality, it always changes file size. In other words, don’t worry too much about larger file sizes. Sometimes, this just means you’ve been overly generous with your bitrate settings. Other times, it means you’ve changed from one codec to another.
If you really need to reduce file size to lower bandwidth consumption or serve users with slow internet connections, try reducing the bitrate.
4. After encoding, the audio is out of sync.
This could have something to do with the frame rate of your video. Use a free tool to check the frame rate of your original file. If the frame rate of your video is unusual, you may discover the audio is out of sync after encoding.
In that case, we recommend you try the Two-pass Encoding feature. This can solve many issues the encoder might have interpreting frame rates.
If it’s not the frame rate and the audio continues to play up, you will need to check the relative length of the audio and video streams. You can use the same tool mentioned above to get that information. In some cases, you may have created source files with different lengths for their audio and video streams.
When this happens, the encoder doesn’t always succeed in precisely matching up the streams as they were before. Again, try two-pass encoding. However, if the problem persists, you may need to ask your video editor to cut the original file.
5. My video is already encoded in a web-ready format
If your video is already an H.264 encoded MP4, you can turn off Dacast’s encoding by selecting “no encoding” in your ingest recipe. However, one thing you need to keep in mind is the MOOV atom. MOOV atom is a bundle of metadata. Before saying no to this encoding solution, ensure the MOOV atom is positioned at the beginning of the file.
If this sounds complex, we recommend simply using Dacast’s built-in encoding to re-encode your MP4 file. As long as you choose the same frame size and bit rate as your original file, encoding the video with Dacast will not have any noticeable impact on its quality.
6. I don’t want my videos in an MP4 format
The Dacast video hosting solution only encodes content to H.264 in an MP4 container. If you feel that you need your videos encoded in another format, have a chat with our Support Engineers and we’ll see what we can do for you.
7. I uploaded a video and the quality is really poor
Generally, this means the frame size and bit rate of the target video are much lower than the original video. To get the maximum quality of your videos, be sure to use the “Original” profile in your ingest recipe in addition to any lower qualities you have selected.
This will match the source file’s frame size and ensure you have a high-quality version of your video available.
Streaming Video Encoding Glossary
Frame rate is the number of frames that display per second in a video. The faster the frames flicker along, the more lifelike and immersive the video becomes. The rate at which these still images display is expressed in frames per second (fps). Common frame rates are 24, 25, 30, and 60 fps. Higher frame rates show action better. Lower frame rates give your video a more “cinematic” look.
Bitrate describes how much data a video file contains (measured on a per-second basis). In general, a higher bit rate means better video/audio quality. However, you can’t make the streaming video look better or improve sound quality by increasing the bit rate if it was low in the first place. Bit rates are usually measured in kilobits per second (kbps) or megabits per second (Mbps).
Video aspect ratio refers to the shape of a video recording. Specifically, it’s the proportional relationship between the width and height of the video. This is usually expressed in the W:H format, where W stands for width, and H stands for height.
For example, most modern television and computer monitors have an aspect ratio of 16:9, but this will vary. Remember the old television sets? That’s a 4:3 aspect ratio.
Video resolution describes the number of pixels in a video file. It’s the width and height of the projected image, measured in pixels. For example, a video might have a resolution of 1280 (horizontal pixels) × 720 (vertical pixels). This is usually written as simply 1280×720, or abbreviated to 720p.
Codec stands for “coder/decoder”. It’s a piece of software that compresses raw video and audio files when encoding and encodes or decodes the files on playback. Codecs are necessary because video and audio files are very large.
Therefore, they become difficult to transfer across the Internet quickly. There are hundreds of different codecs out there. Common video codecs are H.264, MPEG-2, DivX, XviD, Theora, VP8, and the WMV family. Common audio codecs are MP3, AAC, Vorbi, and the WMA family.
Remember, codecs do not determine the file’s extension. Rather, that’s the container format. Some of the most popular container formats include MOV (Quicktime), P4, OGG, and AVI.
Encoding Your Videos the Right Way
Video encoding is what has made live video streaming possible. Without it, we’d have trouble transitioning out of the age of VHS tapes and DVDs and into the world of internet video streaming.
Our video encoding software, Dacast, has an easy-to-use and powerful streaming video encoder and is built right into our online video platform.
Of course, there’s always more to learn. For example, if you’re interested in a scientific approach to calculating the optimal bitrate for an H.264 video encode, check out the Kush Gauge calculator. Technologies are changing all the time – but with this basic grounding, you should be able to get up and running.
If you’re interested in accessing a powerful video hosting solution with scalable live streaming delivery, check out our streaming solution plans or contact us directly.
Do you still have questions or feedback about video encoding? Post send our support team a message, and we will get back to you. For regular tips and exclusive offers, you can join our LinkedIn group.
Stay up to date with our latest features and product releases