x264 vs x265 at high bitrates, 1080p bluray, my results

Post your testing results with HandBrake.
Post Reply
YaBoyShredderson
Posts: 48
Joined: Fri May 29, 2020 5:17 pm

x264 vs x265 at high bitrates, 1080p bluray, my results

Post by YaBoyShredderson »

I wanted to compress my bluray rips, but didnt know what codec to use, or what settings to use in general. So i ran a few tests. Im in no way a scientist, and the opposite of an expert when it comes to video encoding, but i think some people may benefit from my tests.

The cpu i am using is a ryzen 5 2600 running at stock speeds, and i have 16gb cl16 3200mhz ddr4 ram. This is so you can adjust some of the results for your own system, to get a better idea of how it may perform. Just a guideline, it wont scale perfectly.

My goals when encoding were to save some space, while producing a video that was (practically) indistinguishable to the source, with some quality buffer, just in case my viewing conditions change (larger tv, closer seating etc). If your goals are different, these results may not apply to you.

I tested the files by doing the following. I chose some movies or episodes at random, and then used mkvtoolnix to split them up, into many different 100mb chunks, removing audio tracks to remove that as a variable. I selected 5 clips per movie/show at random, and encoded them with 2 different configurations in handbrake, and then compared them.

X264 settings were high profile, level 4.1, rf 18, veryslow, and ssim tune (just for testing, would use film for an actual encode), and x265 was main profile, auto level, same rf of 18 and ssim tune, with the slow speed.

I measured 3 variables, size relative to source, speed of encode in fps, and quality with ssim (more on quality later) and then averaged them for each config.

Results:
X264
34.37% of source
SSIM value of 0.982
Speed of 17.83 fps

X265
29.06% of source
SSIM value of 0.980
Speed of 7.55 fps

So as you can see, at high bitrates, aiming for a transparent encode, x265 saves only about 15% space, while taking more than twice as long to encode, which may or may not be worth it depending on your processor, but for me it isnt.

X264 also (acording to a computer) produces ever so slightly higher quality files, but in practice, both were essentialy identical, not only to each other, but to the source as well. At these kinds of bitrates, the smoothing/blurring x265 tend to cause at lower bitrates goes away, and the artifacting of x264 also isnt present. This is obviously expected at high bitrates.

Any other points? I dont intend to do anymore tests, as i said, im not a scientist, and this testing was done purely for my own needs. Just thought i would share my results, on the off chance someone would benefit, or had any input or questions.
mduell
Veteran User
Posts: 7194
Joined: Sat Apr 21, 2007 8:54 pm

Re: x264 vs x265 at high bitrates, 1080p bluray, my results

Post by mduell »

Lower bitrate for lower SSIM, no surprise there. Could take a 15% bitrate jump to match the SSIM values.

You need to keep one thing constant between your comparisons, either SSIM (my preference) or bitrate (makes sense for some situations).

edit: Just realized you're doing a 3 variable comparison, with encoding speed, not just 2 variables. So you've re-discovered that faster encoding needs higher bitrates. No surprises there. You can't vary more than 1 thing for a real comparison. Get the x265 speed up to match x264 and get the SSIM values to match, then see where the bitrates fall.
YaBoyShredderson
Posts: 48
Joined: Fri May 29, 2020 5:17 pm

Re: x264 vs x265 at high bitrates, 1080p bluray, my results

Post by YaBoyShredderson »

mduell wrote: Tue Jun 09, 2020 3:28 pm Lower bitrate for lower SSIM, no surprise there. Could take a 15% bitrate jump to match the SSIM values.

You need to keep one thing constant between your comparisons, either SSIM (my preference) or bitrate (makes sense for some situations).

edit: Just realized you're doing a 3 variable comparison, with encoding speed, not just 2 variables. So you've re-discovered that faster encoding needs higher bitrates. No surprises there. You can't vary more than 1 thing for a real comparison. Get the x265 speed up to match x264 and get the SSIM values to match, then see where the bitrates fall.
I wasnt doung different encodes trying to match each variable. I thinl variable is the wrong the word, the variable that i was testing was between 2 custom presets i had landed on, while trying to find good settings. What i called variables, speed, ssim and size, were points of measurement. My bad.
rollin_eng
Veteran User
Posts: 3527
Joined: Wed May 04, 2011 11:06 pm

Re: x264 vs x265 at high bitrates, 1080p bluray, my results

Post by rollin_eng »

I would say you need to run a larger test sample.

0.5 GB of a 30 GB Blu-Ray is only 1.6%, for a 2 hour movie thats 2 minutes.

In some ways you might WANT to pick the clips because you know clip 1 is lots of action, clip 2 is just 2 people talking etc.
YaBoyShredderson
Posts: 48
Joined: Fri May 29, 2020 5:17 pm

Re: x264 vs x265 at high bitrates, 1080p bluray, my results

Post by YaBoyShredderson »

rollin_eng wrote: Tue Jun 09, 2020 6:18 pm I would say you need to run a larger test sample.

0.5 GB of a 30 GB Blu-Ray is only 1.6%, for a 2 hour movie thats 2 minutes.

In some ways you might WANT to pick the clips because you know clip 1 is lots of action, clip 2 is just 2 people talking etc.
I chose 5 clips per movie and per show, 10 in total, so about 5 gb, still not the biggest test i know, but the material was very varied.
mduell
Veteran User
Posts: 7194
Joined: Sat Apr 21, 2007 8:54 pm

Re: x264 vs x265 at high bitrates, 1080p bluray, my results

Post by mduell »

YaBoyShredderson wrote: Tue Jun 09, 2020 5:14 pm
mduell wrote: Tue Jun 09, 2020 3:28 pm Lower bitrate for lower SSIM, no surprise there. Could take a 15% bitrate jump to match the SSIM values.

You need to keep one thing constant between your comparisons, either SSIM (my preference) or bitrate (makes sense for some situations).

edit: Just realized you're doing a 3 variable comparison, with encoding speed, not just 2 variables. So you've re-discovered that faster encoding needs higher bitrates. No surprises there. You can't vary more than 1 thing for a real comparison. Get the x265 speed up to match x264 and get the SSIM values to match, then see where the bitrates fall.
I wasnt doung different encodes trying to match each variable. I thinl variable is the wrong the word, the variable that i was testing was between 2 custom presets i had landed on, while trying to find good settings. What i called variables, speed, ssim and size, were points of measurement. My bad.
You did 2 tests with a total of 4 different variables (encoder, encoding speed, bitrate, and SSIM). That's not nearly enough test coverage to make any conclusion. Your tests should be constrained to 1 independent variable at a time, with everything else held constant.
At the same speed and same SSIM, x264 could easily end up with the lower bitrate.
YaBoyShredderson
Posts: 48
Joined: Fri May 29, 2020 5:17 pm

Re: x264 vs x265 at high bitrates, 1080p bluray, my results

Post by YaBoyShredderson »

[/quote]

You did 2 tests with a total of 4 different variables (encoder, encoding speed, bitrate, and SSIM). That's not nearly enough test coverage to make any conclusion. Your tests should be constrained to 1 independent variable at a time, with everything else held constant.
At the same speed and same SSIM, x264 could easily end up with the lower bitrate.
[/quote]

I havent deleted any of of the clips so i could run another test what. Would do u think i should do?

Does this test not show that at the same quality x265 only saves 15% space while taking more than twice as long to encode? What do u think it should show.

I say same quality as a difference in ssim of 0.002 seems like margin of error to me, and to my eyes both files were identical to each other, as well as the source.

When doing this test, i was trying to keep quality identical between the 2 encoding settings. My goal is to keep the encodes transparent.
mduell
Veteran User
Posts: 7194
Joined: Sat Apr 21, 2007 8:54 pm

Re: x264 vs x265 at high bitrates, 1080p bluray, my results

Post by mduell »

I think you should adjust the x265 preset to get closer to the speed fo x264.
I think you should adjust the x264 or x265 RF target to get matching SSIM values, or have x265 slightly higher if you want to demonstrate superiority. 0.002 is quite a bit difference when the entire relevant range of SSIM values for high quality encodes is only about 0.05 (0.95 to 1.00).

With those two factors closer to equal, you'll find your 15% improvement wanes.
Post Reply