Hello guest, if you like this forum, why don't you register? https://fanrestore.com/member.php?action=register (December 14, 2021) x


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
x265 UHD-BD compliant "perfect" settings
#1
Following the idea of the [/url][url=https://fanrestore.com/thread-97.html]x264 BD compliant "perfect" settings, I thought it was time to do the same for x265 and Ultra HD Blu-ray.
Studied a bit here and there, and came to the following settings:

ATTENTION: PROVISIONAL UNTESTED SETTINGS!!!
UPDATED: 2019-06-09
REVIEWERS AND TESTERS ARE NEEDED!!!

for the following sources: 1920x1080 or 3840x2160, 10bit, SDR, bt709
Code:
x265.exe --pass 1 --uhd-bd --bitrate 50000 --vbv-maxrate 64000 --vbv-bufsize 64000 --keyint 24 --min-keyint 1 --preset medium --tune grain --profile main10 --level-idc 51 --high-tier --aud --sar 1 --hrd --repeat-headers --no-open-gop --ref 5 --no-temporal-layers --overscan show --wpp --input-depth 10 --output-depth 10 --no-interlace --range limited --colorprim bt709 --transfer bt709 --colormatrix bt709 --stats ".stats" --output NUL "Input_File.avs"

x265.exe --pass 2 --uhd-bd --bitrate 50000 --vbv-maxrate 64000 --vbv-bufsize 64000 --keyint 24 --min-keyint 1 --preset medium --tune grain --profile main10 --level-idc 51 --high-tier --aud --sar 1 --hrd --repeat-headers --no-open-gop --ref 5 --no-temporal-layers --overscan show --wpp --input-depth 10 --output-depth 10 --no-interlace --range limited --colorprim bt709 --transfer bt709 --colormatrix bt709 --stats ".stats" --output "Output_File.265" "Input_File.avs"


for the following sources: 1920x1080 or 3840x2160, 10bit, HDR, bt2020
Code:
x265.exe --pass 1 --uhd-bd --bitrate 50000 --vbv-maxrate 64000 --vbv-bufsize 64000 --keyint 24 --min-keyint 1 --preset medium --tune grain --profile main10 --level-idc 51 --high-tier --aud --sar 1 --hrd --repeat-headers --no-open-gop --ref 5 --no-temporal-layers --overscan show --wpp --input-depth 10 --output-depth 10 --no-interlace --range limited --chromaloc 2 --colorprim bt2020 --transfer bt2020-10 --colormatrix bt2020nc --max-cll "1000,400" --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)" --stats ".stats" --output NUL "Input_File.avs"

x265.exe --pass 2 --uhd-bd --bitrate 50000 --vbv-maxrate 64000 --vbv-bufsize 64000 --keyint 24 --min-keyint 1 --preset medium --tune grain --profile main10 --level-idc 51 --high-tier --aud --sar 1 --hrd --repeat-headers --no-open-gop --ref 5 --no-temporal-layers --overscan show --wpp --input-depth 10 --output-depth 10 --no-interlace --range limited --chromaloc 2 --colorprim bt2020 --transfer bt2020-10 --colormatrix bt2020nc --max-cll "1000,400" --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)" --stats ".stats" --output "Output_File.265" "Input_File.avs"

replace 50000 with the desired average bitrate, 24 in the keyint with the video framerate (24 would do for 23.976 and 30 for 29.97), Input_File.avs with an AviSynth script (or a video file), and Output_File.264 with the final x264 file. Max bitrate and buffer size were set to 64000 to be used with a BD-50, but should be lowered to 50000 to fix eventual compatibility problems, and to 35000 to be used with a BD-25; in case someone would risk to use a BD-XL 100, it could be set to 100000 (as 109000 is the maximum bitrate including audio and subs tracks).

You can use them directly with the x265 command line - just copy and paste pass 1 settings then, when finished, copy and paste pass2 settings - or save as .bat file (thanks to Feallan for the idea), or use them inside some GUIs - the best so far IMHO is Simple x264 Launcher, but using any software that is not the original x265 command line could add some further setting that could lead to have a not-compliant file, so be aware, you are warned! And, do NOT delete any temp files you get after pass 1 (.stats and .stats.mbtree) because they will be used by pass 2!!!

HINTS:
  • these settings are good for 1080p or 2160p video
  • pay attention to the BD size: actual ones are 23.3GiB for BD-25, 46.6GiB for BD-50, 93.2GiB for BD-XL 100
  • allow about 7% overhead for the .m2ts container - for example, total file size (video+audio+subs) excluding eventual menus would be around 21.75GiB for a BD-25, 43.55GiB for a BD-50, 87.09GiB for a BD-XL 100
  • to retain grain, better to use as much bitrate as possible - the one the disc allow to
  • max bitrate allowed for UHD-BD video is 100mbps, so you should be careful only if using a BD-XL 100 and if audio plus subs tracks total bitrate is over 9000mbps, you should lower video bitrate accordingly, in particular pay attention to --vbv-maxrate
  • to improve speed, you can use for pass 1 a "simpler" version of the final file, for example without noise reduction, grain plate, color grading, but it should be otherwise identical - same frame numbers, same resolution etc.
References:
x265 command line options - https://x265.readthedocs.io/en/default/cli.html
Ultra HD Blu-ray white paper - http://blu-raydisc.com/Assets/Downloadab...clean).pdf
tsMuxeR 2.6.12 - https://www.videohelp.com/software/tsMuxeR
TSM2UHD - https://forum.doom9.org/showthread.php?t=175120
Reply
Thanks given by: Evit , bronan , SIUse
#2
So Ive had a go at this.
I downloaded the latest x265 and pretty much set up exactly the same as the x264 Bluray method linked above that works perfectly. (I'm launching from a batch file)

I get the following on 1st pass

Code:
x265.exe --pass 1 --uhd-bd --bitrate 50000 --vbv-maxrate 64000 --vbv-bufsize 64000 --keyint 24 --min-keyint 1 --preset veryslow --tune grain --profile main10 --level-idc 51 --high-tier --aud --sar 1 --hrd --repeat-headers --no-open-gop --ref 6 --no-temporal-layers --overscan show --wpp --multi-pass-opt-analysis --input-depth 10 --output-depth 10 --no-interlace --range limited --colorprim bt709 --transfer bt709 --colormatrix bt709 --stats ".stats" --output NUL "Input.avs"
x265 [error]: yuv: width, height, and FPS must be specified
x265 [error]: unable to open input file <Input.avs>
Reply
Thanks given by:
#3
Maybe x265 can't read .avs files natively. I would check if there's a modded x265 that can or if there is one of those tools that can pipe the data to x265, similar to AVStox264 (hope I remember that right).
Reply
Thanks given by: CSchmidlapp
#4
^ Piping from ffmpeg might be an idea. And to specify the properties of the video...

Code:
--input-res 3840x2160 --fps 23.976

...or whatever.
Reply
Thanks given by: CSchmidlapp
#5
I fed the settings to Simple x264/x265 Launcher - removing the ones found in the GUI - and it works; still, with veryslow the encoding is.... veeeeeeeeeery slooooooooow - and I mean it!!!
Reply
Thanks given by: CSchmidlapp
#6
(2019-06-02, 11:59 PM)Chewtobacca Wrote: ^ Piping from ffmpeg might be an idea.  And to specify the properties of the video...

Code:
--input-res 3840x2160 --fps 23.976

...or whatever.

Does it matter where I put the 'input res' code in the script?

I'm unsure how to pipe it through ffmpeg to be honest.
I'm using ffms2 as the input method on my Avisynth+ script, but I gather you mean rendering the AVS script through FFMPEG as a frameserver to x265?
Reply
Thanks given by:
#7
(2019-06-03, 05:15 PM)CSchmidlapp Wrote: Does it matter where I put the 'input res' code in the script?

Nope.

By the way, the new veryslow setting for x265 3.0 is something like 40% SLOWER than previous 2.9 setting! Eek
http://x265.org/revamped-veryslow-slower...5-ver-3-0/
Reply
Thanks given by:
#8
(2019-06-03, 10:25 AM)spoRv Wrote: I fed the settings to Simple x264/x265 Launcher - removing the ones found in the GUI - and it works; still, with veryslow the encoding is.... veeeeeeeeeery slooooooooow - and I mean it!!!

I'm trying to encode a high bit rate, 10bit, 422 file in 2K 'Flat' resolution.
Do you think x264 would be a better option at this than x265?
Reply
Thanks given by:
#9
(2019-06-03, 05:17 PM)spoRv Wrote:
(2019-06-03, 05:15 PM)CSchmidlapp Wrote: Does it matter where I put the 'input res' code in the script?

Nope.

By the way, the new veryslow setting for x265 3.0 is something like 40% SLOWER than previous 2.9 setting! Eek
http://x265.org/revamped-veryslow-slower...5-ver-3-0/

Ouch! 3.0 is the version I was playing with lol.
Reply
Thanks given by:
#10
(2019-06-03, 05:21 PM)CSchmidlapp Wrote: I'm trying to encode a high bit rate, 10bit, 422 file in 2K 'Flat' resolution.
Do you think x264 would be a better option at this than x265?

The fact is, I'm aiming toward UHD-BD compliance, hence 422 would not be compliant, so you could go with x264 and get comparable (if not better) quality, almost surely with lower encoding time.

I guess, which is the "bare minimum" setting for x265 to get good encoding speed/subjective quality? Medium seems the best compromise, being 6.6x faster than veryslow, with the latter having "only" 2.62% better SSIM:
[Image: x265%20CRF%2022.jpg]
(old table, finding out a newer one right now)
Reply
Thanks given by: CSchmidlapp


Possibly Related Threads…
Thread Author Replies Views Last Post
Thumbs Up x264 BD compliant "perfect" settings spoRv 150 182,951 2023-09-16, 10:08 PM
Last Post: DoomBot
  I want to change AR, do I have to re-encode? If so, how can I keep original settings? Onti 3 1,903 2021-07-14, 06:28 PM
Last Post: Onti
  NVenc Test Settings Chewtobacca 2 2,014 2020-08-04, 07:56 PM
Last Post: Chewtobacca
  [Idea] x264 BD compliant "perfect" settings - faster version spoRv 26 18,612 2020-05-11, 08:36 PM
Last Post: Stamper
  Handbrake settings - question JackForrester 3 2,767 2020-03-21, 09:25 PM
Last Post: deleted user
  Tools and settings for compressing x264? NeonBible 1 2,298 2019-01-11, 12:01 PM
Last Post: MrBrown

Forum Jump:


Users browsing this thread: 1 Guest(s)