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. |
|
|
Thread Tools | Search this Thread | Display Modes |
16th June 2018, 21:32 | #1 | Link |
Registered User
Join Date: Jun 2009
Posts: 49
|
Convert HEVC 2160p 10 bits HLG to 2160p 8bits with HLG/HDR using ffmpeg
I have this World Cup sample in 4k HEVC 4:2:0 HLG 10bits and i want to convert it to 4k HEVC 8bits HLG/HDR using ffmpeg but maintaining the correct colors
https://transfer.pcloud.com/download...3TCb5VnyMDbagV I tried this that i found on another site, but the color results are horrible ffmpeg -i "d:\Descargas\NPO1 UHD.ts" -c:a copy -c:v libx265 -tag:v hvc1 -crf 22 -pix_fmt yuv420p10le -x265-params "colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc" "d:\Descargas\NPO1_UHD_mkv.mkv" Any help is appreciated... |
16th June 2018, 22:13 | #3 | Link | |
Registered User
Join Date: Jun 2009
Posts: 49
|
Quote:
ID : 511 (0x1FF) Menu ID : 20901 (0x51A5) Format : HEVC Format/Info : High Efficiency Video Coding Format profile : Main 10@L5.1@Main Codec ID : 36 Duration : 53 s 280 ms Bit rate : 24.4 Mb/s Width : 3 840 pixels Height : 2 160 pixels Display aspect ratio : 16:9 Frame rate : 50.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 10 bits Bits/(Pixel*Frame) : 0.059 Stream size : 155 MiB (93%) Encryption : TPS-Crypt or Viaccess Color range : Limited Color primaries : BT.2020 Transfer characteristics : HLG / BT.2020 (10-bit) Matrix coefficients : BT.2020 non-constant |
|
16th June 2018, 22:57 | #4 | Link |
Useful n00b
Join Date: Jul 2014
Posts: 1,666
|
Assuming that is MediaInfo output, I'll have to look into how it detects HLG (there is no metadata for HLG). It may just be 2020 UHD, as the "HLG / BT.2020" could be ambiguous with the "/" meaning "or" rather than "and". If I decode this as simple UHD, then it looks fine. Investigating...
|
16th June 2018, 23:11 | #5 | Link | |
Registered Developer
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,368
|
Quote:
HLG-encoded streams usually have one extra SEI message that tells the player that the stream is HLG, but if you ignore that SEI message then it would just look like ordinary BT.2020 SDR. For the OP, you should definitely not set the transfer to 2084 since thats not HLG but HDR10/PQ. I don't know if x265 can properly set the double transfer characteristics that HLG uses (ie. BT.2020 in main header, HLG in SEI header).
__________________
LAV Filters - open source ffmpeg based media splitter and decoders |
|
16th June 2018, 23:27 | #6 | Link | |
Registered User
Join Date: Jun 2009
Posts: 49
|
Quote:
|
|
17th June 2018, 02:15 | #8 | Link |
Useful n00b
Join Date: Jul 2014
Posts: 1,666
|
Found this:
HEVC HDR UHDTV Bitstreams using HLG10 shall also contain the alternative_transfer_characteristics SEI message. The alternative_transfer_characteristics SEI message shall be inserted on the HEVC DVB_RAP, and preferred_transfer_characteristics shall be set equal to “18”, indicating Recommendation ITU-R BT. 2100 [45] HLG system. |
17th June 2018, 02:30 | #9 | Link | |
Registered User
Join Date: Feb 2007
Posts: 18
|
I don't have a clue about HDR but in x265 docs there is this:
Quote:
|
|
17th June 2018, 03:25 | #11 | Link | |
Registered User
Join Date: Jun 2009
Posts: 49
|
Quote:
thanks |
|
17th June 2018, 15:15 | #14 | Link |
Useful n00b
Join Date: Jul 2014
Posts: 1,666
|
It's an Avisynth filter for converting HDR10 to SDR. It runs at 100fps+ for 2160p on a recent nVidia card. It also can run in software mode but is very slow that way. Don't look to download it right now as I have it in the shop for changes. Will be available again in a few days. I will also add the HLG SEI detection to DGDecNV.
|
17th June 2018, 17:29 | #15 | Link | |
Lost my old account :(
Join Date: Jul 2017
Posts: 341
|
Quote:
With that said, I cant see any reason for the 8bit transcode, that is out of the HLG specc. What should be done is to convert it to SDR, then transcode it. Last edited by excellentswordfight; 17th June 2018 at 17:38. |
|
17th June 2018, 18:19 | #16 | Link | |
Registered User
Join Date: Jun 2009
Posts: 49
|
Quote:
|
|
17th June 2018, 20:09 | #17 | Link | |
Lost my old account :(
Join Date: Jul 2017
Posts: 341
|
Quote:
When I looked at this the last time the options were limited and I ended up doing it with ffmpeg and a LUT with acceptable results (but definitely not great). Cant share the LUT though so cant help you with that unfortunately. Maybe someone else here know of another solution. I've seen some people doing the convert with just ffmpeg (without a lut), I guess that it would look something like this: Code:
"ffmpeg.exe" -i "input.ts" -vf zscale=tin=arib-std-b67:min=bt2020nc:pin=bt2020:rin=tv:t=arib-std-b67:m=bt2020nc:p=bt2020:r=tv,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p -an -c:v libx265 -preset slow -x265-params level=51:crf=22:keyint=500:min-keyint=50:rc-lookahead=50:bframes=8:no-sao=1:colorprim="bt709":transfer="bt709":colormatrix="bt709":range="limited" "out" Last edited by excellentswordfight; 17th June 2018 at 20:37. |
|
19th June 2018, 20:58 | #18 | Link | |
Registered User
Join Date: May 2004
Posts: 324
|
Quote:
I'm a little fuzzy when it comes to HLG, shouldn't the transfer be something other then BT.2020? HDR10 uses ST.2084, I would think HLG uses ARIB STD-B67. |
|
19th June 2018, 22:36 | #19 | Link |
Registered Developer
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,368
|
HLG uses a separate SEI element to indicate a secondary transfer function, which allows fallback to SDR with non-HLG aware players. So the main transfer function entry would be an SDR one, and the extra SEI element would indicate the HLG transfer. If your analyzer does not understand that separate SEI, then it would show as SDR.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders |
Tags |
10bits, 2160p, hevc |
Thread Tools | Search this Thread |
Display Modes | |
|
|