HandBrake icon indicating copy to clipboard operation
HandBrake copied to clipboard

HDR10 metadata can be added to unsupported codecs

Open Nomis101 opened this issue 5 years ago • 2 comments

Problem description:

I'm not quite sure, which codecs are actually supported to contain HDR10 metadata, but I think MPEG2 and Theora are not among them. So, I suppose it should not be possible to add HDR10 metadata to this codecs, but HandBrake currently will do so. If you open a movie that contains HDR10 metadata and convert the video stream to MPEG2 or Theora, HandBrake will add the HDR10 metadata. The resulting video can be played with VLC, but for sure, the colors are completely strange. This can only be switched off, if you actively switch the colorspace to BT.709 in the filter tab.

HandBrake version (e.g., 1.3.0):

Version 20210301081311-3235f6350-master (2021030101)

Operating system and version (e.g., Ubuntu 19.10, macOS 10.15 Catalina, Windows 10 1909):

macOS Big Sur

Error message text and/or screenshot:

Please provide any error messages or screenshots that may help.

HandBrake Activity Log:

An Activity Log is required for support. Please read https://handbrake.fr/docs/en/latest/help/activity-log.html for more information.

[21:54:49] macgui: Handbrake Version: 20210301081311-3235f6350-master (2021030101)
[21:54:49] hb_init: starting libhb thread
[21:57:00] macgui: ScanCore scanning titles with a duration of 10 seconds or more
[21:57:00] CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
[21:57:00]  - Intel microarchitecture Kaby Lake
[21:57:00]  - logical processor count: 16
[21:57:00] hb_scan: path=/Users/Nomis101/Movies/The Last Jedi short.mkv, title_index=0
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:323: failed opening UDF image /Users/Nomis101/Movies/The Last Jedi short.mkv
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
bluray.c:2585: nav_get_title_list(/Users/Nomis101/Movies/The Last Jedi short.mkv/) failed
[21:57:00] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.1
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[21:57:00] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from '/Users/Nomis101/Movies/The Last Jedi short.mkv':
  Metadata:
    title           : The Last Jedi
    ENCODER         : Lavf58.67.100
  Duration: 00:01:00.69, start: 0.000000, bitrate: 44960 kb/s
    Chapter #0:0: start 0.000000, end 60.000000
    Metadata:
      title           : Chapter 51
    Stream #0:0(eng): Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Metadata:
      BPS-eng         : 45985293
      DURATION-eng    : 02:31:51.685916666
      NUMBER_OF_FRAMES-eng: 218462
      NUMBER_OF_BYTES-eng: 52375438139
      SOURCE_ID-eng   : 001011
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.15.4 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-02-07 11:43:58
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      DURATION        : 00:01:00.685000000
    Stream #0:1(deu): Audio: eac3, 48000 Hz, 7.1, fltp, 896 kb/s (default)
    Metadata:
      title           : Surround 7.1
      BPS-eng         : 896000
      DURATION-eng    : 02:31:51.712000000
      NUMBER_OF_FRAMES-eng: 284741
      NUMBER_OF_BYTES-eng: 1020511744
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.15.4 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-02-07 11:43:58
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      DURATION        : 00:01:00.447000000
[21:57:00] scan: decoding previews for title 1
[21:57:00] scan: audio 0x1: eac3, rate=48000Hz, bitrate=896000 Deutsch (E-AC3) (7.1 ch) (896 kbps)
[21:57:20] scan: 45 previews, 3840x2160, 23.976 fps, autocrop = 276/276/0/2, aspect 16:9, PAR 1:1, color profile: 9-16-9
[21:57:20] scan: mastering display metadata: r(0.6800,0.3200) g(0.2650,0.6900) b(0.1500 0.0600) wp(0.3127, 0.3290) min_luminance=0.002000, max_luminance=1000.000000
[21:57:20] libhb: scan thread found 1 valid title(s)
[21:57:20] macgui: ScanCore scan done
[21:57:55] Compile-time hardening features are enabled
[21:57:55] hb_init: starting libhb thread
[21:57:55] macgui: fr.handbrake.HandBrakeXPCService scanning specifically for title: 1
[21:57:55] CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
[21:57:55]  - Intel microarchitecture Kaby Lake
[21:57:55]  - logical processor count: 16
[21:57:55] hb_scan: path=/Users/Nomis101/Movies/The Last Jedi short.mkv, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:323: failed opening UDF image /Users/Nomis101/Movies/The Last Jedi short.mkv
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
bluray.c:2585: nav_get_title_list(/Users/Nomis101/Movies/The Last Jedi short.mkv/) failed
[21:57:55] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.1
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[21:57:55] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from '/Users/Nomis101/Movies/The Last Jedi short.mkv':
  Metadata:
    title           : The Last Jedi
    ENCODER         : Lavf58.67.100
  Duration: 00:01:00.69, start: 0.000000, bitrate: 44960 kb/s
    Chapter #0:0: start 0.000000, end 60.000000
    Metadata:
      title           : Chapter 51
    Stream #0:0(eng): Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Metadata:
      BPS-eng         : 45985293
      DURATION-eng    : 02:31:51.685916666
      NUMBER_OF_FRAMES-eng: 218462
      NUMBER_OF_BYTES-eng: 52375438139
      SOURCE_ID-eng   : 001011
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.15.4 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-02-07 11:43:58
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      DURATION        : 00:01:00.685000000
    Stream #0:1(deu): Audio: eac3, 48000 Hz, 7.1, fltp, 896 kb/s (default)
    Metadata:
      title           : Surround 7.1
      BPS-eng         : 896000
      DURATION-eng    : 02:31:51.712000000
      NUMBER_OF_FRAMES-eng: 284741
      NUMBER_OF_BYTES-eng: 1020511744
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.15.4 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-02-07 11:43:58
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      DURATION        : 00:01:00.447000000
[21:57:55] scan: decoding previews for title 1
[21:57:55] scan: audio 0x1: eac3, rate=48000Hz, bitrate=896000 Deutsch (E-AC3) (7.1 ch) (896 kbps)
[21:58:00] scan: 10 previews, 3840x2160, 23.976 fps, autocrop = 276/276/0/2, aspect 16:9, PAR 1:1, color profile: 9-16-9
[21:58:00] scan: mastering display metadata: r(0.6800,0.3200) g(0.2650,0.6900) b(0.1500 0.0600) wp(0.3127, 0.3290) min_luminance=0.002000, max_luminance=1000.000000
[21:58:00] libhb: scan thread found 1 valid title(s)
[21:58:00] macgui: fr.handbrake.HandBrakeXPCService scan done
[21:58:00] macgui: fr.handbrake.HandBrakeXPCService started encoding The Last Jedi short.mkv
[21:58:00] macgui: fr.handbrake.HandBrakeXPCService with preset Nomis101 - 4k HDR10 Spielfilme H.265 (Modifiziert)
[21:58:00] Starting work at: Mon Mar  1 21:58:00 2021

[21:58:00] 1 job(s) to process
[21:58:00] Starting Task: Encoding Pass
[21:58:00] Skipping vfr filter
[21:58:00] job configuration:
[21:58:00]  * source
[21:58:00]    + /Users/Nomis101/Movies/The Last Jedi short.mkv
[21:58:00]    + title 1, chapter(s) 1 to 1
[21:58:00]    + container: matroska,webm
[21:58:00]    + data rate: 44960 kbps
[21:58:00]  * destination
[21:58:00]    + /Volumes/Macintosh HD 3/The Last Jedi short.mkv
[21:58:00]    + container: Matroska (libavformat)
[21:58:00]  * video track
[21:58:00]    + decoder: hevc 8-bit
[21:58:00]    + filters
[21:58:00]      + Crop and Scale (width=3838:height=1608:crop-top=276:crop-bottom=276:crop-left=0:crop-right=2)
[21:58:00]        + source: 3840 * 2160, crop (276/276/0/2): 3838 * 1608, scale: 3838 * 1608
[21:58:00]    + Output geometry
[21:58:00]      + storage dimensions: 3838 x 1608
[21:58:00]      + pixel aspect ratio: 1 : 1
[21:58:00]      + display dimensions: 3838 x 1608
[21:58:00]    + encoder: Theora (libtheora)
[21:58:00]      + quality: 20.00 (QP)
[21:58:00]      + color profile: 9-16-9
[21:58:00]      + mastering display metadata: r(0.6800,0.3200) g(0.2650,0.6900) b(0.1500 0.0600) wp(0.3127, 0.3290) min_luminance=0.002000, max_luminance=1000.000000
[21:58:00]  * audio track 1
[21:58:00]    + name: Surround 7.1
[21:58:00]    + decoder: Deutsch (E-AC3) (7.1 ch) (896 kbps) (track 1, id 0x1)
[21:58:00]      + bitrate: 896 kbps, samplerate: 48000 Hz
[21:58:00]    + E-AC3 Passthru
[21:58:00] sync: expecting 1454 video frames
[21:58:00] theora: keyint: 244
[21:58:00] theora: Could not set soft ratecontrol
[21:58:01] sync: first pts video is 0
[21:58:01] sync: "Chapter 1" (1) at frame 1 time 0
[21:58:01] sync: first pts audio 0x1 is 2790
[22:03:33] reader: done. 1 scr changes
[22:03:53] work: average encoding speed for job is 4.174932 fps
[22:03:53] eac3-decoder done: 1888 frames, 0 decoder errors
[22:03:53] hevc-decoder done: 1453 frames, 0 decoder errors
[22:03:53] sync: got 1453 frames, 1454 expected
[22:03:53] sync: framerate min 11.905 fps, max 23.976 fps, avg 23.943 fps
[22:03:54] mux: track 0, 1453 frames, 15671579 bytes, 2064.52 kbps, fifo 1024
[22:03:54] mux: track 1, 1888 frames, 6766592 bytes, 891.41 kbps, fifo 2048
[22:03:54] Finished work at: Mon Mar  1 22:03:54 2021

[22:03:54] libhb: work result = 0
[22:03:54] macgui: Queue Done, there are no more pending encodes
[22:03:54] macgui: fr.handbrake.HandBrakeXPCService work done

Nomis101 avatar Mar 01 '21 22:03 Nomis101

The metadata is added at the container level. Even if it's unusual and untested, a player should handle it gracefully, because the color space and HDR10 info are applied after the video has been decoded, and are independent of the video format.

The other solution is to map which color space is officially supported by each codec (if there is such list for Theora and mpeg-2) and add automatically the color space filter.

galad87 avatar Mar 02 '21 07:03 galad87

There anything for us to action here @galad87 ?

sr55 avatar Oct 02 '22 19:10 sr55