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.

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 22nd November 2020, 10:07   #21  |  Link
ghostshadow
Registered User
 
Join Date: Jan 2020
Posts: 34
Quote:
Originally Posted by quietvoid View Post
It might be related to the memory, buffer allocations..
My stack size on linux was limited to 8MB, and I was using 4MB in the code.
I have lowered it way down, please try again.
Hello quietvoid, it's good it works, that was it.
Now I'm going to try encoded in x265 and give it this rpu as a parameter. I will let you know
ghostshadow is offline   Reply With Quote
Old 24th November 2020, 01:52   #22  |  Link
imhh11
Registered User
 
Join Date: Jul 2016
Posts: 171
@quietvoid thanks a lot for your tool. Just for fun, I tried to encode p7 dual-layer bluray to p5 single layer full range. Seems to work well on my bluray player and Nvidia Shield but I don't know if I used proper x265.exe settings.
But I probably should use profile 8 and keep the BL HDR10 compatible.

P5 encoded sample:
https://drive.google.com/file/d/12Cm...ew?usp=sharing

P8 encoded sample:
https://drive.google.com/file/d/1HSe...ew?usp=sharing

Code:
Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5.1@High
HDR format                               : Dolby Vision, Version 1.0, dvhe.05.06, BL+RPU
Codec ID                                 : dvhe
Codec ID/Info                            : High Efficiency Video Coding with Dolby Vision
Duration                                 : 1 min 0 s
Bit rate                                 : 8 440 kb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 0)
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.042
Stream size                              : 61.2 MiB (100%)
Writing library                          : x265 3.4+26-ga82c6c7a7:[Windows][GCC 10.2.1][64 bit] 10bit
Encoding settings                        : cpuid=1111039 / frame-threads=4 / numa-pools=28 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x2160 / interlace=0 / total-frames=1459 / level-idc=51 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / repeat-headers / annexb / aud / hrd / info / hash=0 / no-temporal-layers / no-open-gop / min-keyint=23 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=20 / lookahead-slices=8 / scenecut=40 / hist-scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / no-strong-intra-smoothing / max-merge=3 / limit-refs=1 / no-limit-modes / me=1 / subme=2 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=-2:-2 / no-sao / no-sao-non-deblock / rd=3 / selective-sao=0 / early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=3 / rc=crf / crf=14.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / vbv-maxrate=160000 / vbv-bufsize=160000 / vbv-init=0.9 / min-vbv-fullness=50.0 / max-vbv-fullness=80.0 / crf-max=0.0 / crf-min=0.0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=0 / overscan=0 / videoformat=5 / range=1 / colorprim=2 / transfer=2 / colormatrix=2 / chromaloc=1 / chromaloc-top=0 / chromaloc-bottom=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / hist-threshold=0.03 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / no-scenecut-aware-qpconformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass
Default                                  : No
Encoded date                             : UTC 2020-11-24 00:29:30
Tagged date                              : UTC 2020-11-24 00:29:30
Color range                              : Full
Codec configuration box                  : hvcC+dvcC

Code:
Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5.1@High
HDR format                               : Dolby Vision, Version 1.0, dvhe.08.06, BL+RPU / SMPTE ST 2086, HDR10 compatible
Codec ID                                 : dvhe
Codec ID/Info                            : High Efficiency Video Coding with Dolby Vision
Duration                                 : 1 min 0 s
Bit rate                                 : 6 795 kb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 2)
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.034
Stream size                              : 49.3 MiB (100%)
Writing library                          : x265 3.4+26-ga82c6c7a7:[Windows][GCC 10.2.1][64 bit] 10bit
Encoding settings                        : cpuid=1111039 / frame-threads=4 / numa-pools=28 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x2160 / interlace=0 / total-frames=1459 / level-idc=51 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / repeat-headers / annexb / aud / hrd / info / hash=0 / no-temporal-layers / no-open-gop / min-keyint=23 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / hist-scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / no-strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=-2:-2 / no-sao / no-sao-non-deblock / rd=4 / selective-sao=0 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=14.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / vbv-maxrate=160000 / vbv-bufsize=160000 / vbv-init=0.9 / min-vbv-fullness=50.0 / max-vbv-fullness=80.0 / crf-max=0.0 / crf-min=0.0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=0 / overscan=0 / videoformat=5 / range=0 / colorprim=9 / transfer=16 / colormatrix=9 / chromaloc=1 / chromaloc-top=2 / chromaloc-bottom=2 / display-window=0 / master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1) / cll=233,63 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / hist-threshold=0.03 / no-opt-cu-delta-qp / no-aq-motion / hdr10 / hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / no-scenecut-aware-qpconformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass
Default                                  : No
Encoded date                             : UTC 2020-11-24 01:57:43
Tagged date                              : UTC 2020-11-24 01:57:43
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : Display P3
Mastering display luminance              : min: 0.0001 cd/m2, max: 1000 cd/m2
Maximum Content Light Level              : 233 cd/m2
Maximum Frame-Average Light Level        : 63 cd/m2
Codec configuration box                  : hvcC+dvcC

Last edited by imhh11; 24th November 2020 at 03:01.
imhh11 is offline   Reply With Quote
Old 24th November 2020, 03:43   #23  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 570
I'm not sure BT2020 primaries is meant to be played as profile 5 :P
They both play just fine on my device, otherwise.
But yes, the profile 5 only plays in Dolby Vision.

Last edited by quietvoid; 24th November 2020 at 03:49.
quietvoid is offline   Reply With Quote
Old 24th November 2020, 03:58   #24  |  Link
imhh11
Registered User
 
Join Date: Jul 2016
Posts: 171
yes you're right, it's probably not possible yet to encode p7 bt2020 to true p5 which uses a different colorspace. or maybe you know how ?
profile 8 file with HDR10 BL should be standard though

thank's again for your great work.
imhh11 is offline   Reply With Quote
Old 24th November 2020, 04:04   #25  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 570
There still seem to be unknowns in Dolby's IPTQc2 colorspace, if you're interested this mpv issue has good info: https://github.com/mpv-player/mpv/issues/7326
quietvoid is offline   Reply With Quote
Old 24th November 2020, 10:38   #26  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
Quote:
Originally Posted by quietvoid View Post
I'm not sure BT2020 primaries is meant to be played as profile 5 :P
They both play just fine on my device, otherwise.
But yes, the profile 5 only plays in Dolby Vision.
Both files display the Dolby Vision logo on my 2016 LG television...
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 24th November 2020, 12:42   #27  |  Link
ghostshadow
Registered User
 
Join Date: Jan 2020
Posts: 34
Quote:
Originally Posted by SeeMoreDigital View Post
Both files display the Dolby Vision logo on my 2016 LG television...
Hello SeeMoreDigital, your encodings are in mp4, have you tried in mkv?

thank you again to quietvoid after the hdr10 + it finds the solution of the dolby vision
ghostshadow is offline   Reply With Quote
Old 24th November 2020, 16:15   #28  |  Link
imhh11
Registered User
 
Join Date: Jul 2016
Posts: 171
Quote:
Originally Posted by ghostshadow View Post
Hello SeeMoreDigital, your encodings are in mp4, have you tried in mkv?

thank you again to quietvoid after the hdr10 + it finds the solution of the dolby vision
x265.exe produces raw HEVC stream. not an mp4 nor an mkv.

To create those samples, I encoded with x265.exe and then I used the mp4muxer to create a DV MP4. You could also use the nightly tsMuxer and make a TS file with Atmos and maybe you can try the yusesope tool (mkv patcher ?) but I have minimal experience with his tool.

Last edited by imhh11; 24th November 2020 at 16:18.
imhh11 is offline   Reply With Quote
Old 24th November 2020, 16:25   #29  |  Link
ghostshadow
Registered User
 
Join Date: Jan 2020
Posts: 34
Quote:
Originally Posted by imhh11 View Post
x265.exe produces raw HEVC stream. not an mp4 nor an mkv.

To create those samples, I encoded with x265.exe and then I used the mp4muxer to create a DV MP4. You could also use the nightly tsMuxer and make a TS file with Atmos and maybe you can try the yusesope tool (mkv patcher ?) but I have minimal experience with his tool.
no I encode in x265 and then with mkvtoolnix
ghostshadow is offline   Reply With Quote
Old 24th November 2020, 17:30   #30  |  Link
imhh11
Registered User
 
Join Date: Jul 2016
Posts: 171
Quote:
Originally Posted by ghostshadow View Post
no I encode in x265 and then with mkvtoolnix
someone correct me if I'm wrong but mkvtoolnix has been updated to support dual-layer profile 7 Dolby Vision remixing(only the file created by makemkv) and does not support single layer DV remuxing.

Last edited by imhh11; 24th November 2020 at 17:32.
imhh11 is offline   Reply With Quote
Old 24th November 2020, 21:31   #31  |  Link
ghostshadow
Registered User
 
Join Date: Jan 2020
Posts: 34
After you have to go back to Makemkv that's all
ghostshadow is offline   Reply With Quote
Old 24th November 2020, 21:59   #32  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
Quote:
Originally Posted by ghostshadow View Post
Hello SeeMoreDigital, your encodings are in mp4, have you tried in mkv?
Playing Dolby Vision HEVC encoded video streams placed within the .mkv container on an LG television is currently not possible because an entirely new .mkv file parser and splitter will have to be created first.

The same goes for any other SoC hardware playback device...
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |

Last edited by SeeMoreDigital; 24th November 2020 at 22:02.
SeeMoreDigital is offline   Reply With Quote
Old 24th November 2020, 23:33   #33  |  Link
imhh11
Registered User
 
Join Date: Jul 2016
Posts: 171
Quote:
Originally Posted by ghostshadow View Post
After you have to go back to Makemkv that's all
I'm curious, how do you do that? I know it works with dual layers files but I never heard of MakeMkv working with single-layer file
I just tried and the DV metadata are gone once the new MKV is created.
imhh11 is offline   Reply With Quote
Old 5th December 2020, 01:09   #34  |  Link
theweasley
Registered User
 
Join Date: Nov 2020
Posts: 3
Quote:
Originally Posted by quietvoid View Post
Posting in this thread as it's the oldest.

I made a first release of my tool: https://github.com/quietvoid/dovi_to.../tag/0.1.0-fix
It can be used to create an RPU file from a profile 5, 7 or 8 HEVC encoded file.

Commands:
demux: Demuxes single track dual layer Dolby Vision into Base layer and Enhancement layer files.
extract-rpu: Extracts Dolby Vision RPU from an HEVC encoded file.

More info in the README.
Enjoy.
Thank you this is a Great tool! Works really well. I've managed to successfully create a profile 8.1 x265 uncropped encode with it.

I have a quick question on cropping.

I'd like to crop the encode as well. Looking at these specific lines in vdr_dm_data.rs (https://github.com/quietvoid/dovi_to...a.rs#L309-L310)

Am I right to assume that the active area for DV can be altered here by hard coding it into the RPU / EL to get a properly cropped encode with DV? Been experimenting with it a bit and I'm having trouble figuring out how the values can be altered. Can I simply hardcode a custom offset here and if so what would be the correct way to input them?

Once again, thank you very much for the script. Works amazingly. And your insight would be most appreciated!
theweasley is offline   Reply With Quote
Old 5th December 2020, 01:12   #35  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 570
From what I understand, they are only necessary to tell the decoder how large the black bars are.
If you crop them off, it would probably be 0.
quietvoid is offline   Reply With Quote
Old 5th December 2020, 07:25   #36  |  Link
theweasley
Registered User
 
Join Date: Nov 2020
Posts: 3
Quote:
Originally Posted by quietvoid View Post
From what I understand, they are only necessary to tell the decoder how large the black bars are.
If you crop them off, it would probably be 0.
Oh I see that makes more sense. Thanks! I'll test and report back.

One more quick thing: I've noticed that if I build your script from the source (without changing anything in the code), the dovi parsing runs super slow with a simple ffmpeg stream copy to EL.hevc, like at 0.5x even. But when I use your prebuilt tool that you release on github, it's 10 times faster. I am probably building it wrong. I use cargo build on the src directory. Should I be doing something else?
theweasley is offline   Reply With Quote
Old 5th December 2020, 17:14   #37  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 570
You need to build with optimizations, usually "cargo build --release".
quietvoid is offline   Reply With Quote
Old 6th December 2020, 14:52   #38  |  Link
theweasley
Registered User
 
Join Date: Nov 2020
Posts: 3
Quote:
Originally Posted by quietvoid View Post
You need to build with optimizations, usually "cargo build --release".
Amazing! Both your suggestions worked. Setting it to 0 allowed me to create a cropped encode that works without issues and the optimized build fixed the slow EL extraction. Without your tool this wouldn't be possible! Thanks again
theweasley is offline   Reply With Quote
Old 30th March 2021, 11:10   #39  |  Link
telemO
Registered User
 
Join Date: Oct 2020
Location: France
Posts: 7
Quote:
Originally Posted by theweasley View Post
Amazing! Both your suggestions worked. Setting it to 0 allowed me to create a cropped encode that works without issues and the optimized build fixed the slow EL extraction. Without your tool this wouldn't be possible! Thanks again
Yes, quietvoid is the man !
He's developped this excellent and useful tool for the community, as well as the one to parse the HDR10+ metadata : so much for that.

@theweasley: I am very interesting to know how to transcode cropped version with the DoVi tool : are you changing the code of this DV tool? Or just inputing some extra parameters when parsing?
@quietvoid : Is it possible to transcode cropped video as well with your HDR10+ tool?

Thank you very much in advance for answering

Last edited by telemO; 30th March 2021 at 11:12.
telemO is offline   Reply With Quote
Old 30th March 2021, 14:38   #40  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 570
There's no simple way to use the tool for cropped video, you have to edit the code.

Also, using the RPU with x265 to transcode might end up with some desyncs due to the way x265 is inserting the metadata back.
Unfortunately I don't think there is a solution for that, other than inserting the metadata after transcoding.
See https://github.com/quietvoid/dovi_to...ment-803652617

Now those desyncs are not always visible in playback, but they're still there.

For HDR10+ the same desync issue is present. For cropped video, the metadata is supposedly resolution agnostic and hopefully the analysis is done on the active image area only.
So it should work in theory,

I'm curious to know how streaming services make use of x265's RPU insertion. There has to be some predicting the transcode's decoding order somehow, to make sure the RPU is synced throughout.
Though I've had artifacts with Dolby Vision on Netflix as well, so maybe they don't bother syncing either.
__________________
LG C2 OLED | GitHub Projects

Last edited by quietvoid; 30th March 2021 at 14:50.
quietvoid is offline   Reply With Quote
Reply

Tags
dolby vision, dovi, hdr, rpu, x265

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:11.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.