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. |
22nd April 2022, 20:11 | #1 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,308
|
x265 encode for HW player
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.
__________________
My github. |
22nd April 2022, 20:52 | #2 | Link | ||
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
|
--level 5.1
Quote:
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: Quote:
Sure enough, it's not the best quality, but still it played fine. I think your settings are gonna be fine, though. |
||
22nd April 2022, 21:01 | #3 | Link | |
Lost my old account :(
Join Date: Jul 2017
Posts: 322
|
Quote:
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_E...ers_and_levels https://web.archive.org/web/20160605...per_150724.pdf Last edited by excellentswordfight; 22nd April 2022 at 21:58. |
|
23rd April 2022, 00:17 | #4 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,308
|
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.
__________________
My github. Last edited by jpsdr; 23rd April 2022 at 00:22. |
24th April 2022, 13:12 | #6 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
@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.p...+x264+launcher EDIT: OOps, Looks like I'm wrong about that, [guess I got mixed up with the version of ffmpeg I'm using] Code:
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 Code:
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> Code:
-[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 -" Code:
[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 -
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 24th April 2022 at 13:50. |
24th April 2022, 18:41 | #7 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Just in case anybody else stumbles across jprsd request for Avs input compatible x265 executable,
Barough posted this in another thread, Quote:
Code:
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 Thanx to both Barough and Patman [EDIT: and also jprsd of course]
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 24th April 2022 at 18:46. |
|
24th April 2022, 19:26 | #8 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,308
|
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 !!! 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 !!!
__________________
My github. Last edited by jpsdr; 24th April 2022 at 19:32. |
26th April 2022, 17:46 | #10 | Link | ||
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
|
Quote:
Quote:
|
||
9th May 2022, 14:10 | #13 | Link |
Acid fr0g
Join Date: May 2002
Location: Italy
Posts: 2,542
|
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.
__________________
@turment on Telegram |
9th May 2022, 17:55 | #14 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,308
|
After 10 days, the encode finaly ended, and failling !!!!!
My settings (tune was animation) : Code:
@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 Code:
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 The 3 log files have the same issue ! 10 days ..................
__________________
My github. |
9th May 2022, 18:39 | #15 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,308
|
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).
__________________
My github. |
9th May 2022, 20:09 | #16 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,259
|
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) |
9th May 2022, 20:42 | #17 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,308
|
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 ?
__________________
My github. |
9th May 2022, 21:06 | #19 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,308
|
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...
__________________
My github. Last edited by jpsdr; 9th May 2022 at 21:28. |
9th May 2022, 21:41 | #20 | Link | |
Registered User
Join Date: Dec 2013
Posts: 343
|
Quote:
https://bitbucket.org/multicoreware/...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. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|