Log in

View Full Version : 2019 great x265 4k settings?


Pages : 1 [2]

Blue_MiSfit
24th September 2019, 22:13
I found that restricting CTU does improve speed a lot and can improve sharpness with lower resolution content... BUT this sharpness improvement was only visible when doing frame by frame comparison AND it came at the cost of more blocking in motion which was significantly more visible in ordinary viewing.

My tests are always done using single pass capped VBR set up for adaptive streaming, so take that with a grain of salt, but I found leaving CTU and merange alone gave me the best results. I found preset slow to be quite tolerable in all cases.

Boulder
25th September 2019, 06:01
I would definitely use CTU 64 at 1080p and above, also the new HME method to improve the search range with a smaller impact on performance. At 1080p or higher resolutions, CTU 64 should already cause enough work for the encoder to utilize the CPU much better than at 720p or lower so there should be no need to go to CTU 32.

redbtn
27th September 2019, 02:38
Thank you all for response.
I would definitely use CTU 64 at 1080p and above, also the new HME method to improve the search range with a smaller impact on performance. At 1080p or higher resolutions, CTU 64 should already cause enough work for the encoder to utilize the CPU much better than at 720p or lower so there should be no need to go to CTU 32.
What's your advice for 1080p? CTU 64, Merange 57 and HME umh, umh, star?
Or I need lower merange like 32 for compensate impact HME on speed? I still don't understand actually how HME works and better way to use it.

vpupkind
27th September 2019, 03:46
? I still don't understand actually how HME works and better way to use it.

You run motion estimation on 1/16th your resolution, scale the motion vector you found, and search around it on 1/4th resolution.
You then scale the motion vector from the 1/4th resolution, and search around it at full resolution.

Boulder
27th September 2019, 04:57
Thank you all for response.

What's your advice for 1080p? CTU 64, Merange 57 and HME umh, umh, star?
Or I need lower merange like 32 for compensate impact HME on speed? I still don't understand actually how HME works and better way to use it.

In my opinion, you can lower merange with HME because it will cause a much higher range to be searched anyway (as vpupkind described there).

Although I don't know which way it works -- from full to low resolution or the other way around.
This description, http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/AV0405/ZAMPOGLU/Hierarchicalestimation.html , shows level 0 as one with the full resolution.

Then the description of the patch has this information:

This patch does the following:
1) Perform level-0 ME
2) Use the MVs as predictor for next level ME
3) Restrict full-search within a range when HME is enabled

In these cases, it would be really nice to have a clear explanation in the docs :)

redbtn
27th September 2019, 10:57
In my opinion, you can lower merange with HME because it will cause a much higher range to be searched anyway (as vpupkind described there).



Although I don't know which way it works -- from full to low resolution or the other way around.

This description, http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/AV0405/ZAMPOGLU/Hierarchicalestimation.html , shows level 0 as one with the full resolution.



Then the description of the patch has this information:



This patch does the following:

1) Perform level-0 ME

2) Use the MVs as predictor for next level ME

3) Restrict full-search within a range when HME is enabled



In these cases, it would be really nice to have a clear explanation in the docs :)Yeah, there is not enough info in docs about it.
I'm worried about this http://forum.doom9.org/showthread.php?p=1881016
Is it relevant to the option --refine-mv which is changed to 1 by default for now?

I've done some tests:

--merange 57 --no-hme 2.21fps
--merange 57 --hme umh, umh, star 1.74 fps
--merange 40 --hme umh, umh, star 1.90 fps
--merange 32 --hme umh, umh, star 1.96 fps
--merange 26 --hme umh, umh, star 2.04 fps

So, 27% between HME off and HME on with same merange.
Well, the question is what is better, --merange 57 --no-hme or --merange 26 --hme, cuz defference in speed between them not so much

Boulder
27th September 2019, 12:09
In theory, HME is higher quality even if you use merange 26 (because the effective merange is much higher than that). But if you need to know for sure, you need to test. It could well be that in a normal live action video, you can't tell the difference between the two.

EDIT: the message in that link is one reason why I would like to see the devs explain things a bit, like what kind of material they have tested etc.

benwaggoner
30th September 2019, 18:54
So, 27% between HME off and HME on with same merange.
Well, the question is what is better, --merange 57 --no-hme or --merange 26 --hme, cuz defference in speed between them not so much
There isn't any psychovisual tuning involved here, so looking at PSNR and SSIM differences would probably be a lot more useful than with other settings.

My gut is a smaller range with HME is probably optimal at fixed encoding time, but it'll be somewhat content dependent. HME is probably more useful to improve perf @ quality than anything else.

redbtn
30th September 2019, 20:04
My gut is a smaller range with HME is probably optimal at fixed encoding time, but it'll be somewhat content dependent. HME is probably more useful to improve perf @ quality than anything else.

Thanks for your reply! I use for 4k encoding this settings with Preset Slow and as i know the red ones affect to speed:

--rd 4 --limit-refs 3 --bframes 8 --rc-lookahead 72 --me star --max-merge 4 --ref 4 --subme 5 --weightb --b-intra --tu-intra-depth 3 --tu-inter-depth 3 --no-cutree --no-sao --no-open-gop --no-strong-intra-smoothing --ipratio 1.35 --pbratio 1.25 --deblock -3:-3 --qcomp 0.65 --aq-mode 2 --aq-strength 0.8 --psy-rd 2 --psy-rdoq 2

So, maybe i should use something like --no-rect for compensate slowdown and use --hme umh, umh, star? Or maybe decrease some other settings. I mean, it will more useful to improve perf @ quality?
I ask cuz my speed for now is 1-1.1 fps and i don't wanna go much lower than 1.0 fps

I'll do some tests with PSNR and SSIM tomorrow.

Boulder
1st October 2019, 13:32
I'd drop subme down to 3 as per the preset.

Boulder
2nd October 2019, 07:19
There isn't any psychovisual tuning involved here, so looking at PSNR and SSIM differences would probably be a lot more useful than with other settings.

My gut is a smaller range with HME is probably optimal at fixed encoding time, but it'll be somewhat content dependent. HME is probably more useful to improve perf @ quality than anything else.

Do you think that just setting --ssim would be enough or is tuning needed? I did two quick tests, and at 720p (downscaled from 1080p) --no-hme with --merange 58 was better and at 1080p --hme with --merange 26 was better what comes to SSIM. I did those without changing any other parameters so the psy tunings were there.

redbtn
2nd October 2019, 17:17
I also did tests. And with HME results are worse. Video 2000 frames, 3840x1600, HDR. Additional tests a bit later.


no-hme
encoded 2001 frames in 1364.38s (1.47 fps), 10941.58 kb/s, Avg QP:21.73, SSIM Mean Y: 0.9838777 (17.926 dB)

--hme --hme-search umh,umh,star
encoded 2001 frames in 1953.88s (1.02 fps), 10773.71 kb/s, Avg QP:21.80, SSIM Mean Y: 0.9837793 (17.899 dB)

no-hme
encoded 2001 frames in 1373.02s (1.46 fps), 10941.58 kb/s, Avg QP:21.73, Global PSNR: 48.476 (w/o --tune psnr Global PSNR: 48.511)

--hme --hme-search umh,umh,star
encoded 2001 frames in 1886.87s (1.06 fps), 10772.40 kb/s, Avg QP:21.80, Global PSNR: 48.449 (w/o --tune psnr Global PSNR: 48.481)

benwaggoner
4th October 2019, 18:28
Do you think that just setting --ssim would be enough or is tuning needed? I did two quick tests, and at 720p (downscaled from 1080p) --no-hme with --merange 58 was better and at 1080p --hme with --merange 26 was better what comes to SSIM. I did those without changing any other parameters so the psy tunings were there.
After some rumination, I'm not sure that HME doesn't have psychovisual impact after all. I think there could be cases where it could improve handling of random noise that would have gotten low-pass filtered at the lower resolutions, allowing the encoder to spend more bits on signal than noise.

PSNR would be terrible for measuring this. Not sure about SSIM. Looking at divergence between PSNR and SSIM, or PSNR and VMAF, perhaps could be helpful?

Boulder
4th October 2019, 19:41
After some rumination, I'm not sure that HME doesn't have psychovisual impact after all. I think there could be cases where it could improve handling of random noise that would have gotten low-pass filtered at the lower resolutions, allowing the encoder to spend more bits on signal than noise.

PSNR would be terrible for measuring this. Not sure about SSIM. Looking at divergence between PSNR and SSIM, or PSNR and VMAF, perhaps could be helpful?

At least it seems to cause changes in frametype decision. I didn't verify them to be exactly sure, but it looked like my frame-by-frame comparison had often P-frames compared against B and vice versa.

crystalfunky
4th May 2020, 22:06
I think the reason why no one has responded here is because this is something that comes up alot, and there are plenty of threads here for you to look at to gather the information you are asking for. Apart from that, these forums arnt really that great for these types of generic questions, cause, the answer you will get it is: it depends... Which is also the correct answer.

What exactly is your question? What CRF value you should choose or if medium or slow is the best are stuff only you can answer, we dont know your compression ratio target or speed requirements. Just try different CRF-values until you find a compression ratio that you are comfortable with. It also very source dependent, very high quality 4k sources or grainy sources might break your bitrate budget when using say 18-19, and you might need to go towards CRF 20-22 (which has been the case for me when compressing stuff from DI-sources).

I find slow to be worth the speed trade off, its imo the the preset that offers the best compression without going in too deep in the diminishing return territory. But you need to decide (and probably test) if it worth the trade off for you.

x265 is already tuned for 4k by deafault, so it doesnt need much tweeking outside the presets. The only setting that has good generic properties outside that is imo no-sao (that setting alone or with deblock -1,-1 and no-strong-intra-smoothing could be looked at something as x264 tune film), but again, if you are compressing animation, you might not wanna use these settings anyway. So... It depends.


This is what I use as "base" settings for 2160p24 "film" material, I might then do some tweaking, but as most things, source dependant
--preset slow --profile main10 --level-idc 51 --crf 20 --keyint 240 --min-keyint 24 --rc-lookahead 48 --no-sao

Together with the relevant color information:

e.g.

SDR:
--colorprim bt709 --transfer bt709 --colormatrix bt709 --range limited

HDR10:
--hdr-opt --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --range limited --max-cll "1000,400" --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)"

Would you mind giving me/us settings for 1) normal movies (I guess those you posted already) and 2) for anime movies like Finding nemo or Ghost in the shell?