Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Jul 2024 17:07:46 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 280208] multimedia/x265: Fix HDR10+ support [PATCH]
Message-ID:  <bug-280208-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D280208

            Bug ID: 280208
           Summary: multimedia/x265: Fix HDR10+ support [PATCH]
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: olli@FreeBSD.org

Created attachment 251953
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D251953&action=
=3Dedit
HDR10+ JSON file for testing. Save as "dummy.json".

Currently, the FreeBSD build of multimedia/x265 (version 3.5_1) fails to
include HDR10+ (a.k.a. HDR10plus or "dynamic HDR") support. It only includes
HDR10 support (without "plus", sometimes referred to as "static HDR").

That problem also affects the ffmpeg port because it uses the x265 port for
encoding. And that, in turn, affects many other ports that use ffmpeg or its
library for encoding. In other words, the problem renders several ports una=
ble
to produce HDR10+ video content.

How to reproduce (short):

The simplest way to check for the problem is this:

Command:  strings -a /usr/local/lib/libx265.so | grep HDR10_PLUS
Output:  --dhdr10-info disabled. Enable HDR10_PLUS in cmake.

That string shown in the output is only included in the library if support =
for
HDR10_PLUS was *not* enabled at build time.  See the file
source/encoder/encoder.cpp in the x265 distribution for details.  It contai=
ns
the conditionally compiled code responsible for that.

How to reproduce (long):

The following ffmpeg command line will demonstrate the problem. It is suppo=
sed
to generate 1 second of black frames with HDR10+ data. In order for it to w=
ork,
you need to store the JSON file attached to this PR with the file name
"dummy.json".  Be sure that the JSON data doesn't get damaged.  If it doesn=
't
parse as proper JSON, ffmpeg will simply coredump.

Command (all on one line):  ffmpeg -hide_banner -loglevel warning -t 1 -f l=
avfi
-i "color=3Dc=3Dblack:s=3D1280x720" -pix_fmt yuv420p10le -r 25 -c:V:0 libx2=
65
-x265-params
"log-level=3Dwarning:hdr10=3D1:hdr10-opt=3D1:colorprim=3Dbt2020:transfer=3D=
smpte2084:colormatrix=3Dbt2020nc:repeat-headers=3D1:dhdr10-info=3Ddummy.jso=
n"
-preset fast test.mkv

It will print the following warning:
x265 [warning] --dhdr10-info disabled. Enable HDR10_PLUS in cmake.

The resulting video file only contains static HDR10, not dynamic HDR10+. You
can check with the multimedia/mediainfo port:

Command:  mediainfo test.mkv | grep HDR
Output:  HDR format : SMPTE ST 2086, HDR10 compatible

How to fix:

Put the the follwing patch in the "files" directory of the multimedia/x265 =
port
(suggested name "patch-HDR10_PLUS":


--- source/CMakeLists.txt.ORIG  2023-08-24 13:11:18.000000000 +0200
+++ source/CMakeLists.txt       2024-07-05 20:45:28.571155000 +0200
@@ -196,7 +196,7 @@
     add_definitions(-qinline=3Dlevel=3D10 -qpath=3DIL:/data/video_files/la=
test.tpo/)
 endif()
 # this option is to enable the inclusion of dynamic HDR10 library to the
libx265 compilation
-option(ENABLE_HDR10_PLUS "Enable dynamic HDR10 compilation" OFF)
+option(ENABLE_HDR10_PLUS "Enable dynamic HDR10 compilation" ON)
 if(MSVC AND (MSVC_VERSION LESS 1800) AND ENABLE_HDR10_PLUS)
     message(FATAL_ERROR "MSVC version 12.0 or above required to support
hdr10plus")
 endif()


Then rebuild and install the port.

Afterwards, the above mentioned strings(1) command produces empty output. T=
hat
means, the warning message is not in the library anymore because the HDR10+
support has been compiled in correctly.

When you repeat the above ffmpeg command (remove the old test.mkv file firs=
t),
the resulting file contains proper HR10+ meta data. The check with the
mediainfo command now gives this output:

HDR format : SMPTE ST 2094 App 4, Version 1, HDR10+ Profile A compatible

Hooray, we can now create dynamic HDR10+ video content!

--- Comment #1 from Bugzilla Automation <bugzilla@FreeBSD.org> ---
Maintainer informed via mail

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-280208-7788>