What Is Video Encoding?November 5, 2021
Just a few decades back, cell phones weighed more than today’s laptops and home theaters overflowed with VHS tapes. The ability to fit more data into less space has been one of the most remarkable feats of the past century — and compression technologies like video encoding have made it all possible.
Streaming now makes up a considerable chunk of the digital information floating around, with video expected to account for 82 percent of all internet traffic by 2022. In this blog, we’ll look at what video encoding is and its role in live video delivery. We’ll also explore the differences between lossy and lossless compression, common video encoding formats used for streaming, and how to quickly encode your streams using free software like OBS Studio.
Table of Contents
- What Is Video Encoding
- How Does Encoding Work
- Video Encoding Formats for Live Streaming
- Encoding vs. Transcoding: What’s the Difference
- How to Encode Live Streams With OBS and Transcode With Wowza
- Get Started Today
What Is Video Encoding
Video encoding describes the process of converting raw video into a compressed digital format for efficient delivery across the internet. Encoding occurs as soon as a video stream is captured and plays an essential role in all live streaming workflows. The encoder itself might be built into a camera, but it can also take the form of a hardware encoding appliance, computer software like OBS Studio, or a mobile app.
How Does Encoding Work?
Milliseconds after a live stream is captured, the data must be shrunk down for efficient transportation across the internet. Often, streams are reduced from gigabytes of data to megabytes of data.
Video encoding software and hardware rely on two-part compression tools called codecs to achieve this. Specifically, codecs apply algorithms to the video and audio data to condense it in every way possible. Once the stream reaches viewers, a video decoder built into the player software or set-top box decompresses the data for playback.
What Is a Codec
A codec refers to the compression technology that acts upon video and audio data to shrink it into a streamable size. Literally ‘coder-decoder’ or ‘compressor-decompressor,’ codecs apply algorithms to initially compress the data for transmission, and later decompress for viewing.
When it comes to streaming live video, both video and audio codecs come into play. H.264, also known as AVC (Advanced Video Coding), is the most common video codec. AAC (Advanced Audio Coding) is the most common audio codec.
Encoding in Action à la the MP3 Codec
For the sake of illustration, let’s focus in on an audio compression technology you’re sure to know by name: MPEF-1 Audio Layer III, a.k.a. MP3.
The MP3 codec revolutionized music consumption in the 1990s. Overnight, music libraries that once filled storage cabinets with CDs could be crammed into hand-held MP3 players — with no noticeable change in quality.
The MP3 codec did this by discarding all audio components beyond the limitations of human hearing for efficient transportation and storage. This is called lossy compression, an essential encoding method for video streaming.
Lossy vs. Lossless Video Encoding
Lossless compression occurs when the data is compacted without any information being discarded. A trusty ZIP file does just this, allowing us to cram a bunch of information into a small amount of space while preserving data integrity.
On the other hand, lossy compression enables a much greater reduction in file size by tossing out unnecessary data. Size is important when it comes to streaming, making lossy compression a must.
The goals of lossy compression are threefold:
- Drop all data that would go undetected by the human eye or ear
- Reduce the quality where possible
- Quickly compress all remaining data
When encoding for live streaming, lossy compression ensures efficient transmission across the internet. As such, all the encoding formats in our list below fall in this camp.
Subscribe and stay up to date
Get all the details on codecs and protocols, the latest live streaming trends, and much more.Subscribe
Video Encoding Formats for Live Streaming
Before getting into our recommended encoding formats, a quick note on terminology.
Video encoding formats describe the compression specifications available, whereas video codecs describe the software or hardware implementation of these formats. For the sake of this article, that distinction has little bearing. However, keep in mind that for any given specification, there may be multiple codec implementations available.1
Without further ado, here’s our list of the most popular formats in 2021.
Recommended Live Streaming Encoding Formats:
- H.264/AVC: H.264 is an efficient and widely adopted video compression technology that lends well to low-latency streaming workflows.
- VP9: VP9 is a more advanced and higher-quality compression technology than H.264/AVC that enjoys greater compatibility than many of its alternatives and works well for 4K streaming.
- H.265/HEVC: When delivering premium OTT content to living room devices, the royalty-bearing H.265 codec is the best encoding format currently available.
- AV1: AV1 is the latest and greatest open-source video encoding technology, but lengthy encoding times currently translate to high encoding costs.
See our deep-dive blog on video codecs for a more comprehensive look at the best video encoding formats for streaming — or check out the video below.
Encoding vs. Transcoding: What’s the Difference?
Video transcoding involves decompressing an encoded video file, (often) altering it, and then recompressing — potentially in a different encoding format — for delivery to end users. This conversion process can take place at the media server or in a cloud-based streaming platform.
Here are the key areas where encoding and transcoding differ:
1. Encoding occurs first; transcoding occurs second.
Just as one must write a book before translating it, a stream must be encoded before it can be transcoded.
2. Encoding is necessary; transcoding isn’t.
It’s not possible to live stream a video over the internet without encoding. This process of condensing raw video into a digital format for efficient delivery across the web always occurs, even if the encoder is built into the capture device from which you’re broadcasting.
Video transcoding, on the other hand, isn’t a must. Plenty of workflows, such as those using WebRTC from end to end, don’t require any transcoding infrastructure.
How to Encode Live Streams With OBS and Transcode With Wowza
Open Broadcaster Software (OBS) Studio is a free and open-source live streaming encoder that can easily be integrated into a Wowza-based workflow for large-scale streaming.
Justin demonstrates how to use OBS to encode a Real-Time Messaging Protocol (RTMP)-based live video stream in the video below. From there, he walks through the process of sending the live content to Wowza Streaming Cloud, repackaging it as an adaptive bitrate Apple HLS stream, and distributing it for playback using THEOplayer.
Get Started Today
No matter what type of streaming architecture you’re trying to build, Wowza makes it happen. Our full-service platform can be integrated with production-quality encoding appliances, browser-based Web Real-Time Communications (WebRTC) encoding, a wide array of software encoders, and everything in between. Give it a spin today by signing up for a free Wowza trial.
1. Streaming codec expert Jan Ozer explains this distinction in more detail in his article on the H.264/AVC specification:
“As a video standard, there are multiple implementations of the H.264 codec, including the x264 codec in FFmpeg, and the Beamr codec used in the Wowza Streaming Engine. Intel and NVIDIA both offer hardware-accelerated H.264 codecs that can be accessed from the Wowza Streaming Engine.
Because H.264 is a standard, all video encoded by any H.264 codec should play on any H.264 decoder or player, whether in a browser, smartphone, or Smart TV.”