Is there room for Handbrake to speed up x265 encoding ?

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
Hanbrakeur
Posts: 75
Joined: Mon Jun 30, 2014 10:39 pm

Is there room for Handbrake to speed up x265 encoding ?

Post by Hanbrakeur »

Hello,

Is there room for speeding up x265 encoding (for example by coding more parts in assembly or making an hybrid software/hardware encoder without loss of quality) ?

My PC is :
- OS : Windows 7 Pro SP1
- Processor : i7-3770@3.4Ghz overclocked to 4.6Ghz
- RAM : 32GB
- Graphics Card : AMD RX 580

Handbrake version : 1.2.2 (2019022300)

My current encoding settings are :
- Video Codec : H265 (x265)
- Framerate : 50 fps cfr
- Bitrate : 2000 kbs (2-pass, turbo 1st pass)
- Preset : Medium

Encoding a 1080p video with these seetings is VERY SLOW (roughly a 1-hour video takes 5h30 to encode) but I can bear it, I just leave my PC on overnight, and the quality is awesome. But it would be cool if it were faster :wink:

Thanks.

akyhne
Posts: 26
Joined: Sat Feb 08, 2020 1:02 am

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by akyhne »

The software should already be using 100% CPU, so no.

If you want to use both hardware and software, you'd need to use several video encoding software - one that uses your GPU and one that uses the CPU.
Quality would be different and it doesn't sound like that's what you want.

mduell
Veteran User
Posts: 6926
Joined: Sat Apr 21, 2007 8:54 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by mduell »

Pastebin your encoding log so we can see what's actually going on. Users are not great at describing it, historically.

Yes, there's room for x265 optimizations with more assembly.
Also a newer CPU supporting AVX2 and AVX512 will help.
Also picking a faster preset will help.
Also using quality-based encoding with 1 pass will help.
No, the hardware encoders are garbage, and will not help.

musicvid
Veteran User
Posts: 3449
Joined: Sat Jun 27, 2009 1:19 am

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by musicvid »

But it would be cool if it were faster :wink:
When x265 was first being prototyped, a two hour video took a couple of months to finish encoding. That's not an exaggeration.

It's software /hardware evolvment, not one or the other. What we have today is worth counting our blessings.

rollin_eng
Veteran User
Posts: 3293
Joined: Wed May 04, 2011 11:06 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by rollin_eng »

Could you please post your HB logs, instructions can be found here:

https://handbrake.fr/docs/en/latest/hel ... y-log.html

Hanbrakeur
Posts: 75
Joined: Mon Jun 30, 2014 10:39 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by Hanbrakeur »

@Mduell/@Rollin : Thanks for your replies but I wasn't complaining about the slowness of my encodings in particular but the slowness of x265 encoding in general. I know that what makes mine very slow is the fact that I encode 50FPS at 2000kbs/2-PASS with Medium preset but I don't want to change any of these parameters because I need control on the bitrate (2000kbs), its allocation (2-Pass), a smooth video (50fps), and beautiful (1080p Medium preset). That's why I didn't post my logs.

@Musicvid : WOW I didn't know that so much progress was done on x265 through the years ! Now I am very optimistic on the future :P

rollin_eng
Veteran User
Posts: 3293
Joined: Wed May 04, 2011 11:06 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by rollin_eng »

If you post your logs we might be able to help you speed up your encodes TODAY!

Hanbrakeur
Posts: 75
Joined: Mon Jun 30, 2014 10:39 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by Hanbrakeur »

rollin_eng wrote:
Fri Feb 14, 2020 2:03 pm
If you post your logs we might be able to help you speed up your encodes TODAY!
Ok, thanks for your help :wink:

Here the log : https://pastebin.com/iACiUXqy
MediaInfo of the Source : https://pastebin.com/VyJmEGpv
MediaInfo of the Destination : https://pastebin.com/JaBF4kta

Summary Tab : https://i.ibb.co/r3QXQ2K/SS-14-02-2020-15-27-58-s.jpg
Dimmensions Tab : https://i.ibb.co/WgsT2RK/SS-14-02-2020-15-16-49.jpg
Filters Tab : https://i.ibb.co/DkR3Bwp/SS-14-02-2020-15-16-52.jpg
Video Tab : https://i.ibb.co/jfr2rXq/SS-14-02-2020-15-16-55.jpg
Audio Tab : https://i.ibb.co/d452CR5/SS-14-02-2020-15-28-05-a.jpg

mduell
Veteran User
Posts: 6926
Joined: Sat Apr 21, 2007 8:54 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by mduell »

Given the resolution of your video and your bitrate target, I can't see how x265 makes any sense here. x265 advantages are for very large frame sizes (4K+) and/or very low bitrate targets, neither of which apply to you. Switch to x264 and enjoy the speed with about the same encoding efficiency (quality for size).

Hanbrakeur
Posts: 75
Joined: Mon Jun 30, 2014 10:39 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by Hanbrakeur »

After many tests, I was more satisfied with the visual quality of x265 than x264. Don't you think that 2000kbs is a low bitrate for 1080p@50fps ?

rollin_eng
Veteran User
Posts: 3293
Joined: Wed May 04, 2011 11:06 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by rollin_eng »

Hanbrakeur wrote:
Fri Feb 14, 2020 5:10 pm
Don't you think that 2000kbs is a low bitrate for 1080p@50fps ?
Depends on the content, thats why a quality setting is recomended.

mduell
Veteran User
Posts: 6926
Joined: Sat Apr 21, 2007 8:54 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by mduell »

Hanbrakeur wrote:
Fri Feb 14, 2020 5:10 pm
After many tests, I was more satisfied with the visual quality of x265 than x264. Don't you think that 2000kbs is a low bitrate for 1080p@50fps ?
No, not in the realm of where x265 shows advantages over x264 that make the speed penalty worthwhile.

musicvid
Veteran User
Posts: 3449
Joined: Sat Jun 27, 2009 1:19 am

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by musicvid »

I don't want to change any of these parameters because I need control on the bitrate (2000kbs), its allocation (2-Pass), a smooth video (50fps), and beautiful (1080p Medium preset).
Why are such minimal bitrates needed, and why a need for such tight control? Not even Youtube is that stingy, or is it really an experiment?

I agree with mduell that I would reserve x265 for 4k content, and then not always.

Hanbrakeur
Posts: 75
Joined: Mon Jun 30, 2014 10:39 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by Hanbrakeur »

Thanks for your suggestions guys but I knew that you would reproach me with using x265, that's why I didn't want to go into details :? My question was about x265 encoding speed, not wether I should use x264 or x265 :wink: I'm very happy with x265, I just find it slow. @musicvid : I use low bitrates because of HD space (I batch encode a lot of vids). I use AvgBitrate rather than CRF to have a total control on the final file size rather than having "random" sizes with CRF. After a lot of encodings, I found that 2000kbs x265 was the overall best compromise between low filesize and quality @1080p50 even though I understand that other people may find x264 a better choice.

wtfiwinomgs@yahoo.ca
Posts: 9
Joined: Sun Feb 02, 2020 7:16 am

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by wtfiwinomgs@yahoo.ca »

mduell wrote:
Fri Feb 14, 2020 2:03 am
Pastebin your encoding log so we can see what's actually going on. Users are not great at describing it, historically.

Yes, there's room for x265 optimizations with more assembly.
Also a newer CPU supporting AVX2 and AVX512 will help.
Also picking a faster preset will help.
Also using quality-based encoding with 1 pass will help.
No, the hardware encoders are garbage, and will not help.
wait, are you saying handbrake can take advantage of new instruction avx512? thats crazy good!

musicvid
Veteran User
Posts: 3449
Joined: Sat Jun 27, 2009 1:19 am

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by musicvid »

@musicvid : I use low bitrates because of HD space (I batch encode a lot of vids).
Storage drives are currently $.05 per GB.
I found that 2000kbs x265 was the overall best compromise between low filesize and quality
Fixed bitrates are no indication of file size vs. quality whatsoever.

Hanbrakeur
Posts: 75
Joined: Mon Jun 30, 2014 10:39 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by Hanbrakeur »

I know that harddrives are cheap nowadays but the smaller the better, especially when you deal with hundreds of videos. With fixed bitrate I know exactly the filesize for a given bitrate. You are right to say that I have no guaranty on the video quality because it depends on the kind of contents, that's why I made several tests and found that it was a global good settings for the type of video that I encode.

rollin_eng
Veteran User
Posts: 3293
Joined: Wed May 04, 2011 11:06 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by rollin_eng »

You do whatever works for you, but...

Why is smaller better? And if you use a quality based encode your encodes will probably be faster and you can always lower the quality if you feel your videos are too big.

Hanbrakeur
Posts: 75
Joined: Mon Jun 30, 2014 10:39 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by Hanbrakeur »

I guess it's a difference of philosophy. Some people like to target a specific quality no matter the space it takes on the hard drive, I prefer to know exactly the space it will take because hd space is not infinite :wink:

rollin_eng
Veteran User
Posts: 3293
Joined: Wed May 04, 2011 11:06 pm

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by rollin_eng »

By using CQ you can actually save space.

If the encoder doesn’t need a lot of bits it won’t use them.

And while HD space is not free neither is the electricity needed to encode your videos :)

nhyone
Bright Spark User
Posts: 249
Joined: Fri Jul 24, 2015 4:13 am

Re: Is there room for Handbrake to speed up x265 encoding ?

Post by nhyone »

Hanbrakeur wrote:
Sat Feb 15, 2020 12:50 pm
I guess it's a difference of philosophy. Some people like to target a specific quality no matter the space it takes on the hard drive, I prefer to know exactly the space it will take because hd space is not infinite :wink:
From the log that you provided:

Code: Select all

x265 [info]: frame I:    317, Avg QP:20.90  kb/s: 27175.30
x265 [info]: frame P:  38760, Avg QP:24.61  kb/s: 5866.48
x265 [info]: frame B: 113878, Avg QP:31.36  kb/s: 615.11
x265 [info]: Weighted P-Frames: Y:3.7% UV:2.6%
...
encoded 152955 frames in 6614.41s (23.12 fps), 2000.89 kb/s, Avg QP:29.63
This corresponds roughly to CRF 25, I think. If you find this quality to be good enough, you can use this CRF for all future video and get the same quality.

For 1080p to reach 2 Mbps at CRF ~25, even for x265, the video must be pretty compressible.

(Of course, to get a good idea on CRF to use, it's best to use a few videos. But usually it is around 18 to 22.)

Post Reply