
I will be basing my post on the modes supported by the popular H.264 and H.265 encoders x264 and x265, as well as libvpx, as available in ffmpeg. Now, let’s dive into the different modes. Knowing the scenario helps you choose a rate control mode. You want to ensure that the file ends up having a certain size. Encoding for Devices - You want to put your file on a DVD, a Blu-ray, et cetera.Live Streaming - Like 2., but you want the encoding to be done as fast as possible, and you don’t have any knowledge of the content beforehand.You need to make sure that the file doesn’t exceed a certain bitrate, or you need to provide different representations of the same file at different nominal bitrates (for Adaptive Streaming)
#X264 ffmpeg crf 25 download#
Streaming - You want to send a file over the Internet, using typical Video-on-Demand (VoD) streaming solutions such as HTTP progressive download or HTTP Adaptive Streaming. The file should have the best possible quality at the lowest possible file size, but you don’t care about the exact size. Archival - You want to compress a file for storing it in your archive, for example on an external hard drive or on your network storage. In general, there are a number of different scenarios that all impact the way you should design your encoding pipeline: What is your encoding scenario?Ĭhoosing a rate control mode strongly depends on your use case. High spatial details and complex textures are also hard to encode. What is hard and easy in terms of compression? Lots of motion in a video for example require more bits to encode, since the differences between adjacent video frames will be larger. Simply put, VBR lets the encoder use more bits for “stuff that is hard to encode” and save bits for the parts of the file that are easy to compress. Variable bitrate ensured that you’d achieve the lowest possible file size at the highest possible quality under the given constraints (as set by the VBR quality level). To rip our CDs, we had been using Constant Bitrate (CBR) encoding for a while, when later, Variable Bitrate (VBR) encoding came along. Many people are more familiar with rate control in audio encoders, especially those who-like me-grew up with MP3s. Note that this is not about the nitty-gritty details of Rate-Distortion Optimization. This post is a brief guide on the different modes it explains when you’d use which, as an end user.
Why should you care? Often enough, you see examples of video encoding commands that apply the wrong kind of rate control mode or wrong bitrates. Rate control comes in many forms-you’ll recognize the terms “1-pass” and “2-pass”, “CBR” and “VBR”, maybe you know about “VBV Encoding” or “CRF”.
Rate control is a crucial step in determining that tradeoff between size and quality. The goal of (lossy) video encoding is to save as many bits as possible, reducing the file size over the original input file, while retaining as much quality as possible. What is “rate control”? It’s what a video encoder does when it decides how many bits to spend for a given frame.