The breakeven by preset for different volumes at 8 cents per GB.

The Correct Way to Choose an x264 Preset

To choose the optimal x264 preset, you have to balance encoding and distribution costs. This article shows you how. 

Over the last few years, I’ve used the first chart below to represent the tradeoffs associated with different presets and help readers (or listeners) choose a preset. To create the chart, you encode your test files to standard parameters using all the presets, measuring encoding time. Then you verify that the bitrates are similar, and then compute VMAF and low-frame VMAF on all the files. Low-frame VMAF is the lowest VMAF score for any frame in the video, an indicator of transient quality problems.

Presets and Quality

Then you average the scores and plot the results. The horizontal axis contains all the presets. The blue line is the percentage of encoding time each preset takes as compared to the placebo. The red line is the harmonic mean VMAF, and the green line is the low-frame VMAF.

This chart illustrates the quality/encoding time tradeoffs associated with x264 presets.
This chart illustrates the quality/encoding time tradeoffs associated with x264 presets.

I assumed that once you performed this analysis with your own test files, you could get a pretty good idea of the tradeoffs for each preset and choose the optimal preset for your content. With my test files, the veryslow preset delivered the top quality, so placebo made no sense, while slow delivered 99.52% of the available overall quality in ten percent of the encoding time of placebo. Sounded pretty good to me.

Presets and Encoding Cost

But then, after saying and writing, “Choose a bitrate that delivers a VMAF score of 93-95 for your top rung video,” for the millionth time, it hit me. We don’t choose a preset to set encoding quality. We choose a preset to control encoding cost. If you choose a lower-quality preset, you’ll save encoding time and costs, but you’ll have to increase your bandwidth to achieve your quality target.

This led me to create another chart like that below. The red line tracks the decrease in encoding time, while the blue line is the bitrate percentage necessary to achieve the same quality as veryslow. Since placebo took four times longer than veryslow and produced slightly lower quality, I ignored placebo and computed both timing and bitrate deltas from the veryslow preset. That’s why the timing numbers are different from those above.

Encoding time savings and bandwidth increases necessary for lower quality x264 presets.

Choosing the Optimal x264 Preset

Then it becomes a breakeven exercise that depends upon the assumed bitrate (4 Mbps for 1080p 30 H.264), the encoding cost per hour ($0.62), and the cost per GB of bandwidth ($0.08).  At this bandwidth cost (second tier on Amazon Cloudfront), the veryslow preset is the cheapest option from the get-go. This changes slightly as the bandwidth costs drop to $0.04 and $0.02 cents, but the bottom line is that after you distribute 250 hours of video, the highest quality preset always delivers the lowest cost.

The breakeven by preset for different volumes at 8 cents per GB.

A complete lesson detailing these findings with links to the bottom spreadsheet is now available in my course, Streaming Media 101: Technical Onboarding for Streaming Media Professionals. I’ll be adding two similar analyses for HEVC (1080p30/8-bit, 4K/10bit) over the next couple of weeks. While the numbers are different, the overall findings are similar. The bottom line is that if your typical video gets over 500 or 1,000 views, it almost certainly makes sense to use the highest possible quality preset to get the bandwidth as low as possible.

I will say that your results for the different presets will vary with your test files and encoding and distribution costs, and you should definitely run your own tests. But if you follow this methodology and analysis, I’d be surprised if your results are meaningfully different.

Finally, anytime you post a blog with this many numbers, there’s a decent chance that there’s an error or two. If you spot one, or what you think is one, please drop me a line at [email protected] and let me know.

About Jan Ozer

Avatar photo
I help companies train new technical hires in streaming media-related positions; I also help companies optimize their codec selections and encoding stacks and evaluate new encoders and codecs. I am a contributing editor to Streaming Media Magazine, writing about codecs and encoding tools. I have written multiple authoritative books on video encoding, including Video Encoding by the Numbers: Eliminate the Guesswork from your Streaming Video (https://amzn.to/3kV6R1j) and Learn to Produce Video with FFmpeg: In Thirty Minutes or Less (https://amzn.to/3ZJih7e). I have multiple courses relating to streaming media production, all available at https://bit.ly/slc_courses. I currently work as www.netint.com as a Senior Director in Marketing.

Check Also

Steve Strong Details Norsk's Suitability for Broadcasters

Norsk for Broadcasters: Interview with id3as’ Steve Strong

Recently, I spoke with Steve Strong, id3as’ co-founder and director, about Norsk’s suitability for broadcasters. …

Five star review for video quality metrics course.

New Five Star Review for Video Quality Metrics Course

The Computing and Using Video Quality Metrics course teaches encoding pro to compute and use video metrics like VMAF, PSNR, and SSIM.

Figure shows the different components to live streaming latency.

The Quality Cost of Low-Latency Transcoding

While low-latency transcoding sounds desirable, low-latency transcode settings can reduce quality and may not noticeably …

Leave a Reply

Your email address will not be published. Required fields are marked *