Video Compression: Why do you need video encoding and what role does video codec play in it?
During the pandemic when most of the world was under lockdown and more people were online than ever, major streaming platforms took a collective decision to limit video content to 480p to relieve strain on global mobile networks.
Statista provides information on the level of global mobile video traffic from 2017 to 2022.
In 2018, global mobile video traffic amounted to 12,051 petabytes per month and is expected to multiply to 60,889 PB per month in 2022. Mobile traffic accounts for only 60% of total traffic. It is safe to predict video content consumption will reach 100, 000 PB/month in 2022.
The relevance of codec in the post-streaming world
Every time we binge a series on Netflix, make a Facetime call on our iPhones, or share a video on Telegram, we are streaming video from one computing device to another. It could be from Netflix data center to your laptop or your iPhone to your manager’s iPad via Apple data centers.
Since bandwidth is limited from server to users and there is only so much traffic a data center can handle, streaming video is all about delivering best quality videos to users in the smallest of bytes. The question is how can you compress a video without losing its quality?
The answer is codecs. Codecs are the reason we could stream 1.336 billion minutes of Mandalorian in 4K in a matter of weeks.
Netflix, Apple, Telegram, Disney Plus all employ a bunch of codecs to ensure smooth delivery of video content from their data centers to your device.
Uncompressed RAW and consumer codecs
Outside a codec, a video is uncompressed, unprocessed, lossless, and enormous in size.
A raw, uncompressed video is perfect for storing and editing purposes but transmitting such a large video over a network is impractical.
Codecs compress a video before sending it over a network through a process of encoding. Each codec has a different method to encoding and decoding an uncompressed RAW video. Video decoders for common consumer codecs are generally baked into operating systems such as Windows, iOS, Android, etc. although that might not be the case all the time.
Mac and iPhone users were unable to stream YouTube in 4K until recently because Apple wouldn’t add a VP9 decoder to its platforms. The codec feud between Google and Apple remained unresolved until the release of macOS Big Sur and iOS 14 and came at the expense of millions of users’ experience.
Compressed RAW vs Uncompressed RAW
A raw uncompressed video is compressed using one of the available codecs before transmitting to the network and making it available across the users.
The noir backlit looks are some of the signature elements of the often very violent period drama and have helped make the BBC series an international hit.
Uncompressed RAW Encoding
The first four seasons of Peaky Blinder were shot on an ARRI camera in ARRIRAW format. ARRIRAW, unlike Apple’s ProRes RAW or Google’s VP9, is not a codec. Rather, it is a format that literally returns uncompressed, unencrypted, and uncompromised sensor data. In a conventional sense, ARRIRAW can be considered a digital version of the camera negative. Most of our favorite movies including the Snyder Cut of 2017 Justice league were shot on an ARRI camera in ARRIRAW format.
Compressed RAW Transcoding
For later seasons, however, cinematographer SI Bell shifted to Red cameras and production went into Red’s proprietary Redcode RAW format. Redcode RAW is a professional-grade, intermediate CODEC, which is intended for post-production use. Redcode RAW along with Apple’s ProRes RAW, Blackmagic RAW, Hasselblad RAW are some of the examples of compressed RAW codecs. In fact, pretty much every major camera-maker and video-editing software company has a proprietary RAW format to its credit.
The tradeoff between professional and consumer codecs
Professional codecs, while doing a great job for post-production, aren’t intended for end-users consumption. Professional codes need specialized software to run, and the encoded video are comparatively huge in size to transmit over a network, making them impractical for streaming partners or P2P transfers. Therefore, videos in professional codecs are transcoded to consumer codes such as H264 or MPEG4 before transmission.
When Warner Bros picked HBO Max to release the Snyder’s Cut of Justice League, the team at HBO had to encode the movie from ARRIRAW to tens of consumer codecs to support every device and browser HBO Max is available on, including Apple iPhones and Google Chrome.
To give you an idea, an HD movie in uncompressed RAW format could go more than a Terabyte in size.
It was a huge task for the team to retain the quality of the theatric masterpiece in 4:3 aspect ratio on our small screens. Consumer codecs have a considerably higher compression ratio than professional codecs, but they are essential for consistent delivery of video content over streaming and P2P channels.
Compressed RAW codec is smaller in size and faster to transcode
However, for the fifth season of Peaky Blinders, Netflix did not have to encode the uncompressed video since it was shot in Redcode RAW, which is a compressed RAW codec itself. Rather the team just had to transcode the video from a professional codec to various consumer codecs such as H265, MPEG4 upon user requests. Video transcoding is a simpler and less time-consuming job than encoding. Therefore, video content intended for small screens is shot in one of the professional RAW codecs rather than uncompressed RAW.
The anatomy of video transcoding from server to client
Every time you’re converting a movie from H264 to MPEG4 or exporting a Hasselblad RAW footage to HEVC, you’re running a transcoding job. In a post-streaming world, however, transcoding is more about compressing video files till the point they start showing a significant quality loss. A smaller video file is easier on streaming platforms’ data centers and end-users limited bandwidth.