View Full Version : Size CRF 20 vs 17
jriker1
26th July 2023, 16:26
I have some footage that I converted with x265 to HEVC. Video is 1 hour 51 minutes. Had some weird output so was curious of thoughts. It's from 1986 but remastered blueray.
If I use CRF 20 I get a size of 15gb
If I use CRF 17 I get a size of 27gb
Is this normal between those two CRF values? Both using slow for the preset.
Boulder
26th July 2023, 16:30
The filesize is not linear between different CRF values, if that's what you mean. There's no way of telling which size the encode will hit (and a lower value for CRF means a bigger final size for the same material).
jriker1
26th July 2023, 16:34
Thanks yeah figured as much but 12Gb more for 3 notches down in CRF seemed like a lot. Almost double the size. Wasn't sure if that should mean something to me. Like is CRF 20 starving the encoder and is not really a great quality. I can share if I take the same footage and run it thru NeatVideo first CRF 20 comes out to about 5GB in final output. So obviously there is grain. Though don't want to do that since it's 4k HDR10 and Dolby Vision content so rather not touch the source any more than I need to.
Asmodian
26th July 2023, 16:46
That sounds normal to me, 3 full steps on CRF is a lot. You can use decimal values like 17.25 too.
microchip8
26th July 2023, 18:06
I encode at CRF of 24 and quality is just fine for me. But I've tweaked x265 the hell out of it :)
jriker1
26th July 2023, 20:52
Thanks. This is where I'm at right now if you have any expert suggestions:
ffmpeg -i <input>.mkv -sn -an -f yuv4mpegpipe -strict -1 -pix_fmt yuv420p10le - | x265-10b - --input-depth 10 --output-depth 10 --y4m --preset slow --hdr10 --hdr10-opt --high-tier --repeat-headers --crf 20 --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(40000000,50)" --max-cll "1000,401" --chromaloc 2 --no-sao --range limited --keyint 24 --colormatrix bt2020nc --colorprim bt2020 --transfer smpte2084 --dolby-vision-rpu rpu_81.bin --dolby-vision-profile 8.1 --vbv-bufsize 160000 --vbv-maxrate 160000 <destination>.hevc
excellentswordfight
26th July 2023, 21:12
Thanks. This is where I'm at right now if you have any expert suggestions:
[CODE]…
Looks good to me, a very reasonable and sensible starting point for x265 (for uhd hdr), imo a lot of the tuning that would go beyond that would be more content specific dependant. I always increase the lookahead a bit from the default though as it pretty much only increase ram usage and is not a speed penalty as ive seen using a 2-4s lookahead have improved both frame type decision and rate controll.
And yes, those results are expected and normal, especially as it is a 1980s titel which i assume has some or a lot of grain. When going down towards 15-16 visually lossless encoding is starting to be achieved and when there is a lot of grain its gonna shot the bitrate up by a huge margin compared to clean sources.
I re-encode a bit with similair settings, and i like to stay below about 30Mbps (if i dont at least half the size i dont see much point in doing it its done for file size reasons), and I go down to 15 for easy to compress stuff, and up to 19 in the higher end. Going beyond that the grain just starting to move to far away from source for my liking. This is at the default psy settings for ’slow’ mind you, and as those are imo one the first things that you might wanna look at, together with aq (altough i think the default mode 2 is the safest bet for hdr), for tuning, and those will affect bitrate@given crf value a lot.
jriker1
26th July 2023, 22:50
Thanks for look ahead are we talking:
--rc-lookahead
Curious as that doesn't look like in seconds and defaults to 20 I think.
Also is aq-mode defaulting to 2? Didn't seem to show in the documentation. Is it fair to say use 2 for HD content and 3 for SD?
RanmaCanada
26th July 2023, 23:19
From 1986 means it probably has a lot of grain. Remember, the original Alien when encoded to x265 at certain crf becomes larger than the actual files on the bluray due to the amount of "noise".
jriker1
27th July 2023, 00:25
From 1986 means it probably has a lot of grain. Remember, the original Alien when encoded to x265 at certain crf becomes larger than the actual files on the bluray due to the amount of "noise".
Yeah it's the remastered Top Gun Blueray. Should be fairly clean you would think but running it thru NeatVideo and then doing the same ffmpeg encoding came out with a 5GB file so thinking that's the case. Just would never take an HDR10 / Dolby Vision file and run thru NeatVideo for reals.
benwaggoner
27th July 2023, 02:42
With a lot of handwaving, CRF maps to QP, and six QP value steps correlate with doubling the actual quantization parameter. So I'd expect going down by 3 CRF to increase bitrate by around 40% and by 6 to roughly double.
There are all kinds of things under the hood that would change the ratio, like VBV rate control, noise reduction, perceptual optimizations like aq, pay, and psy-rdoq, and so on.
H.264 introduced the logarithmic QP value, which has better perceptual uniformity. Older codecs like MPEG-2 and VC-1 had a QP which was the actual quantization value than all the AC coefficients used in the divide-and-round-down quantization stage.
Boulder
27th July 2023, 06:40
Thanks. This is where I'm at right now if you have any expert suggestions:
ffmpeg -i <input>.mkv -sn -an -f yuv4mpegpipe -strict -1 -pix_fmt yuv420p10le - | x265-10b - --input-depth 10 --output-depth 10 --y4m --preset slow --hdr10 --hdr10-opt --high-tier --repeat-headers --crf 20 --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(40000000,50)" --max-cll "1000,401" --chromaloc 2 --no-sao --range limited --keyint 24 --colormatrix bt2020nc --colorprim bt2020 --transfer smpte2084 --dolby-vision-rpu rpu_81.bin --dolby-vision-profile 8.1 --vbv-bufsize 160000 --vbv-maxrate 160000 <destination>.hevc
If you are not encoding for physical media, definitely increase the keyint value. I use 480 so it's mostly 20 seconds, and in real life, the encoder will automatically find scene cuts inside the interval anyway.
I'd also suggest testing jpsdr's x265 build and enable automatic AQ mode selection with either --aq-auto 10 (for SDR) or --aq-auto 6 (for HDR). In addition to that, I also set --aq-strength-edge 0.75 --aq-bias-strength 0.7 --aq-bias-strength-edge 0.8 to tune the different modes. The bias strength is the important one as it tunes the "dark modes".
EDIT: --rskip 2 --rskip-edge-threshold 2 is a good one for anyone interested in retaining more details.
excellentswordfight
27th July 2023, 07:27
--rc-lookahead
Curious as that doesn't look like in seconds and defaults to 20 I think.
Yes, its set in frames, so if you encode 24p material 48 would be 2s. So its the same as for min-keyint and keyint, which are usually set at 1s and 10s intervals, altough I probably wouldnt go past 300f for keyint cause of playback/seeking reasons, especially now when streaming is starting to become such s common playback method even for home use (plex etc). For pc-playback its usually fine though.
Also is aq-mode defaulting to 2? Didn't seem to show in the documentation. Is it fair to say use 2 for HD content and 3 for SD?
I wouldnt say so, personally I use 1 for high quality sdr (regardless of res), 2 for all hdr, and 3 for low bitrate encodes and anime.
Yeah it's the remastered Top Gun Blueray. Should be fairly clean you would think
I have the normal 1080p bluray of top gun, and that is by no means a ”clean” source. Its not extreme mind you, but for sure grainy (In a good way imo, has that classic super 35 look).
benwaggoner
27th July 2023, 16:51
I wouldnt say so, personally I use 1 for high quality sdr (regardless of res), 2 for all hdr, and 3 for low bitrate encodes and anime.
Have you tried --aq-mode 4 for SDR? --aq-strength may need to be lowered a bit, but it has seemed the best, at least for 8-bit SDR.
jriker1
30th July 2023, 21:55
Have you tried --aq-mode 4 for SDR? --aq-strength may need to be lowered a bit, but it has seemed the best, at least for 8-bit SDR.
May not have specifically mentioned it outside my ffmpeg commands but I usually do 10-bit content but can try that when I do any 8-bit content. Think with the suggestion to use a value of 2 for aq-mode with HDR think it defaults to that at least with preset of slow.
benwaggoner
31st July 2023, 06:44
May not have specifically mentioned it outside my ffmpeg commands but I usually do 10-bit content but can try that when I do any 8-bit content. Think with the suggestion to use a value of 2 for aq-mode with HDR think it defaults to that at least with preset of slow.
And the utility of --aq-mode 3 goes down with 10-bit.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.