Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDR shown in GUI but not working (flatpak currently built with GL renderer) #248

Open
arigit opened this issue May 1, 2024 · 17 comments
Open

Comments

@arigit
Copy link

arigit commented May 1, 2024

Running the kodi flatpak in GBM mode, on Intel N100 hardware, Samsung HDR-capable TV, latest flatpak (Kodi 21/Omega)
In Settings > Information > Video, Kodi correctly detects that the TV supports HDR10 and HLG.
In Settings > Media Player > Video, the HDR toggle is shown and HDR is enabled in my setup.

Kodi is also able to detect the HDR codec correctly in my HDR test videos.

When an HDR10 video is played back, Kodi does not attempt to switch on HDR mode in the TV and the TV shows it's in SDR mode. After a somewhat lengthy troubleshooting (trying things in the TV, changing the HDMI cable etc) I realized that the flatpak is using GL rendered instead of GLES, since the log shows entries such as:

: CLinuxRendererGL::UpdateVideoFilter

Ask to maintainers: is it possible to create a beta flatpak build with GLES as renderer instead of GL? (or just switch to GLES)? So that we can test HDR and help stabilize the GLES renderer

@razzeee
Copy link
Member

razzeee commented May 1, 2024

There is -DAPP_RENDER_SYSTEM="gles" (or "gl") which can only be set at build time

@arigit
Copy link
Author

arigit commented May 1, 2024

Thanks @razzeee , rebuilding the flatpak with GLES enabled.
Will share results.

Recipe:

Kodi GLES (HDR support): Flatpak Build

cd ~./kodi-build
git clone https://github.com/flathub/tv.kodi.Kodi
cd tv.kodi.Kodi
vim tv.kodi.Kodi.yml   # change the kodi RENDER_SYSTEM from "gl" to "gles"
mkdir build
sudo flatpak-builder ./build --install-deps-from=flathub --ccache --force-clean tv.kodi.Kodi
flatpak build-export export build
flatpak build-bundle export kodi-gles.flatpak tv.kodi.Kodi

sudo systemctl stop kodi
sudo flatpak uninstall tv.kodi.Kodi  # this preserves the data in the .var folders of the different users
sudo flatpak install kodi-gles.flatpak
sudo systemctl start kodi

@arigit
Copy link
Author

arigit commented May 3, 2024

The flatpak rebuild with GLES enabled worked - the flatpak is now able to play all the test videos in my samsung TV (HDR10/HDR10+/HLG capable). For the first time ever I can see the TV switching to HDR mode and proper display of colors.

I could test this with multiple clips and content. Not sure why but HDR10+ content seems to work, at least it triggers HDR mode in the TV and the color saturation/contrast looks good. I read that kodi/ffmpeg is does not yet support dynamic hdr metadata so not sure why this seems to work.

Tested this build quite extensively with normal 'family' use cases and all looks very solid, no crashes whatsoever.

The only caveat I found is that the youtube addon does not seem to be able to play HDR content (this was the same in the GL build though), the TV switches to HDR mode (I can see that in the GUI color saturation change) but only audio is played. Could be my setup.

I'd suggest considering setting up a branch or alternate version in flathub with GLES so people can test it as this is the only way to get HDR working. I understand that GLES was adopted by libreelec, also used by android etc, so guaranteed support going forward on GLES.

@jacen05
Copy link

jacen05 commented Aug 19, 2024

Thanks @arigit for this recipe!
I'm also on N100 but I had a little modification to do.

When following the exact instructions, I got HDR working (related setting available in Kodi, TV displaying HDR logo, and visual enhancement of picture quality), however I lost hardware decoding (no longer able to use VAAPI from what I understand), so 4K@60FPS was really laggy.

I needed to upgrade ffmpeg version in tv.kodi.Kodi.yml:

  • replace ffmpeg-6.0.1.tar.xz with ffmpeg-6.1.2.tar.xz (ffmpeg v7 does not compile in my case)
  • replace matching sha256 sum (3b624649725ecdc565c903ca6643d41f33bd49239922e45c9b1442c63dca4e38)

Then I did the build/export/install of the flatpak, and got both HW decoding and HDR working.

Hope it can help others.

I also have problems with HDR on the Youtube addon:

  • AV1+HDR crash Kodi
  • VP9+HDR plays only audio, with error "avcodec_receive_frame returned failure" in log).
  • VP9 or AV1 without HDR works without problem

I guess that when Kodi will support latest ffmpeg it will work. In the meantime I have my video library in 4K HDR and Youtube in 4K without HDR, I can survive with that 😄

@razzeee
Copy link
Member

razzeee commented Aug 20, 2024

@jacen05 I've build #286 (comment) - I guess you could play with that build

@jacen05
Copy link

jacen05 commented Aug 22, 2024

hi @razzeee !
Sorry but I fail to see what could bring this build, comparing to what I have now:

  • The ffmpeg upgrade is the same as I did manually
  • The renderer in your PR is still GL, not GLES, so HDR will probably not work
    I am missing something?

Of course, I would be pleased to have a GLES build available in Flathub, so if you do the build with GLES I'll test it!

@razzeee
Copy link
Member

razzeee commented Aug 22, 2024

I guess it's not worth it, when kodi doesn't upgrade ffmpeg

@simpledork47
Copy link

Thanks @arigit and @jacen05
by following your advices (rebuilding flatpak with mods), I've finally got my LG TV switching to "HDR" mode
I'm using a N100 too

Regards

@macko555
Copy link

macko555 commented Jan 3, 2025

I tried everything. Always when try to flatpak-builder im getting:
Run-time dependency libevdev found: NO (tried pkgconfig and cmake)
../meson.build:145:15: ERROR: Dependency "libevdev" not found, tried pkgconfig and cmake

All packages like libevdev-dev was installed. Can someone help?
Ubuntu 24

@aam1972
Copy link

aam1972 commented Jan 8, 2025

I tried everything. Always when try to flatpak-builder im getting: Run-time dependency libevdev found: NO (tried pkgconfig and cmake) ../meson.build:145:15: ERROR: Dependency "libevdev" not found, tried pkgconfig and cmake

All packages like libevdev-dev was installed. Can someone help? Ubuntu 24

Hi there, I have the same error (I'm on Debian). Have you found a solution? thanks

@macko555
Copy link

macko555 commented Jan 9, 2025

I tried everything. Always when try to flatpak-builder im getting: Run-time dependency libevdev found: NO (tried pkgconfig and cmake) ../meson.build:145:15: ERROR: Dependency "libevdev" not found, tried pkgconfig and cmake
All packages like libevdev-dev was installed. Can someone help? Ubuntu 24

Hi there, I have the same error (I'm on Debian). Have you found a solution? thanks

I found a good man who shared compiled package :)
https://www.vdr-portal.de/forum/thread/136652-flatpak-kodi-gles-hlg-hdr-support-kodi-gles-flatpak/?pageNo=1
HDR works well, HW Acceleration too.

@aam1972
Copy link

aam1972 commented Jan 9, 2025

I tried everything. Always when try to flatpak-builder im getting: Run-time dependency libevdev found: NO (tried pkgconfig and cmake) ../meson.build:145:15: ERROR: Dependency "libevdev" not found, tried pkgconfig and cmake
All packages like libevdev-dev was installed. Can someone help? Ubuntu 24

Hi there, I have the same error (I'm on Debian). Have you found a solution? thanks

I found a good man who shared compiled package :) https://www.vdr-portal.de/forum/thread/136652-flatpak-kodi-gles-hlg-hdr-support-kodi-gles-flatpak/?pageNo=1 HDR works well, HW Acceleration too.

Yep, I was aware of this thread, I would have preferred to put it together myself, but... yeah... why not :-D Big thanks!

@arigit
Copy link
Author

arigit commented Jan 9, 2025

I have been cross-compiling this flatpak with GLES enabled on my ubuntu 24.04.1 desktop (intel 13900T), and installing/running on a small N100 with no issues (and HDR working), following the same procedure I posted above. the last time I compiled this was mid Nov 2024 . I didn't run into issues or errors during any of the several builds I did so far.

@arigit
Copy link
Author

arigit commented Jan 24, 2025

@macko555, @aam1972 did you ever figure out the problem? I just tried to build 21.2 in my ubuntu 24.04 desktop and run into the same build problem with libevdev.

From the meson logs:

-----------
CMake binary for host machine is not cached
CMake binary missing from cross or native file, or env var undefined.
Trying a default CMake fallback at cmake
Found CMake: /usr/bin/cmake (3.31.3)
Extracting basic cmake information
CMake Toolchain: Calling CMake once to generate the compiler state
Calling CMake (['/usr/bin/cmake']) in /run/build/libinput/_flatpak_build/meson-private/__CMake_compiler_info__ with:
  - "--trace-expand"
  - "--trace-format=json-v1"
  - "--no-warn-unused-cli"
  - "--trace-redirect=cmake_trace.txt"
  - "-G"
  - "Ninja"
  - "-DCMAKE_TOOLCHAIN_FILE=/run/build/libinput/_flatpak_build/meson-private/__CMake_compiler_info__/CMakeMesonTempToolchainFile.cmake"
  - "."
CMake trace warning: add_executable() non imported executables are not supported
CMake TRACE: /run/build/libinput/_flatpak_build/meson-private/__CMake_compiler_info__/CMakeFiles/CMakeScratch/TryCompile-TBV6m3/CMakeLists.txt:22 add_executable(['cmTC_4d60d'])
CMake trace warning: target_link_options() TARGET cmTC_4d60d not found
CMake TRACE: /run/build/libinput/_flatpak_build/meson-private/__CMake_compiler_info__/CMakeFiles/CMakeScratch/TryCompile-TBV6m3/CMakeLists.txt:28 target_link_libraries(['cmTC_4d60d', ''])
Try CMake generator: auto
Calling CMake (['/usr/bin/cmake']) in /run/build/libinput/_flatpak_build/meson-private/cmake_libevdev with:
  - "--trace-expand"
  - "--trace-format=json-v1"
  - "--no-warn-unused-cli"
  - "--trace-redirect=cmake_trace.txt"
  - "-DCMAKE_TOOLCHAIN_FILE=/run/build/libinput/_flatpak_build/meson-private/cmake_libevdev/CMakeMesonToolchainFile.cmake"
  - "."
  -- Module search paths:    ['/', '/usr']
  -- CMake root:             /usr/share/cmake-3.31
  -- CMake architectures:    ['aarch64-linux-gnu', 'arm-linux-gnueabihf', 'i386-linux-gnu', 'x86_64-linux-gnu']
  -- CMake lib search paths: ['lib', 'lib32', 'lib64', 'libx32', 'share', '', 'lib/aarch64-linux-gnu', 'lib/arm-linux-gnueabihf', 'lib/i386-linux-gnu', 'lib/x86_64-linux-gnu']
Preliminary CMake check failed. Aborting.
Run-time dependency libevdev found: NO (tried pkgconfig and cmake)

../meson.build:145:15: ERROR: Dependency "libevdev" not found, tried pkgconfig and cmake

It seems that libevdev is being built and is then checked by the build process. So the local (host) install of libevdev-dev is irrelevant. From what I could see indeed libevdev got built so not sure with the postcheck then fails.

@razzeee are you able to build the flatpak successfully? with GLES instead of GL? which distro are you using in your build machine?

@macko555
Copy link

macko555 commented Jan 24, 2025

@macko555, @aam1972 did you ever figure out the problem? I just tried to build 21.2 in my ubuntu 24.04 desktop and run into the same build problem with libevdev.

From the meson logs:

-----------
CMake binary for host machine is not cached
CMake binary missing from cross or native file, or env var undefined.
Trying a default CMake fallback at cmake
Found CMake: /usr/bin/cmake (3.31.3)
Extracting basic cmake information
CMake Toolchain: Calling CMake once to generate the compiler state
Calling CMake (['/usr/bin/cmake']) in /run/build/libinput/_flatpak_build/meson-private/__CMake_compiler_info__ with:
  - "--trace-expand"
  - "--trace-format=json-v1"
  - "--no-warn-unused-cli"
  - "--trace-redirect=cmake_trace.txt"
  - "-G"
  - "Ninja"
  - "-DCMAKE_TOOLCHAIN_FILE=/run/build/libinput/_flatpak_build/meson-private/__CMake_compiler_info__/CMakeMesonTempToolchainFile.cmake"
  - "."
CMake trace warning: add_executable() non imported executables are not supported
CMake TRACE: /run/build/libinput/_flatpak_build/meson-private/__CMake_compiler_info__/CMakeFiles/CMakeScratch/TryCompile-TBV6m3/CMakeLists.txt:22 add_executable(['cmTC_4d60d'])
CMake trace warning: target_link_options() TARGET cmTC_4d60d not found
CMake TRACE: /run/build/libinput/_flatpak_build/meson-private/__CMake_compiler_info__/CMakeFiles/CMakeScratch/TryCompile-TBV6m3/CMakeLists.txt:28 target_link_libraries(['cmTC_4d60d', ''])
Try CMake generator: auto
Calling CMake (['/usr/bin/cmake']) in /run/build/libinput/_flatpak_build/meson-private/cmake_libevdev with:
  - "--trace-expand"
  - "--trace-format=json-v1"
  - "--no-warn-unused-cli"
  - "--trace-redirect=cmake_trace.txt"
  - "-DCMAKE_TOOLCHAIN_FILE=/run/build/libinput/_flatpak_build/meson-private/cmake_libevdev/CMakeMesonToolchainFile.cmake"
  - "."
  -- Module search paths:    ['/', '/usr']
  -- CMake root:             /usr/share/cmake-3.31
  -- CMake architectures:    ['aarch64-linux-gnu', 'arm-linux-gnueabihf', 'i386-linux-gnu', 'x86_64-linux-gnu']
  -- CMake lib search paths: ['lib', 'lib32', 'lib64', 'libx32', 'share', '', 'lib/aarch64-linux-gnu', 'lib/arm-linux-gnueabihf', 'lib/i386-linux-gnu', 'lib/x86_64-linux-gnu']
Preliminary CMake check failed. Aborting.
Run-time dependency libevdev found: NO (tried pkgconfig and cmake)

../meson.build:145:15: ERROR: Dependency "libevdev" not found, tried pkgconfig and cmake

It seems that libevdev is being built and is then checked by the build process. So the local (host) install of libevdev-dev is irrelevant. From what I could see indeed libevdev got built so not sure with the postcheck then fails.

@razzeee are you able to build the flatpak successfully? with GLES instead of GL? which distro are you using in your build machine?

I gave up and use compiled image which i linked previous. I tried few ways but no effects. Just waste of time.

@aam1972
Copy link

aam1972 commented Jan 24, 2025

@macko555, @aam1972 did you ever figure out the problem? I just tried to build 21.2 in my ubuntu 24.04 desktop and run into the same build problem with libevdev.

Hi there, no joy when compiling. I tried the version available here: https://www.vdr-portal.de/forum/thread/136652-flatpak-kodi-gles-hlg-hdr-support-kodi-gles-flatpak/?pageNo=1 but no HDR for me, I don't know why...I ended up switching to Jellyfin that recognizes HDR without extra-tweaking. Since I self-host other applications it's fine for me

@macko555
Copy link

macko555 commented Jan 24, 2025

@macko555, @aam1972 did you ever figure out the problem? I just tried to build 21.2 in my ubuntu 24.04 desktop and run into the same build problem with libevdev.

Hi there, no joy when compiling. I tried the version available here: https://www.vdr-portal.de/forum/thread/136652-flatpak-kodi-gles-hlg-hdr-support-kodi-gles-flatpak/?pageNo=1 but no HDR for me, I don't know why...I ended up switching to Jellyfin that recognizes HDR without extra-tweaking. Since I self-host other applications it's fine for me

Did you use the right parameters? GBM is necessary for HDR. Exec Start which works well for me:
ExecStart = /usr/bin/flatpak run tv.kodi.Kodi --standalone --windowing=gbm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants