View Full Version : x265 encode for HW player
jpsdr
22nd April 2022, 20:11
Hello.
I'm used to x264, but i'm an absolute noob with x265.
One of my favorite old movie is out in new BD-UHD 4k HRD, so i've bought it, i'll rip it, denoise, and want to re-encode.
I've read a lot of things about how to retrieve DoVi and HDR10+ meta-data, so i think i'll be able to manage this part.
I'm used to do that with simple BD : rip the BD, denoise, re-encode and make my own Blu-Ray, or sometime just an mkv.
In the last case, i'm not using strict Blu-Ray compliant parameters, but close enough to stay HW player compliant :
Level 4.1, vbv-maxrate=40000 and vbv-bufsize=30000.
If you use average bitrate=20000 it will provide an average quality encode, not too far from BD quality, but higher than usual 8000 to 12000 re-encode.
I want to do the same thing for the BD-UHD, but i have no idea, first, what vbv-maxrate/vbv-bufsize are BD-UHD compliant, and the level.
My pure guess is to use BDx2 =>
vbv-maxrate=80000
vbv-bufsize=60000
bitrate=40000
level....????
Hoping that will provide HW player (like Zappiti Neo) compliant stream.
But are they ?
So, i gladly take any information about these parameters.
:thanks:
FranceBB
22nd April 2022, 20:52
level....????
--level 5.1
My pure guess is to use BDx2 =>
vbv-maxrate=80000
vbv-bufsize=60000
bitrate=40000
Yeah that is gonna be safe. The video of UHD-BDs is generally 50 Mbit/s, so by putting it to 40 with some overshooting margin you're gonna be safe.
If you want to play extremely safe, remember keyint = framerate and to disable opengop.
I don't generally make UHD-BD, but when I had to encode stuff for distribution and mux it in .ts which had to play on consumer hardware in BT2020 HLG 25p, I did this:
ffmpeg.exe -i "\\VBOXSVR\Share_Windows_Linux\Production\AVS\test.avs" -pix_fmt yuv420p16le -strict -1 -an -f yuv4mpegpipe - | x265.exe --y4m - --dither --preset medium --level 5.0 --no-high-tier --ref 4 --profile main10 --bitrate 25000 --deblock -1:-1 --hdr-opt --hrd --min-luma 64 --max-luma 940 --chromaloc 2 --range limited --videoformat component --colorprim bt2020 --transfer arib-std-b67 --colormatrix bt2020nc --atc-sei 18 --overscan show --no-open-gop --min-keyint 1 --keyint 25 --repeat-headers --rd 3 --vbv-maxrate 25000 --vbv-bufsize 25000 --wpp --pass 1 -o NUL
ffmpeg.exe -i "\\VBOXSVR\Share_Windows_Linux\Production\AVS\test.avs" -pix_fmt yuv420p16le -strict -1 -an -f yuv4mpegpipe - | x265.exe --y4m - --dither --preset medium --level 5.0 --no-high-tier --ref 4 --profile main10 --bitrate 25000 --deblock -1:-1 --hdr-opt --hrd --min-luma 64 --max-luma 940 --chromaloc 2 --range limited --videoformat component --colorprim bt2020 --transfer arib-std-b67 --colormatrix bt2020nc --atc-sei 18 --overscan show --no-open-gop --min-keyint 1 --keyint 25 --repeat-headers --rd 3 --vbv-maxrate 25000 --vbv-bufsize 25000 --wpp --pass 2 -o "\\VBOXSVR\Share_Windows_Linux\temp\raw_video.hevc"
C:/Programmi/MKVToolNix\mkvmerge.exe --output "\\VBOXSVR\Share_Windows_Linux\raw_video.mkv" --language 0:und ^"^(^" \\VBOXSVR\Share_Windows_Linux\raw_video.hevc ^"^)^"
ffmpeg.exe -i "\\VBOXSVR\Share_Windows_Linux\Production\AVS\test.avs" -map 0:1 -af loudnorm=I=-24:LRA=12:tp=-2 -c:0:1 ac3 -b:0:1 384k -ar 48000 "\\VBOXSVR\Share_Windows_Linux\audio.ac3"
ffmpeg.exe -i "\\VBOXSVR\Share_Windows_Linux\Production\AVS\test.avs" -map 0:1 -af loudnorm=I=-24:LRA=12:tp=-2 -c:0:1 libtwolame -b:0:1 192k -ar 48000 "\\VBOXSVR\Share_Windows_Linux\audio.mp2"
ffmpeg.exe -i "\\VBOXSVR\Share_Windows_Linux\raw_video.mkv" -i "\\VBOXSVR\Share_Windows_Linux\audio.ac3" -i "\\VBOXSVR\Share_Windows_Linux\audio.mp2" -map 0:0 -map 1:0 -map 2:0 -c:0:0 copy -c:1:0 copy -c:2:0 copy -f mpegts -metadata provider_name="Test" -metadata service_provider="Test" -metadata service_name="Test" -mpegts_original_network_id 0x1122 -mpegts_transport_stream_id 0x3344 -mpegts_service_id 0x5566 -mpegts_pmt_start_pid 0x1500 -mpegts_start_pid 0x150 -mpegts_service_type "digital_tv" -mpegts_flags "resend_headers" "\\VBOXSVR\Share_Windows_Linux\final.ts"
pause
and it played everywhere, including on UHD-BD players.
Sure enough, it's not the best quality, but still it played fine.
I think your settings are gonna be fine, though.
excellentswordfight
22nd April 2022, 21:01
Hello.
I'm used to x264, but i'm an absolute noob with x265.
One of my favorite old movie is out in new BD-UHD 4k HRD, so i've bought it, i'll rip it, denoise, and want to re-encode.
I've read a lot of things about how to retrieve DoVi and HDR10+ meta-data, so i think i'll be able to manage this part.
I'm used to do that with simple BD : rip the BD, denoise, re-encode and make my own Blu-Ray, or sometime just an mkv.
In the last case, i'm not using strict Blu-Ray compliant parameters, but close enough to stay HW player compliant :
Level 4.1, vbv-maxrate=40000 and vbv-bufsize=30000.
If you use average bitrate=20000 it will provide an average quality encode, not too far from BD quality, but higher than usual 8000 to 12000 re-encode.
I want to do the same thing for the BD-UHD, but i have no idea, first, what vbv-maxrate/vbv-bufsize are BD-UHD compliant, and the level.
My pure guess is to use BDx2 =>
vbv-maxrate=80000
vbv-bufsize=60000
bitrate=40000
level....????
Hoping that will provide HW player (like Zappiti Neo) compliant stream.
But are they ?
So, i gladly take any information about these parameters.
:thanks:
UHD-Bluray is using main10 level 5.1 high tier, which has a max bitrate of 160Mbps (so that would be maxrate and bufsize at 160000 to be vbv compliant), however the uhd-bluray-spec states a maximum bitrate of 100Mbps for the video stream and there are then a maximum rate for the total ts stream that depends on the disc used but usually its 109Mbps. Keep in mind that the rates for these physical disc formats are set by the limit of the slow read speed of the optical discs, the video decoder can most likely handles the maximum rate that the standard specifies for that level.
I would set --level-idc 51 (this ensures that you wont break level compliance in regards to ref-frames etc, setting this is the key thing to ensure playback compatibility) & --vbv-maxrate 98000 --vbv-bufsize 98000 if you wanna keep it in line with uhd-bluray. From what i've seen uhd-blurays bitrate usually averages around 40-60Mbps (it can differ quite a bit depending on running length and disc used), but i would highly recommend using crf instead of fixed avg bitrate for the re-encode.
https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding_tiers_and_levels
https://web.archive.org/web/20160605030640/http://www.blu-raydisc.com/assets/Downloadablefile/BD-ROM_Part3_V3.0_WhitePaper_150724.pdf
jpsdr
23rd April 2022, 00:17
Thanks for the answers.
I've made some search and thought that x265 accept now directly avs without needing pipe ffmpeg stuff (which wasn't the case in the begining), am i wrong ?
Don't realy want to be strictly UHD compliant, just HW. When i'm doing mkv just HW play compliant, not targeting BD, i don't restrict keyframe to 1s and i keep open gop.
But the thanks, the command lines will help me, as i intend to do multipass encode, not 1 pass crf.
But i'll made some testing during this week end.
jpsdr
24th April 2022, 10:38
Reading this (https://github.com/staxrip/staxrip/issues/429), i thought that x265 has native avs input support, as there is some tests labeled "AVS only using Crop via DIRECT INPUT"/"AVS_nopipe".
Am i mistaking ?
StainlessS
24th April 2022, 13:12
@jpsdr,
I could well be wrong but,
I think that avs input may need to be "enabled" during compile of x265,
I think I remember that everything is enabled in Lord Mulder's Simple x264 Launcher [includes x265],
I stole the x265 [8 and 10/12/ bit] encoders from simple launcher and am using with MeGUI x64.
Simple x264/x265 Launcher v3.01 (2020-12-08) :- https://forum.doom9.org/showthread.php?t=144140&highlight=simple+x264+launcher
EDIT: OOps,
Looks like I'm wrong about that, [guess I got mixed up with the version of ffmpeg I'm using]
C:\Users\steve>x265 --fullhelp
x265 [info]: HEVC encoder version 3.5+20-17839cc0d
x265 [info]: build info [Windows][GCC 11.2.0][64 bit] 8bit+10bit+12bit
Syntax: x265 [options] infile [-o] outfile
infile can be YUV or Y4M
outfile is raw HEVC bitstream
Input Options:
--input <filename> Raw YUV or Y4M input file name. `-` for stdin
--y4m Force parsing of input stream as YUV4MPEG2 regardless of file extension
--fps <float|rational> Source frame rate (float or num/denom), auto-detected if Y4M
--input-res WxH Source picture size [w x h], auto-detected if Y4M
--input-depth <integer> Bit-depth of input file. Default 8
--input-csp <string> Chroma subsampling, auto-detected if Y4M
0 - i400 (4:0:0 monochrome)
1 - i420 (4:2:0 default)
2 - i422 (4:2:2)
3 - i444 (4:4:4)
--dhdr10-info <filename> JSON file containing the Creative Intent Metadata to be encoded as Dynamic Tone Mapping
--[no-]dhdr10-opt Insert tone mapping SEI only for IDR frames and when the tone mapping information changes. Default disabled
--dolby-vision-profile <float|integer> Specifies Dolby Vision profile ID. Currently only profile 5, profile 8.1 and profile 8.2 enabled. Specified as '5' or '50'. Default 0 (disabled).
--dolby-vision-rpu <filename> File containing Dolby Vision RPU metadata.
If given, x265's Dolby Vision metadata parser will fill the RPU field of input pictures with the metadata read from the file. Default NULL(disabled).
--nalu-file <filename> Text file containing SEI messages in the following format : <POC><space><PREFIX><space><NAL UNIT TYPE>/<SEI TYPE><space><SEI Payload>
Dont seem to be any mention of AVS, and MEGUI looks like it pipes via ffmpeg.
-[Information] [21/04/2022 20:39:26] Job command line: "cmd.exe" /c ""C:\NON-INSTALL\MeGUI_x64\tools\ffmpeg\ffmpeg.exe" -loglevel level+error -i "D:\___BLURAY\OUT1\LandOfTheLost.avs" -strict -1 -f yuv4mpegpipe - |
"C:\NON-INSTALL\MeGUI_x64\tools\x265\x64\x265.exe" --preset slow --crf 27.0 --sar 1:1 --output "C:\Z\LandOfTheLost.hevc" --frames 146277 --y4m -"
And from within Simple Launcher
[2022-04-24][13:43:27] Creating input process:
[2022-04-24][13:43:27] C:\NON-INSTALL\Simple_x264_Launcher\toolset\x86\avs2yuv_x86.exe D:\___BLURAY\test.avs -
[2022-04-24][13:43:27]
[2022-04-24][13:43:27] Creating encoder process:
[2022-04-24][13:43:27] C:\NON-INSTALL\Simple_x264_Launcher\toolset\x64\x265_x64.exe -D 8 --crf 22.0 --output "C:\Z\test (2).hevc" --frames 100 --y4m -
StainlessS
24th April 2022, 18:41
Just in case anybody else stumbles across jprsd request for Avs input compatible x265 executable,
Barough posted this in another thread,
Have a look here (https://github.com/Patman86/x265-Mod-by-Patman)
And output from that executable
Syntax: x265 [options] infile [-o] outfile
infile can be AVS, VPY, YUV or Y4M
outfile is raw HEVC bitstream
Executable Options:
-h/--help Show this help text and exit
--fullhelp Show all options and exit
-V/--version Show version info and exit
Output Options:
-o/--output <filename> Output file name can be *.gop or *.hevc
-D/--output-depth 8|10|12 Output bit depth (also internal bit depth). Default 8
--log-level <string> Logging level: none error warning info debug full. Default INFO
--no-progress Disable CLI progress reports
--csv <filename> Comma separated log file, if csv-log-level > 0 frame level statistics, else one line per run
--csv-log-level <integer> Level of csv logging, if csv-log-level > 0 frame level statistics, else one line per run: 0-2
Input Options:
--input <filename> AVS, VPY, Raw YUV or Y4M input file name. `-` for stdin
--fps <float|rational> Source frame rate (float or num/denom), auto-detected if Y4M
--input-res WxH Source picture size [w x h], auto-detected if Y4M
--dolby-vision-profile <float|integer> Specifies Dolby Vision profile ID. Currently only profile 5, profile 8.1 and profile 8.2 enabled. Specified as '5' or '50'. Default 0 (disabled).
--dolby-vision-rpu <filename> File containing Dolby Vision RPU metadata.
If given, x265's Dolby Vision metadata parser will fill the RPU field of input pictures with the metadata read from the file. Default NULL(disabled).
--nalu-file <filename> Text file containing SEI messages in the following format : <POC><space><PREFIX><space><NAL UNIT TYPE>/<SEI TYPE><space><SEI Payload>
-f/--frames <integer> Maximum number of frames to encode. Default all
--seek <integer> First frame to encode
--[no-]field Enable or disable field coding. Default disabled
--[no-]copy-pic Copy buffers of input picture in frame. Default enabled
--reader-options Pass reader-specific options to input file reader
Avisynth reader options:
library Use custom Avisynth library (full path to Avisynth library is required)
Vapoursynth reader options:
library Use custom Vapoursynth library (full path to VSScript library is required)
output Select arbitrary video node. Node 0 is selected by default
requests Override async requests (derived from Vapoursynth threads by default)
use-script-sar Use script's reported SAR. Default 0:0
so also supports Vapoursynth input.
Thanx to both Barough and Patman [EDIT: and also jprsd of course] :thanks:
jpsdr
24th April 2022, 19:26
Everything is going great.
I have a good x265 version i can directly provide my avs file.
I've first made a quick encode with ultrafast preset on the first 2000 frames of the movie, inserting the rpu DolbyVision i've extracted from it. It works !!! :D My player and my TV identify properly the final MKV as DolbyVision. At least, i have the "DolbyVision" message displayed.
For 4k video the denoising speed is 1.8fps, so i should have the result file tomorrow evening. But it's the first time i'm working with 4k movie for denoising, and when proper remaster is done, because of 4k, denoising... Well, technicaly it's "removing grain", produce better result for heavy grain (at least it is for this case).
I've tested the setting i can put to encode, placebo and veryslow gave me 0.1fps, it's a little slow...
Slower gave me 0.4fps, which is... acceptable. So, as i'm doing multipass encode, i should have my movie encoded for the end of the week.
I don't think i'll do this often, only for movies :
- I REALY REALY like.
- There is a 4k proper good remaster done.
Because... Almost a week for a movie... Realy motivated ! ;)
When i'm doing this for simple FHD Blu-Ray, it's a lot faster !!!
jpsdr
26th April 2022, 09:44
I'm able now to build my own version...
benwaggoner
26th April 2022, 17:46
I don't think i'll do this often, only for movies :
- I REALY REALY like.
- There is a 4k proper good remaster done.
Because... Almost a week for a movie... Realy motivated ! ;)
What's the advantage for you over just extracting the HEVC bitstream as is without reencoding?
When i'm doing this for simple FHD Blu-Ray, it's a lot faster !!!
Yeah, a UHD Blu-ray is 4x the pixels and 1.25x the bit depth. All things being equal, you'd expect it to be 5x slower with the same codec. And x265 is a lot slower than x264 for equivalent profiles. Of course, you can run x265 in a faster preset if you don't care about file size too much.
jpsdr
26th April 2022, 20:28
I extract, denoise, and reenconde.
benwaggoner
29th April 2022, 17:19
I extract, denoise, and reenconde.
Ah, so it's more than you're reprocessing for stylistic reasons, and then reencoding that output? Makes sense.
tormento
9th May 2022, 14:10
I'm used to x264, but i'm an absolute noob with x265.
The most complete interface to x265 AFAIK is StaxRip.
It has some steep learning curve, not because it's difficult, but as it wants to decide lot of things on its side, so you have to find and disable,
Anyway, the x265 panel is really complete: you can find ANY parameter.
Once you have found the "perfect" settings, just copy the switches you need most and go by CLI, if you prefer.
After 10 days, the encode finaly ended, and failling !!!!! :(
My settings (tune was animation) :
@echo off
SET E_SRC=%8%1.avs
SET E_DST=%5%1.hevc
SET E_DOVI=%8%1
SET CHAPTERS=%8%7
SET STAT_FILE=%8%1.stats
SET LOG_FILE_1=%8%1_log_1.txt
SET LOG_FILE_2=%8%1_log_2.txt
SET LOG_FILE_3=%8%1_log_3.txt
SET BITRATE=%2
SET TUNING=%6
SET MCLL=%3
SET MDISPLAY=%4
if %6==film goto :NOTUNE
if %6==none goto :NOTUNE
if %6==aucun goto :NOTUNE
x265_x64 --preset slower --tune %TUNING% --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --hrd --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --frame-dup --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-cu-delta-qp --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --video-signal-type-preset BT2100_PQ_YCC -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --qpfile %CHAPTERS% --input %E_SRC% --pass 1 -o NUL 2> %LOG_FILE_1%
x265_x64 --preset slower --tune %TUNING% --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --hrd --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --frame-dup --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-cu-delta-qp --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --video-signal-type-preset BT2100_PQ_YCC -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --qpfile %CHAPTERS% --input %E_SRC% --pass 3 -o NUL 2> %LOG_FILE_2%
x265_x64 --preset slower --tune %TUNING% --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --hrd --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --frame-dup --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-cu-delta-qp --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --video-signal-type-preset BT2100_PQ_YCC -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --dolby-vision-profile 81 --dolby-vision-rpu %E_DOVI%.bin --qpfile %CHAPTERS% --input %E_SRC% --pass 2 -o %E_DST% 2> %LOG_FILE_3%
goto :FIN
:NOTUNE
x265_x64 --preset slower --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --hrd --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --frame-dup --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-cu-delta-qp --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --video-signal-type-preset BT2100_PQ_YCC -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --qpfile %CHAPTERS% --input %E_SRC% --pass 1 -o NUL 2> %LOG_FILE_1%
x265_x64 --preset slower --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --hrd --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --frame-dup --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-cu-delta-qp --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --video-signal-type-preset BT2100_PQ_YCC -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --qpfile %CHAPTERS% --input %E_SRC% --pass 3 -o NUL 2> %LOG_FILE_2%
x265_x64 --preset slower --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --hrd --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --frame-dup --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-cu-delta-qp --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --video-signal-type-preset BT2100_PQ_YCC -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --dolby-vision-profile 81 --dolby-vision-rpu %E_DOVI%.bin --qpfile %CHAPTERS% --input %E_SRC% --pass 2 -o %E_DST% 2> %LOG_FILE_3%
:FIN
Result log :
avs+ [INFO]: AviSynth+ 3.7.2 (r3661, 3.7, x86_64)
avs+ [INFO]: 3840x2160 fps 24000/1001 i420p10 frames 0 - 129983 of 129984
raw [INFO]: output file: "L:\Metal_Hurlant.hevc"
x265 [INFO]: HEVC encoder version 3.5+37+12 [Mod by Patman]
x265 [INFO]: build info [Windows][MSVC 1929][64 bit] 10bit
x265 [INFO]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [WARN]: hevc-aq enabled, disabling other aq-modes
x265 [FLAW]: Recommended Settings for HDR10-opt: colour primaries should be BT.2020,
transfer characteristics should be SMPTE ST.2084,
matrix coeffs should be BT.2020,
the input video should be 10 bit 4:2:0
Disabling hdr10-opt.
x265 [WARN]: Turning on repeat-headers for HDR compatibility
x265 [INFO]: Main 10 profile, Level-5.1 (High tier)
x265 [INFO]: Thread pool created using 20 threads
x265 [INFO]: Slices : 1
x265 [INFO]: frame threads / pool features : 4 / wpp (34 rows)
x265 [INFO]: Coding QT: max CU size / min CU size : 64 / 8
x265 [INFO]: Residual QT: max TU size / max TU depth : 32 / 3 inter / 3 intra
x265 [INFO]: ME / range / subpel / merge : star / 57 / 4 / 4
x265 [INFO]: Keyint min / max / scenecut / bias : 23 / 250 / 40 / 5.00
x265 [INFO]: Lookahead / bframes / badapt : 48 / 10 / 2
x265 [INFO]: b-pyramid / weightp / weightb : 1 / 1 / 1
x265 [INFO]: References / ref-limit cu / depth : 5 / off / on
x265 [INFO]: AQ: mode / str / qg-size / cu-tree : 3 / 0.4 / 32 / 1
x265 [INFO]: Rate Control / qCompress : ABR-40000 kbps / 0.60
x265 [INFO]: VBV buffer / maxrate / init : 70000 / 90000 / 0.900
x265 [INFO]: tools: rect amp limit-modes rd=6 psy-rd=0.40 rdoq=2 psy-rdoq=1.00
x265 [INFO]: tools: rskip mode=1 limit-tu=4 signhide tmvp b-intra
x265 [INFO]: tools: strong-intra-smoothing deblock(tC=1:B=1) stats-read
x265 [INFO]: VES muxing with Dolby Vision RPU file successful in x265
x265 [INFO]: frame I: 1268, Avg QP:6.13 kb/s: 119741.03
x265 [INFO]: frame P: 34104, Avg QP:6.91 kb/s: 80779.59
x265 [INFO]: frame B: 94372, Avg QP:8.73 kb/s: 24115.83
x265 [INFO]: Weighted P-Frames: Y:4.9% UV:1.7%
x265 [INFO]: Weighted B-Frames: Y:3.7% UV:0.9%
x265 [INFO]: consecutive B-frames: 12.7% 12.4% 10.7% 43.2% 7.5% 10.3% 1.1% 1.4% 0.3% 0.2% 0.1%
x265 [INFO]: RPS in SPS: 113594 frames (87.55%), RPS not in SPS: 16150 frames (12.45%)
encoded 129744 frames in 263431.82s (0.49 fps), 39944.80 kb/s, Avg QP:8.23
WHY ????? Why there is only 129744 encoded frames when the number of frames on the file is properly detected at 129984 ? :scared:
The 3 log files have the same issue !
10 days .................. :(
Is it because of --frame-dup, and is mkvtoolnix in that case unable to mux properly the result file ? Because i have audio/video totaly (few seconds) out of sync. Also, the first few seconds of the video is a total black (which can create a lot of frame dup in the begining).
a. I think the numbers are 'okay' since the dup frames do probably not count into the encoded frames.
b. I can reproduce this behaviour, but it's either a bug in x265 or it's not only mkvtoolnix. Same thing happens when MP4Box or ffmpeg are used for muxing. (tested with a clip which starts with a few seconds of black and one can clearly see the audio beeing async)
-> I would be interested in this too. :) (for anyone wanting to test this: --frame-dub requires hdr signaling and vbv, otherwise it gets disabled)
Why do i have the FLAW for --hdr10-opt when there is --video-signal-type-preset BT2100_PQ_YCC which set everything as --hdr10-opt is expecting ???
Is it possible that an option adding some kind of timing information is missing to be used with --frame-dup for mkvtoolnix being able to properly mux the stream ?
Is it possible that an option adding some kind of timing information is missing to be used with --frame-dup for mkvtoolnix being able to properly mux the stream ?
Isnt x265 duplicating pictures by means of the picture timing SEIs ? Then its normal that it drops pictures. The muxer has to evaluate the SEIs though. The SEIs should present when --hrd is specified.
It's x265 or bugland ????? I mean, since the time !
I've replaced --video-signal-type-preset BT2100_PQ_YCC by --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --range limited --chromaloc 2 which is supposed to be exactly the same according the doc, but it seems not, because --hdr10-opt is not complaining anymore.
10 days wasted... i'm a little not happy...:angry:
It's x265 or bugland ????? I mean, since the time !
I've replaced --video-signal-type-preset BT2100_PQ_YCC by --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --range limited --chromaloc 2 which is supposed to be exactly the same according the doc, but it seems not, because --hdr10-opt is not complaining anymore.
10 days wasted... i'm a little not happy...:angry:
If you look here:
https://bitbucket.org/multicoreware/x265_git/src/9b59d45549f460e41a852cfd276f9b89eed2112a/source/encoder/encoder.cpp#lines-4368
In line 4368 it checks for the HDR10 opt parameters and below that in line 4383 it applies the preset.
Maybe test with a 30 seconds or 1 minute sample before encoding the whole movie again ?
I have been thinking about that frame dup thing and I dont know, Player support, with Dolby Vision, its kinda a stretch. I would just drop it. Duped frames are really tiny when encoded anyway so it does not matter in the end.
nevcairiel
9th May 2022, 21:59
I agree with the frame dup, drop it, no need to make the video practically VFR for a very tiny gain only, and potentially cause issues with muxers and/or players.
Ok, thanks for the info, just hope in the future they fix this preset bug, honestly....
jpsdr
25th May 2022, 18:50
Seriously........ this is bugland !!!!!!!!!!!!!!!!! :mad:
Some parts of the video is totaly screwed up, and i have no idea what setting caused it.... :(
The command line was (tuned animation) :
@echo off
SET E_SRC=%8%1.avs
SET E_DST=%5%1.hevc
SET E_DOVI=%8%1
SET CHAPTERS=%8%7
SET STAT_FILE=%8%1.stats
SET LOG_FILE_1=%8%1_log_1.txt
SET LOG_FILE_2=%8%1_log_2.txt
SET LOG_FILE_3=%8%1_log_3.txt
SET BITRATE=%2
SET TUNING=%6
SET MCLL=%3
SET MDISPLAY=%4
if %6==film goto :NOTUNE
if %6==none goto :NOTUNE
if %6==aucun goto :NOTUNE
x265_x64 --preset slower --tune %TUNING% --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --range limited --chromaloc 2 -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --qpfile %CHAPTERS% --input %E_SRC% --pass 1 -o NUL 2> %LOG_FILE_1%
x265_x64 --preset slower --tune %TUNING% --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --range limited --chromaloc 2 -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --qpfile %CHAPTERS% --input %E_SRC% --pass 3 -o NUL 2> %LOG_FILE_2%
x265_x64 --preset slower --tune %TUNING% --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --range limited --chromaloc 2 -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --dolby-vision-profile 81 --dolby-vision-rpu %E_DOVI%.bin --qpfile %CHAPTERS% --input %E_SRC% --pass 2 -o %E_DST% 2> %LOG_FILE_3%
goto :FIN
:NOTUNE
x265_x64 --preset slower --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --range limited --chromaloc 2 -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --qpfile %CHAPTERS% --input %E_SRC% --pass 1 -o NUL 2> %LOG_FILE_1%
x265_x64 --preset slower --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --range limited --chromaloc 2 -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --qpfile %CHAPTERS% --input %E_SRC% --pass 3 -o NUL 2> %LOG_FILE_2%
x265_x64 --preset slower --vbv-maxrate 90000 --vbv-bufsize 70000 --bitrate %BITRATE% --stats %STAT_FILE% --level 5.1 --profile main10 --high-tier --level-idc 51 --fades --aq-mode 3 --hevc-aq --weightb --rc-lookahead 48 --rect --amp --b-intra --no-sao --scenecut-aware-qp 3 --analyze-src-pics --opt-ref-list-length-pps --opt-qp-pps --multi-pass-opt-distortion --multi-pass-opt-rps --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --range limited --chromaloc 2 -D 10 --max-cll %MCLL% --master-display %MDISPLAY% --hdr10-opt --dolby-vision-profile 81 --dolby-vision-rpu %E_DOVI%.bin --qpfile %CHAPTERS% --input %E_SRC% --pass 2 -o %E_DST% 2> %LOG_FILE_3%
:FIN
EDIT :
Noticed the video is screwed up at a place i put an I frame in the chapter file.
EDIT2 :
Can reproduce with a small 200 frames centered where the issue occurs.
jpsdr
26th May 2022, 16:46
Fortunately i was able to reproduce with a small video, allowing me to remove options one at a time until i found the guilty.
DO NOT, NEVER USE --multi-pass-opt-rps !!!!!!!!!
It's hell bugged, and it will screw up the result video ! I'm not talking result look bad, i'm talking unplayable blocked pixelised totaly screwed up result stream.
rwill
26th May 2022, 18:08
Fortunately i was able to reproduce with a small video, allowing me to remove options one at a time until i found the guilty.
DO NOT, NEVER USE --multi-pass-opt-rps !!!!!!!!!
It's hell bugged, and it will screw up the result video ! I'm not talking result look bad, i'm talking unplayable blocked pixelised totaly screwed up result stream.
May I ask why you are also using "--analyze-src-pics" ?
excellentswordfight
27th May 2022, 12:07
--aq-mode 3 --hevc-aq
Why would you set both mode 3 and hevc-aq? hevc-aq will disable other aq modes, and is afaik still experimental.
jpsdr
27th May 2022, 16:38
I've spend a lot of time reading the 3.5 doc of x265 and all the options, and activate everything which seems "good" for quality.
To answer the questions :
@rwill
The doc said :
Enable motion estimation with source frame pixels, in this mode, motion estimation can be computed independently.
From the description, it seems it's a good thing.
From your experience, it's not ?
@excellentswordfight
The doc said :
Enable adaptive quantization It scales the quantization step size according to the spatial activity of one coding unit relative to frame average spatial activity.
This AQ method utilizes the minimum variance of sub-unit in each coding unit to represent the spatial complexity of the coding unit.
There is nothing saying it's experimental, also nothing saying it disables the others AQ mode (even if i've noticed it later when seeing the log files).
According the description, it also seems a good option to activate.
From your experience, it's not ?
rwill
27th May 2022, 20:02
@rwill
The doc said :
Enable motion estimation with source frame pixels, in this mode, motion estimation can be computed independently.
From the description, it seems it's a good thing.
From your experience, it's not ?
Well I have no experience with that but in theory its better to use the reconstructed pixels because these are actually available on the decoder side and are the only thing a prediction can be formed from. I don't think doing ME on source pixels as reference is any good because inter prediction is formed from a reference picture anyway ..
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.