Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
18th October 2021, 11:08 | #1 | Link |
Moderator
Join Date: Feb 2002
Posts: 643
|
Bitrate-capped CRF
Hi - so we encode HEVC videos with x265 in Handbrake. Typically 4K at CRF20 on the 'fast' preset (though interestingly, I'm finding that CRF20 HEVC on fast is delivering lower quality than CRF20 h.264 on fast)
It seems that there are very limited scenarios where straight CRF can cause bitrate spikes up to 500Mbps, which is causing problem on target hardware (TV decoders, basically). This is probably a very simple question - but what command line options should I put into the 'extra options' box on Handbrake to limit bitrate to 100Mbps max? |
18th October 2021, 12:44 | #2 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,733
|
The VBV settings should help you with that.
https://x265.readthedocs.io/en/maste...on-vbv-bufsize EDIT: and the CRF values are not comparable between the two encoders, you need to do a 2-pass VBR encode for a fair comparison.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... Last edited by Boulder; 18th October 2021 at 12:51. |
18th October 2021, 18:39 | #3 | Link |
Moderator
Join Date: Feb 2002
Posts: 643
|
In general, with CRF encoding, I'm not sure I'm seeing any quality advantage with HEVC in terms of like-for-like bitrate vs h.264, which is surprising me. Only if I move the encoder to the 'slow' preset do I see the quality, and 4K encoding at 6fps on a 5950X isn't viable :/
Using vbv-bufsize=100000:vbv-maxrate=100000 which looks like it does the trick in Handbrake, thanks for the assist. |
19th October 2021, 05:38 | #4 | Link | |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,733
|
Quote:
Oh, and --no-sao in every encode or x265 will just Smooth All Objects
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
|
19th October 2021, 10:24 | #6 | Link | ||
Lost my old account :(
Join Date: Jul 2017
Posts: 326
|
Quote:
Turning of SAO (i.e. no-sao) can and will be beneficial in a broad amount of scenarios with very little drawbacks. There are still some cases that do benefit of SAO, I use it for some animation/content with a lot of flat areas, and highly compressed encodes. Quote:
|
||
19th October 2021, 11:47 | #8 | Link |
Registered User
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
|
Yes, 2-pass and CRF are very similar if the files end up the same size. The limitations of the various presets affect them in the same ways.
__________________
madVR options explained |
20th October 2021, 18:39 | #10 | Link | |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,771
|
Quote:
Encoding time is quite a bit longer, although x265 takes better advantage of lots of cores and AVX2 than x264 does, so the perf gap can really depend on your hardware. But even at equivalent encoding times, x265 will still be better by x264 by a good chunk. Very grainy sources have less of a gap and require a little more tuning in x265. But don't assume you can just reuse --crf or other settings from x264 in x265. There is different tuning, and depending on settings, x265 can get away with a higher CRF a lot of the time. |
|
21st October 2021, 22:42 | #11 | Link |
Registered User
Join Date: Jan 2010
Location: France
Posts: 851
|
Thanks !
Could you give me a good basis to start ? A x265 command line to encode a 1080p FHD BD and a x265 command line to encode a 4K UHD BD ? I was starting to look at x265 in the past but some events took all my time and now I would like to start with x265. Thanks ! |
22nd October 2021, 07:11 | #12 | Link | |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,771
|
Quote:
|
|
22nd October 2021, 09:35 | #13 | Link |
Registered User
Join Date: Jan 2010
Location: France
Posts: 851
|
I would keep a good quality, currently I use x264 preset slower CRF 18 but slower is very very slow with x265 (using Ryzen 7 3700X) so perhaps preset slow only.
I would like to store my BD FHD and UHD as a MKV with a reduced size but keep quality. Thanks ! |
22nd October 2021, 17:56 | #14 | Link | |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,771
|
Quote:
Of course, going to UHD is ~4x slower, or ~5x slower if you're going from 8-bit to 10-bit. As 4K Blu-ray is already HEVC, the potential file size reduction without quality loss may be less than you expect. Given how cheap HDs are these days, it's generally cheaper to just buy more storage than to reencode. $/TB has dropped below $20, which means cost to store a full BD-50 image is <$1 now. And few titles use close to that much for the actual main title. ...and thinking back to when I paid $5000 for a 4 GB RAID, and couldn't believe how cheap that was. |
|
22nd October 2021, 18:09 | #15 | Link | |
Lost my old account :(
Join Date: Jul 2017
Posts: 326
|
Quote:
1080p24 SDR: Code:
--preset slow --profile main10 --level-idc 41 --crf 18 --keyint 240 --min-keyint 24 --rc-lookahead 48 --no-sao --deblock -1:-1 Code:
--colorprim bt709 --transfer bt709 --colormatrix bt709 --range limited Code:
--preset slow --profile main10 --level-idc 51 --crf 18 --keyint 240 --min-keyint 24 --rc-lookahead 48 --no-sao --deblock -1:-1 --hdr-opt Code:
--colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --max-cll "1000,400" --master-display"G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)" Not everyone is into specifying the level (i.e. --level-idc 41), but by doing so you are enforcing the vbv limits compliant to that level (i.e. the subject of this thread). And by doing so your encodes are much less prone to bitrate spikes that can cause playback issues down the line (network playback or some hw-playbackdevice etc). High tier for 4.1 and 5.1 is high enough either way to not interfere with encode quality that much. There are ofc a lot of other tweaks that can be done, you will find command lines here that has a lot of amazing tuning. But do note that a lot of them might not be fire and forget parameters and might need title per title tuning. I find that most of the generic type settings are included in the presets, and when you tune speed/compression you can follow the settings in the presets. Last edited by excellentswordfight; 22nd October 2021 at 18:29. |
|
23rd October 2021, 09:55 | #16 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,733
|
That combination is a very solid starting point for any encode. I'd like to add --rskip 2, possibly also --rskip-edge-threshold 2. At least use rskip mode 2, it seems to help reduce the amount of "onion artifacts".
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
24th October 2021, 00:19 | #17 | Link |
Registered User
Join Date: Jan 2010
Location: France
Posts: 851
|
Thanks all
I'll look at it, perhaps I'll make remux only then I'll encode, I don't know. I will look at quality, speed and size after an encode. If you have some others advices about parameters or recommended tweaks I'm interested. Thanks ! |
6th November 2021, 19:14 | #19 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,733
|
If you have a recent enough NVidia graphics card, DGIndexNV/DGSource is the recommended combination. It's frame accurate and a very stable and capable decoder for AVC and HEVC video. Avisynth is probably the easiest to set up. Otherwise it depends on whether you just decode and feed data to the encoder, or if you resize, filter etc.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
|
|