View Full Version : How to make my HEVC presets faster?
ShortKatz
28th August 2018, 12:38
Hi all, finally I am able to post my question. :-) My plan is to encode all my BluRay collection as HEVC using HandBrake, so I can stream it from my NAS to my AppleTV 4k. First I started with the slower preset, but encoding time was around 50 hours on my MacBook Pro. So I decided to go for the faster preset and add additional options to regain encoding quality. After that my encoding time was around 40 hours, which still was too slow. So I removed -amp and -rect from my additional options, which made encoding speed a bit better. Then I found out, I can improve encoding speed a lot, by setting min-cu-size to 16, but I read somewhere it will harm quality. Will it? I'm now down to 24 to 30 hours encoding time. Fine would be 12 to 17 hours. Now I need your help. Which additional encoding option(s) can I remove or change to improve encoding time without loosing the quality?
I have two preset:
1. For BluRays from old grainy movies (like my Bud Spencer BR collection):
CRF: 18
Preset: Faster
Tune: Grain
Additional Options: ref=5:rd=5:no-strong-intra-smoothing:limit-sao:rc-grain:no-open-gop:bframes=3:b-adapt=2:weightb:b-intra:analysis-reuse-level=10:analysis-reuse-mode=0:lookahead-slices=0:me=star:subme=5:early-skip:limit-modes:min-cu-size=16:qcomp=0.8
2. For newer live action movies without much grain (for example StarTrek movies):
CRF: 18
Preset: Faster
Tune: None
Additional Options: ref=5:rd=5:ssim-rd:rd-refine: psy-rd=0:no-strong-intra-smoothing:limit-sao:no-open-gop:bframes=3:b-adapt=2:weightb:b-intra:analysis-reuse-level=10:analysis-reuse-mode=0:lookahead-slices=0:me=star:subme=5:tskip:early-skip:aq-mode=3:limit-modes:min-cu-size=16:qcomp=0.8:ipratio=1.1:pbratio=1.0:qpstep=1
sneaker_ger
28th August 2018, 13:10
If preset "faster" is too slow for you try "veryfast", "superfast" and "ultrafast" next. You can't have your cake and eat it.
https://x265.readthedocs.io/en/default/presets.html (Only ultrafast uses min-cu-size 16.)
But maybe you should be looking into different options? Building a faster PC, using a different encoder (like x264 or a HEVC hardware encoder)? Buy a bigger HDD and not re-encode at all (calculate power costs of encoding 12 hours vs storage cost)?
excellentswordfight
28th August 2018, 16:30
If I were you I would compare those settings to x264 before going through a whole archive, in my experience when tuning for these speeds and the aim is not a very low bitrate, x264 is a far better option, imo x265 is not suitable for fast near lossless encoding. If x265 is going to be used for high quality re-encoding of sub 2160p material, accept the huge speed loss vs x264 for decent reduction in bitrate or use something else.
Faster presets and tune grain is imo not that great, slower presets and just using no-sao and or no-strong-intra-smoothing is sharper and has more detail retention and saves maybe 30% bitrate. But I guess that wont be fast enough for you, but with tune grain and those extra commands, your settings should almost be as slow as preset slow anyway.
Forteen88
28th August 2018, 16:40
Buy a bigger HDD and not re-encode at all (calculate power costs of encoding 12 hours vs storage cost)?True, like remuxing (not having trailers or "blooper"-videos included, but only having the main-movie in the MKV-file and use SRT-subtitles instead) saves some space. And you can reencode (which goes fast) the audio to AAC and mux it into that main-movie MKV.
RanmaCanada
28th August 2018, 17:21
The only way you're going to get faster encode times without harming quality, is to honestly, get a faster computer. Your Macbook Pro is just not up to snuff sadly. Honestly you would be better off to have your movies either in a remux, or even h264 format. HEVC is too much for your Macbook Pro to handle, and you will actually probably damage it from encoding your entire library as prolonged high temperatures will have potential serious detrimental effects to the unit. If you check the benchmarking thread, you will see that mobile chips just aren't anywhere near as fast as their desktop counterparts.
ShortKatz
29th August 2018, 08:04
Thanks for your answers. So the general answer of yours is, "buy a faster computer". Would love to! But I don't think this is the reason. I was initially lacking one information, sorry. Without any of my additional options, it is very fast. If I only use the ultrafast preset, encoding time is around 2 hours, and faster only is around 6 hours. Only with my added options (to regain quality) this is slow again. And my goal is to identify the option that is mostly slowing down encoding. Sure, I can test all of them, than I would know. But my hope was some x265 experienced people will know all the x265 command line options and can tell me.
Cary Knoop
29th August 2018, 08:15
But my hope was some x265 experienced people will know all the x265 command line options and can tell me.
The option that slows things down is libx265 ;)
You might want to consider why you decided to use H.265 instead of H.264. Granted H.265 has more efficient compression technology (for very low to mid compression rates) than H.264 but it comes with an encoding time price.
MeteorRain
29th August 2018, 08:39
But my hope was some x265 experienced people will know all the x265 command line options and can tell me.
That's contradictory.
x265 experienced people will not try to encode bunch of bluray videos using such a slow device.
I've heard that VCB Studio sometimes test different parameters extensively. And they almost exclusively use dual Xeon E5v3 or better platforms, with more than couple hundreds of cores combined during the test. That's what I would call "x265 experienced people".
With that terrible preset you chose, I would just use x264 instead.
A second opinion: Pay less than 100 USD, get a used DELL Optiplex or other equivalents with Core i5 Gen 3 or 4 from ebay, and encode all your videos on that. Performance wise, an i5-3470 might be on par with your heavily thermal throttling Macbook Pro, and is so much cheaper than your precious MBP. Could save you a lot since your MBP could burn down soon.
sneaker_ger
29th August 2018, 11:15
Thanks for your answers. So the general answer of yours is, "buy a faster computer". Would love to! But I don't think this is the reason. I was initially lacking one information, sorry. Without any of my additional options, it is very fast. If I only use the ultrafast preset, encoding time is around 2 hours, and faster only is around 6 hours. Only with my added options (to regain quality) this is slow again. And my goal is to identify the option that is mostly slowing down encoding. Sure, I can test all of them, than I would know. But my hope was some x265 experienced people will know all the x265 command line options and can tell me.
Look, it doesn't make sense to just throw a bunch of different options manually at it if you have no idea what you are doing. The presets are balanced to give optimal compression for the cpu time you put in. Just stick to the presets and tunings, maybe make small corrections to aq/psy/sao/keyint as you see fit but don't use e.g. subme 5 (a preset placebo option!) on preset faster... In my first post I linked to the preset documentation. There's a table where you can see what each preset is exactly.
RanmaCanada
29th August 2018, 15:07
That's contradictory.
x265 experienced people will not try to encode bunch of bluray videos using such a slow device.
I've heard that VCB Studio sometimes test different parameters extensively. And they almost exclusively use dual Xeon E5v3 or better platforms, with more than couple hundreds of cores combined during the test. That's what I would call "x265 experienced people".
With that terrible preset you chose, I would just use x264 instead.
A second opinion: Pay less than 100 USD, get a used DELL Optiplex or other equivalents with Core i5 Gen 3 or 4 from ebay, and encode all your videos on that. Performance wise, an i5-3470 might be on par with your heavily thermal throttling Macbook Pro, and is so much cheaper than your precious MBP. Could save you a lot since your MBP could burn down soon.
I should I have been more clear, but MeteorRain hit the nail right on the head.
Asmodian
30th August 2018, 00:46
Without any of my additional options, it is very fast. If I only use the ultrafast preset, encoding time is around 2 hours, and faster only is around 6 hours.
I strongly repeat what excellentswordfight suggested. Test x264! It is MUCH faster and will likely produce higher quality at the same speed & bitrate unless you are targeting very low bitrates.
TomV
30th August 2018, 08:04
I don't speak for x265 anymore, but as the guy who determined those presets (and who now tunes Beamr 5), I'll try to help you.
First, stick with the settings in one of the presets unless you REALLY know what you're doing. If you want to test a different setting, you should run experiments varying one of the options to see the effect on speed and compression efficiency. You don't have to do a whole movie... one minute of video will be enough to understand the effect.
ref=5 and rd=5 don't make a lot of sense with the faster preset. They are both slowing you down. The quality difference between ref 3 and 5 is minimal. There is probably a bit more quality difference between rd 3 and 5, but overall it's also minimal (versus the speed penalty). If you wanted to go to ref=3 and rd=3 you will probably find speed similar to the medium preset. You are likely to a better speed/quality tradeoff by just using preset=fast or faster. Don't use a min CU size of 16.
alex1399
30th August 2018, 09:43
Hello, TomV. I'm a newbie here. There are some 16~25 fps video but sampled at 60 fps with lots of duplicated frame. Is there an option to increase the Reference Distance on video frame without being too time costly? The ME strikes hardly. The motion is easy to predict, very jitter, but lack of a suitable option for the constant frame rate encoding.
abaxas
31st August 2018, 11:42
Sadly you have to deal with the 'slowness' to gain the advantages the codec offers, especially as the efficiency of hevc grows with resolution.
As above, many of us buy a separate machine for encoding so it can be left 'doing it's thing' while we use our main machines. I use my old media player (an intel nuc with a i5-4250U) as my encoding box.
It's almost silent if I downclock a little and it uses about 25w from the wall when going full bore. Noting that as machines get more powerful inside the envelope of that cpu generation they also use more power per cycle, so are less efficient.
If I compare the power usage of the NUC (25w) to the most powerful machine I have available to me (i5 6600k at 4.5ghz). The nuc is about 33% the speed for almost 20% the power. Even if the i5 was stock his is about 40%/33%, despite the 6600k have a higher IPC and having a smaller 'transistor size'.
Another 'mad stat' is my current media player is a j5005 based nuc and even though that is a 'crappy atom', in terms of x265 output it almost 90% that of the above i5-4250U while only pulling about 20w from the wall at full bore. It's amazing to think the lowest end is not almost the same as the 2nd top end U processor from a few years ago.
Hence, I'd recommend buying a 2nd computer, using a really slow preset (not placebo) and adjusting a few settings for max output quality in a given bitrate/crf while sacrificing speed. You simply set your encode going then come back in a couple of days time.
Also, never forgot the mental advantage of knowing it's the best you could have got so you have less "it's lossy so what did I lose" anxiety.
Boulder
31st August 2018, 16:51
My normal PC (Ryzen 1800X based) runs encodes almost all the time with the veryslow preset as the base. I have a batch file that I populate with stuff and launch it with below normal priority so it will not affect normal use at all. The only thing is that I could really use 32 GB of RAM instead of just 16 GB.
benwaggoner
31st August 2018, 21:38
I feel compelled to point out that if you have a several-generations old CPU, upgrading could pay for itself just on the power savings in joules per pixel. Compared to five years ago, a good consumer CPU has more cores, a lot better instructions/clock, and better SIMD, without an increase required wattage. If running encoding 24/7, a newer system can actually pay for itself.
ShortKatz
2nd September 2018, 17:46
ref=5 and rd=5 don't make a lot of sense with the faster preset. They are both slowing you down. The quality difference between ref 3 and 5 is minimal. There is probably a bit more quality difference between rd 3 and 5, but overall it's also minimal (versus the speed penalty). If you wanted to go to ref=3 and rd=3 you will probably find speed similar to the medium preset. You are likely to a better speed/quality tradeoff by just using preset=fast or faster. Don't use a min CU size of 16.
OK, I will remove all this. For now I decided to stick with the medium preset. Is has rd/ref 3 and is just a bit slower than my initial setting.
As above, many of us buy a separate machine for encoding so it can be left 'doing it's thing' while we use our main machines. I use my old media player (an intel nuc with a i5-4250U) as my encoding box.
I was thinking of that, but I would like a machine that supports AVX-512 then. And the only Macs (I'm not a PC person) that supports this currently is the iMac Pro and the Mac Pro, which are both way to expensive for me. And to be honest, my movie library is not that big. I only need to convert less than 10 movies (for now).
Hence, I'd recommend buying a 2nd computer, using a really slow preset (not placebo) and adjusting a few settings for max output quality in a given bitrate/crf while sacrificing speed. You simply set your encode going then come back in a couple of days time.
Also, never forgot the mental advantage of knowing it's the best you could have got so you have less "it's lossy so what did I lose" anxiety.
I know what you mean. But in my comparison between the medium preset and the slow/slower presets, I could not tell a difference in quality by eye (maybe one can measure it).
RanmaCanada
2nd September 2018, 21:12
Do you have any friends that have a PC then? Because honestly, as other people and myself have pointed out, converting on a laptop is not exactly the most efficient or safest way to do things. Especially one as old as yours. It might be time to consider moving to the "dark side" if just to have an encode box. If you're going to be encoding your own movies, you're going to need somewhere to store them. Why not build an UNRAID server with modern hardware that can also run an unbuntu or MAC VM where you can encode with that more modern hardware? You can do it for a lot less than paying the Mac tax. There are quite a few tutorials and guides on how to do it. One just has to use the googles or search the unraid forums.
ShortKatz
3rd September 2018, 15:29
Especially one as old as yours.
Mine isn't old. It is an MacBook Pro 15-inch, Late 2016 with 2.6 GHz Intel Core i7.
If you're going to be encoding your own movies, you're going to need somewhere to store them. Why not build an UNRAID server with modern hardware that can also run an unbuntu or MAC VM where you can encode with that more modern hardware?
Oh, wait a minute. I want to store the movies on my Synology NAS which runs a sort of Linux. Can this NAS be used to run HandBrake and encode my movies to HEVC?
RanmaCanada
3rd September 2018, 17:25
Your processor is still woefully underpowered i7 6200U. It scores 4800 passmark. 4800. It's too underpowered for the task at hand. You seriously need a desktop processor for what you are going to be doing. Even an old 4790k is almost 2.5x as powerful as your shiny expensive mac. And no your Synology probably won't be able to run handbrake and encode movies. I would seriously look into building an encode box if you want to continue this. I am not the only one telling you this.
Asmodian
3rd September 2018, 21:45
Bah, <10 movies will be fine. ShortKatz could easily finish this year. :p
abaxas
4th September 2018, 11:02
I know what you mean. But in my comparison between the medium preset and the slow/slower presets, I could not tell a difference in quality by eye (maybe one can measure it).
The best way to test this is with a high crf (eg 33), you'll notice a huge difference between medium > veryslow.
I guess the difference is harder to spot if a video is 'bitrate flooded' but why not, at least, have the knowledge the final file is as best as you could get inside a rough target bitrate/crf.
MeteorRain
14th September 2018, 06:12
Mine isn't old. It is an MacBook Pro 15-inch, Late 2016 with 2.6 GHz Intel Core i7.
Just want to remind you that it's a Core i7 laptop chip.
It's not as good as a real Core i7 desktop. Suppose you have a 6700HQ, with a passmark score of 8137, a desktop 6700 has a score of 10008.
And if you take a look at new products this year, i7-9700k and r7-2700 all have 8 cores and will easily crush the benchmark scores.
Again, it's up to you to accept our advice or not. Just that we won't recommend any laptop to do this kind of heavy-lifting.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.