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)
Register FAQ Calendar Today's Posts Search

Closed Thread
 
Thread Tools Search this Thread Display Modes
Old 7th October 2015, 20:07   #1  |  Link
surami
Registered User
 
Join Date: May 2014
Location: Hungary
Posts: 64
Encoding 4K HDR 4:2:0 10bit BT.2020

I would like to make a test encoding to 4K, HDR, 4:2:0, 10bit, BT.2020, something like I found here (these are playing back properly on my TV), but if I use this line, then I get a video with strange yellowish, bluish colors:
Code:
avs4x26x-x64.exe -L "F:\x265\Win64_16bpp\x265.exe" --seek-mode safe --preset slow --subme 7 --no-open-gop --crf 17
--profile main10 --level-idc 5.1 --colorprim bt2020 --colormatrix bt2020nc --input-depth 8
--output "D:\encoding\x265_4k_420_10bit_bt2020.hevc" "signpost.avs"
pause
Should I have to write additonal commands too? --chromaloc --master-display --max-cll --min-luma --max-luma
or where is the problem?

I know, that I have 8bit input source, but this is just experimenting.

Last edited by surami; 14th October 2015 at 11:41.
surami is offline  
Old 7th October 2015, 20:41   #2  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
I assume your source is not really BT.2020? You need to convert the gamut to bt.2020 if you want the colors to be correct. The --colorprim and --colormatrix options set the information but do not covert. You are probably viewing BT.709 gamut video as if it was BT.2020 video so the colors are wrong.

I don't believe Avisynth's normal convert handles BT.2020 but Dither tools does.

This should work:

Dither_convert_yuv_to_rgb(matrix="709")
Dither_convert_rgb_to_yuv(matrix="2020")
__________________
madVR options explained
Asmodian is offline  
Old 7th October 2015, 22:44   #3  |  Link
surami
Registered User
 
Join Date: May 2014
Location: Hungary
Posts: 64
The main source is a RGB24 AVI file made by the Advanced FrameServer in After Effects.

In the AVS I have this:

Code:
AVISource("D:\rendering\signpost.avi", audio=false).AssumeFPS(25,1)

ConvertToYV12(matrix="Rec709")

Dither_convert_yuv_to_rgb(matrix="709")
Dither_convert_rgb_to_yuv(matrix="2020")
The situation is the same. On my PC with MPC-HC 1.7.9 it plays back with right colors, but on my TV not. So somewhere at the x265 file is the problem. I would like to generate files like we can find on the above mentioned site.

If I play those HDR files on my PC, the colors are wrong, they look like the mentioned problem with my x265 files on the TV, but if I play those files on TV, the colors are fine.

Last edited by surami; 7th October 2015 at 22:52.
surami is offline  
Old 7th October 2015, 23:05   #4  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
If you are already RGB all you need is:

Code:
AVISource("D:\rendering\signpost.avi", audio=false).AssumeFPS(25,1)

Dither_convert_rgb_to_yuv(matrix="2020")
Are you using madVR with MPC-HC? I believe madVR is required to respect gamut flags on the PC.

I wouldn't expect you to need any other flags set for your TV to understand BT.2020 but I am not sure.
__________________
madVR options explained
Asmodian is offline  
Old 8th October 2015, 10:26   #5  |  Link
surami
Registered User
 
Join Date: May 2014
Location: Hungary
Posts: 64
I'm using MPC-HC without madVR on my PC. In the morning I tried with madVR too, but there wasn't any difference.

I think there are some other flags that is necessary, because those HDR videos are runing fine on the USB port of the TV (Samsung UE40JU6000).
surami is offline  
Old 8th October 2015, 11:59   #6  |  Link
vivan
/人 ◕ ‿‿ ◕ 人\
 
Join Date: May 2011
Location: Russia
Posts: 643
When using madVR press Ctrl+J to display OSD - it will say what matrix it's using and why.
vivan is offline  
Old 8th October 2015, 13:30   #7  |  Link
surami
Registered User
 
Join Date: May 2014
Location: Hungary
Posts: 64
I did that, the video from the hdrsample.com is using BT.2020, but MediaInfo shows this info too.

The playback with clean MPC-HC install or using madVR renderer doesn't make any difference in colors.

I forgot to mention, that I also run my hevc file through MP4Box with the following command:
Code:
mp4box -add "output.hevc" -brand hev1 "output.mp4"
pause
I uploaded my own experiment file here, please test it.

Maybe the TV decoder gets extra info from somewhere or my encoding isn't valid for TV playback, I don't know.

Last edited by surami; 15th October 2015 at 20:06.
surami is offline  
Old 8th October 2015, 15:40   #8  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 706
I also make mistakes, but maybe something like this:
Code:
ffmpeg.exe -s 3840x2160 -r 25.000 -i "import.mp4" -an -sn -f rawvideo -pix_fmt yuv420p10le - | 
x264.10bpp.exe --demuxer raw --threads 4 --input-depth 10 --input-csp i420 --input-res 3840x2160 --output-csp i420 --keyint 25 --min-keyint 1 --bitrate 40000 --vbv-bufsize 120000 --vbv-maxrate 120000 --open-gop --fps 25.000 
--preset veryslow --tune stillimage --range tv --colormatrix bt2020nc --colorprim bt2020 --transfer bt2020-10 - --output "output_x264.h264"

x265.10bpp.exe                           --input-depth 10 --input-csp i420 --input-res 3840x2160 --output-depth 10 --keyint 25 --min-keyint 1 --bitrate 40000 --vbv-bufsize 120000 --vbv-maxrate 120000 --open-gop --fps 25.000 
--preset slow                       --range limited --colormatrix bt2020nc --colorprim bt2020 --transfer bt2020-10 - --output "output_x265.h265"

vpxenc.exe -v --threads=4 --bit-depth=10 --input-bit-depth=10       --i420 -w 3840 -h 2160                    --kf-max-dist=25 --kf-min-dist=0 --target-bitrate=40000 --drop-frame=0 --fps=25000/1000 
--good --profile=3 --codec=vp9 --passes=1 --pass=1 --cpu-used=3 --color-space=bt2020 --aq-mode=1 - -o "vp90_422p10le.webm"
MP4Box doesn't use to files 10bit!
ffmpeg.exe -s 3840x2160 -r 25.000 -i "output_x264/x265.h264/h265" -i audio.aac -i subtitle.srt -f mp4 -c copy -movflags faststart -pix_fmt yuv420p10le "output.mp4"

Last edited by Jamaika; 8th October 2015 at 16:29.
Jamaika is offline  
Old 8th October 2015, 17:33   #9  |  Link
surami
Registered User
 
Join Date: May 2014
Location: Hungary
Posts: 64
I found an interesting discussion about HDR from #4174, so I thought right, we need --master-display and --transfer commands too.

Last edited by surami; 8th October 2015 at 17:49.
surami is offline  
Old 8th October 2015, 22:36   #10  |  Link
CruNcher
Registered User
 
CruNcher's Avatar
 
Join Date: Apr 2002
Location: Germany
Posts: 4,926
I see no strange colors or do you mean by that the Dynamic Range representation of the output result on the Target 10 bit ? Monitor itself ?

10->8bit


__________________
all my compares are riddles so please try to decipher them yourselves :)

It is about Time

Join the Revolution NOW before it is to Late !

http://forum.doom9.org/showthread.php?t=168004

Last edited by CruNcher; 8th October 2015 at 23:03.
CruNcher is offline  
Old 8th October 2015, 23:13   #11  |  Link
surami
Registered User
 
Join Date: May 2014
Location: Hungary
Posts: 64
Quote:
MP4Box doesn't use to files 10bit!
I'm just using that for writing right meta info, I think my command doesn't make any other changes.

Quote:
I see no strange colors or do you mean by that the Dynamic Range representation of the output result on the Target 10 bit ? Monitor itself ?
On my PC it looks right, as the source, I see the same good looking video on my display as you. The TV playback isn't fine, it's weird flat yellowish, bluish. Try the movies by downloading the samples from here, you will see weird flat movie (the same movie looks fine on my TV) and read the above mentioned forum too, there are infos to understand things.

Last edited by surami; 8th October 2015 at 23:20.
surami is offline  
Old 8th October 2015, 23:31   #12  |  Link
CruNcher
Registered User
 
CruNcher's Avatar
 
Join Date: Apr 2002
Location: Germany
Posts: 4,926
Interesting they gain some dynamics with Samsungs Magic Bright Cinema Preset

Very big difference though unusable for Desktop usage (kills the eyes)

http://www.samsung.com/sg/support/skp/htg/17189

biggest impact i see especially on the skin representation

Sharper ,Colder and more Contrast is how it looks

Wow i could further improve the output result these samples are perfect for tweaking
__________________
all my compares are riddles so please try to decipher them yourselves :)

It is about Time

Join the Revolution NOW before it is to Late !

http://forum.doom9.org/showthread.php?t=168004

Last edited by CruNcher; 9th October 2015 at 00:23.
CruNcher is offline  
Old 9th October 2015, 01:07   #13  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 706
Quote:
Originally Posted by surami View Post
I'm just using that for writing right meta info, I think my command doesn't make any other changes.
The display color matrix isn't affected. I have a problem with scrolling.
Jamaika is offline  
Old 9th October 2015, 10:42   #14  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
Quote:
Originally Posted by surami View Post
I'm just using that for writing right meta info, I think my command doesn't make any other changes.


On my PC it looks right, as the source, I see the same good looking video on my display as you. The TV playback isn't fine, it's weird flat yellowish, bluish. Try the movies by downloading the samples from here, you will see weird flat movie (the same movie looks fine on my TV) and read the above mentioned forum too, there are infos to understand things.
The TV has to understand BT.2020 as well, if it's going to play the files. Are you sure it does? Otherwise it's probably just interpreting it as BT.709.
foxyshadis is offline  
Old 9th October 2015, 11:42   #15  |  Link
surami
Registered User
 
Join Date: May 2014
Location: Hungary
Posts: 64
Well I think it understands BT.2020, because the downloadable HDR samples are playing fine on my TV.

Update: Ohh I'm starting to get something in my head? If the TV understands BT.2020 then it plays the video as HDR and if it doesn't understands it plays as BT.709 LDR or how is this?

I found info about the HDR video provided by the FOX.

Last edited by surami; 9th October 2015 at 12:19.
surami is offline  
Old 9th October 2015, 12:07   #16  |  Link
surami
Registered User
 
Join Date: May 2014
Location: Hungary
Posts: 64
My source is BT.709, so that's why the encoded BT.2020 flagged HEVC video gives strange colors on TV and it plays fine on PC?

Last edited by surami; 9th October 2015 at 12:11.
surami is offline  
Old 9th October 2015, 17:45   #17  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
Quote:
Originally Posted by surami View Post
My source is BT.709, so that's why the encoded BT.2020 flagged HEVC video gives strange colors on TV and it plays fine on PC?
If you used the conversion in AviSynth your source is no longer BT.709. That is why you need the conversion.

Dither_convert_rgb_to_yuv(matrix="2020")

There may be something else for HDR than simply using the BT.2020 matrix?
__________________
madVR options explained
Asmodian is offline  
Old 9th October 2015, 17:52   #18  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 706
This is due to two variants standards High Dynamic Range UltraBluray. The above I described unknowingly SDR. The problem is that how many standards HDR. Is for any brand of TV is different SMPTE. Is this variant we use the function --range.
http://www.ip.philips.com/data/downl...hite_paper.pdf
For Panasonic, I see that it is recommended encoding of the HDR video the ST 2084 EOTF.

Last edited by Jamaika; 10th October 2015 at 09:55.
Jamaika is offline  
Old 9th October 2015, 19:15   #19  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,770
Quote:
Originally Posted by Asmodian View Post
If you used the conversion in AviSynth your source is no longer BT.709. That is why you need the conversion.

Dither_convert_rgb_to_yuv(matrix="2020")

There may be something else for HDR than simply using the BT.2020 matrix?
Correct. While TVs should be able to play 2020 content in some fashion, the size of the luma range and gamut are so huge that good tone mapping isn't technically practical, as possible luma and chroma values are so far out of what even the best consumer TVs today support.

The "HDR-10" format which is what everyone is using for actual HDR content on real displays uses the PQ Curve (SMPTE 2084) instead of gamma to map luma codes to actual brightness.

That uses --transfer 16 smpte-st-2084.

Gamma has been baked into our assumptions about video for, what 70 years now? So pretty much no tool has much of an idea for how to handle a polynominal mapping between Y' and actual display brightness. Processing needs to be done in linear light, and even tools like After Effects don't have the ability to export from their internal linear light space to PQ, and I'm told the existing icm/icc file format can't even describe the transform adequately.

Very few tools actually support converting to and from that color space today, and nothing that's FOSS I'm aware of. It's more like the colorists use a special display configured to provide that format, and then do a separate color grade based on that. It's not something that is done automatically; instead it as a re-grade from HDR source content, using various RAW-like formats that high-end digital cinema cameras can record.

Master-display and max-cll are optional metadata. You'd need to know what nominal display you are doing your conversion to HDR to know what those values are supposed to be, since real TVs don't support 100% of rec2020 (10K nits, huge color gamut). In practice most are targeting 1000 nits and the P3 color space used in digital cinema.

It's awesome that you're trying to do this, and I won't try to dissuade you by telling you any more about how incredibly hard it is to do in 2015.

I've done more HDR encoding than probably anyone else on the planet, and I wouldn't even know how to start in trying to personally convert and existing consumer HDR image or video to consumer HDR-10.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline  
Old 9th October 2015, 20:16   #20  |  Link
CruNcher
Registered User
 
CruNcher's Avatar
 
Join Date: Apr 2002
Location: Germany
Posts: 4,926
Interesting this old Samsung PLS Panel can actually drive this in the Samples not bad i never saw the Cinema Preset so expanding the quality on DVD content or stuff before then the impact it has on these Ateme 4K HDR Encoded Film Samples

I would say it's a decent Tone Mapping result also though i don't know the Pro Hardware result you use of course but Samsung Consumer stuff allways fascinates me here once again
__________________
all my compares are riddles so please try to decipher them yourselves :)

It is about Time

Join the Revolution NOW before it is to Late !

http://forum.doom9.org/showthread.php?t=168004

Last edited by CruNcher; 9th October 2015 at 20:23.
CruNcher is offline  
Closed Thread


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 14:20.


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