Opened 6 years ago

Last modified 3 years ago

#7624 open enhancement

Support IPTPQc2 with chroma reshaping in Dolby Vision samples

Reported by: Carl Eugen Hoyos Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: hevc hdr
Cc: Elliott Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

The Dolby Vision samples show strange colours:
https://4kmedia.org/lg-amaze-dolby-vision-uhd-4k-demo/

$ ffmpeg -i LG\ Amaze\ Dolby\ Vision\ UHD\ 4K\ Demo.ts -qscale 2 out.avi
ffmpeg version N-92729-ga1f0dd2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.4.0 (GCC)
  configuration: --enable-gpl --enable-libxml2 --enable-gnutls --enable-gmp --enable-version3 --enable-libx264
  libavutil      56. 24.101 / 56. 24.101
  libavcodec     58. 42.102 / 58. 42.102
  libavformat    58. 24.101 / 58. 24.101
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 46.101 /  7. 46.101
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[hevc @ 0x283a800] Skipping NAL unit 62
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'LG Amaze Dolby Vision UHD 4K Demo.ts':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42dby1isom
    creation_time   : 2017-04-13T20:09:18.000000Z
  Duration: 00:00:56.20, start: 0.000000, bitrate: 28362 kb/s
    Stream #0:0(und): Video: hevc (Main 10) (dvhe / 0x65687664), yuv420p10le(tv), 3840x2160 [SAR 1:1 DAR 16:9], 27713 kb/s, 60 fps, 60 tbr, 60k tbn, 60 tbc (default)
    Metadata:
      creation_time   : 2017-04-13T20:09:18.000000Z
      handler_name    : video handler
      encoder         : DOVI Coding
    Stream #0:1(und): Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
    Metadata:
      creation_time   : 2017-04-13T20:09:18.000000Z
      handler_name    : sound handler
    Side data:
      audio service type: main
Please use -q:a or -q:v, -qscale is ambiguous
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> mpeg4 (native))
  Stream #0:1 -> #0:1 (eac3 (native) -> ac3 (native))
Press [q] to stop, [?] for help
[hevc @ 0x286df00] Skipping NAL unit 62
[hevc @ 0x2868100] Skipping NAL unit 62
[hevc @ 0x287d0c0] Skipping NAL unit 62
[hevc @ 0x28cdf80] Skipping NAL unit 62
[hevc @ 0x28de740] Skipping NAL unit 62
[hevc @ 0x2945bc0] Skipping NAL unit 62
[hevc @ 0x29562c0] Skipping NAL unit 62
[hevc @ 0x2977440] Skipping NAL unit 62
[hevc @ 0x2966ac0] Skipping NAL unit 62
[hevc @ 0x286df00] Skipping NAL unit 62
[hevc @ 0x2868100] Skipping NAL unit 62
Output #0, avi, to 'out.avi':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42dby1isom
    ISFT            : Lavf58.24.101
    Stream #0:0(und): Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc (default)
    Metadata:
      creation_time   : 2017-04-13T20:09:18.000000Z
      handler_name    : video handler
      encoder         : Lavc58.42.102 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      creation_time   : 2017-04-13T20:09:18.000000Z
      handler_name    : sound handler
      encoder         : Lavc58.42.102 ac3
    Side data:
      audio service type: main
[hevc @ 0x287d0c0] Skipping NAL unit 62
[hevc @ 0x28cdf80] Skipping NAL unit 62

...

[hevc @ 0x28de740] Skipping NAL unit 62
[hevc @ 0x2945bc0] Skipping NAL unit 62
frame= 3372 fps= 31 q=2.0 Lsize= 1769927kB time=00:00:56.20 bitrate=257993.6kbits/s speed=0.51x
video:1766724kB audio:3073kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.007307%

Attachments (1)

Color Bars BT2020 50%_Blue Filter_Dolby_Vision.rar (302.1 KB ) - added by Balling 5 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by jeeb, 6 years ago

The colorspace is supposed to be Dolby's skewed ICtCp + BT.2020 + PQ.

This is why I noted that adding the identifiers lets you demux and decode, but not present.

comment:2 by Balling, 5 years ago

Status: newopen

See https://github.com/sekrit-twc/zimg/issues/69#issuecomment-552184393
I suppose we just wrongly think it is BT.2020 color. (Or maybe ITP color of Dolby is a little bit different from that of BT.2100 ICtCp.)

Last edited 5 years ago by Balling (previous) (diff)

comment:3 by Balling, 5 years ago

I just wanted to add another example (besides https://drive.google.com/file/d/1aP276spsqW-EbIIVrzdI9mwTYO87d0ac/view?usp=sharing) which is simpler and which though should be right!
I also added issue https://github.com/sekrit-twc/zimg/issues/117 so maybe this will be finally solved and we will be more close to whole HDR10+ / Dolby Vision / Dolby Atmos decoding!

comment:4 by Balling, 5 years ago

Summary: Improve colours in Dolby Vision samplesSupport IPTPQc2 with chroma reshaping in Dolby Vision samples

So, yes, here is the name of it and, to all reverse engineers, here is an appx of Windows 10 that can HW decode (at least with nvidia nvdec) and correctly present IPTPQc2 color! Update that to new version in Microsoft Store.
https://drive.google.com/file/d/1MCtZHrmPcIBwh7GjoRxVpp6VR7GvbyEY/view

And here is a new version (you cannot install it though) https://drive.google.com/file/d/1QjpcbX2owljh8Wb_XYgx2LhOm1qk7NTc/view?usp=sharing

https://www.microsoft.com/en-us/p/app/9pltg1lwphlf?irgwc=1&OCID=AID2000142_aff_7805_2806082&tduid=(ir__qw3q0g3mbnuvtlifmqxenxsf6v2xn2h61e9se90q00)(7805)(2806082)()()&irclickid=_qw3q0g3mbnuvtlifmqxenxsf6v2xn2h61e9se90q00

Open using Microsoft Movies&TV

Last edited 5 years ago by Balling (previous) (diff)

comment:5 by Carl Eugen Hoyos, 4 years ago

Keywords: hdr added

comment:6 by Balling, 4 years ago

So further comment here: profile 5 is only using IPTPQc2 if it is not marked as HDR10 compatible (see Mediainfo), in that case it uses limited and not full range. We do not, AFAIK, yet print that data (or print compatibility ID wrongly). For example these Apple 4K profile 5 videos are not IPTPQc2.
https://docs.google.com/spreadsheets/d/1bboTohF06r-fafrImTExAPqM9m6h2m2lgJyAkQuYVJI/edit

Also mandatory full range IPTPQc2 does use Y' of 1 for pure black, as can be checked by

ffplay -i file -vf extractplanes=y

There is also now Avengers Endgame from Display+ available with IPTPQc2 on torrents with very high bitrate.

comment:7 by Elliott, 4 years ago

Cc: Elliott added

comment:8 by Balling, 3 years ago

It is now properly supported by decoding to PQ swapchain in libplacebo in mpv player using ffmpeg dovi parser. Can be closed unless you want to ffplay implement it? For HDR displays: mpv.com --target-trc=pq --target-prim=bt.2020 --vo=gpu-next --gpu-context=d3d11 file.mp4/mkv/ts for SDR gamma 2.2 display: mpv.com --target-trc=gamma2.2 --target-prim=bt.709 --vo=gpu-next --gpu-context=d3d11 file.mp4/mkv/ts

Build is here https://github.com/zhongfly/mpv-winbuild/releases/download/2022-02-03/mpv-x86_64-20220203-git-ddef9eb.7z

Note: See TracTickets for help on using tickets.