linuxserver / docker-jellyfin

GNU General Public License v3.0
647 stars 97 forks source link

Add OpenCL runtime for Tone mapping #73

Closed nyanmisaka closed 3 years ago

nyanmisaka commented 3 years ago

Not a real issue. The necessary OpenCL runtimes need to be added into the image for Tone mapping function in JF 10.7.

*amd64 only

Guidance:

github-actions[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the issue template!

aptalca commented 3 years ago

@nyanmisaka thanks so much for the info

I actually went ahead and created a docker mod for opencl-intel: https://github.com/linuxserver/docker-mods/pull/150 Once merged, it will be published at linuxserver/mods:jellyfin-opencl-intel A test version is pushed to aptalca/mods:jellyfin-opencl-intel

Can a linuxserver jellyfin user test it on intel gpu and confirm it works?

All that needs to be done is to add an environment variable to the linuxserver jellyfin docker arguments -e DOCKER_MODS=aptalca/mods:jellyfin-opencl-intel and it should install opencl and clinfo on container start (logs will show). And try to test tone mapping.

I don't currently have an igpu test platform ready for this.

Thanks

nyanmisaka commented 3 years ago

Thanks for your excellent job! Tested in unstable image 20201128 and tone mapping with HD 630 iGPU works just fine. Feel free to close this ticket once linuxserver/mods:jellyfin-opencl-intel got released.

VAAPI + Intel HD 630 + i965 driver + NEO runtime 4k HDR 70M -> 1080p SDR 20M

Docker logs
 
[mod-init] Attempting to run Docker Modification Logic
[mod-init] Applying aptalca/mods:jellyfin-opencl-intel files to container
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing... 
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing... 
usermod: no changes

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \ 
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/

Brought to you by linuxserver.io
-------------------------------------

To support the app dev(s) visit:
Jellyfin: https://opencollective.com/jellyfin

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    911
User gid:    911
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 30-config: executing... 
[cont-init.d] 30-config: exited 0.
[cont-init.d] 40-gid-video: executing... 
[cont-init.d] 40-gid-video: exited 0.
[cont-init.d] 98-opencl-intel: executing... 
installing clinfo
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 https://repo.jellyfin.org/ubuntu focal InRelease [6,636 B]
Get:3 https://sgp1.mirror.jellyfin.org/ubuntu focal/unstable amd64 Packages [856 B]
Get:4 https://sgp1.mirror.jellyfin.org/ubuntu focal/main amd64 Packages [1,679 B]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/restricted Sources [7,198 B]
Get:8 http://archive.ubuntu.com/ubuntu focal/multiverse Sources [208 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/universe Sources [12.3 MB]
Get:10 http://archive.ubuntu.com/ubuntu focal/main Sources [1,079 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1,275 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe Sources [166 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/multiverse Sources [9,728 B]
Get:17 http://archive.ubuntu.com/ubuntu focal-updates/restricted Sources [9,129 B]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates/main Sources [414 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [874 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [133 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [30.4 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [875 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal-security/restricted Sources [6,518 B]
Get:24 http://archive.ubuntu.com/ubuntu focal-security/multiverse Sources [808 B]
Get:25 http://archive.ubuntu.com/ubuntu focal-security/universe Sources [53.0 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal-security/main Sources [128 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [96.7 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [643 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [479 kB]
Get:30 http://archive.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [1,165 B]
Fetched 30.8 MB in 12s (2,469 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  clinfo
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 41.4 kB of archives.
After this operation, 138 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 clinfo amd64 2.2.18.04.06-1 [41.4 kB]
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 1.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7, <> line 1.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
Fetched 41.4 kB in 1s (35.2 kB/s)
Selecting previously unselected package clinfo.
(Reading database ... 10073 files and directories currently installed.)
Preparing to unpack .../clinfo_2.2.18.04.06-1_amd64.deb ...
Unpacking clinfo (2.2.18.04.06-1) ...
Setting up clinfo (2.2.18.04.06-1) ...
Installing/updating opencl-intel debs
Selecting previously unselected package intel-gmmlib.
(Reading database ... 10079 files and directories currently installed.)
Preparing to unpack .../intel-gmmlib_20.3.2_amd64.deb ...
Unpacking intel-gmmlib (20.3.2) ...
Selecting previously unselected package intel-igc-core.
Preparing to unpack .../intel-igc-core_1.0.5585_amd64.deb ...
Unpacking intel-igc-core (1.0.5585) ...
Selecting previously unselected package intel-igc-opencl.
Preparing to unpack .../intel-igc-opencl_1.0.5585_amd64.deb ...
Unpacking intel-igc-opencl (1.0.5585) ...
Selecting previously unselected package intel-level-zero-gpu.
Preparing to unpack .../intel-level-zero-gpu_1.0.18513_amd64.deb ...
Unpacking intel-level-zero-gpu (1.0.18513) ...
Selecting previously unselected package intel-ocloc.
Preparing to unpack .../intel-ocloc_20.47.18513_amd64.deb ...
Unpacking intel-ocloc (20.47.18513) ...
Selecting previously unselected package intel-opencl.
Preparing to unpack .../intel-opencl_20.47.18513_amd64.deb ...
Unpacking intel-opencl (20.47.18513) ...
Setting up intel-gmmlib (20.3.2) ...
Setting up intel-igc-core (1.0.5585) ...
Setting up intel-igc-opencl (1.0.5585) ...
Setting up intel-level-zero-gpu (1.0.18513) ...
Setting up intel-ocloc (20.47.18513) ...
Setting up intel-opencl (20.47.18513) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
[cont-init.d] 98-opencl-intel: exited 0.
[cont-init.d] 99-custom-scripts: executing... 
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-scripts: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[01:30:40] [INF] [1] Main: Jellyfin version: 10.7.0
[01:30:40] [INF] [1] Main: Environment Variables: ["[JELLYFIN_WEB_DIR, /usr/share/jellyfin/web]", "[JELLYFIN_LOG_DIR, /config/log]", "[JELLYFIN_CACHE_DIR, /config/cache]", "[JELLYFIN_CONFIG_DIR, /config]", "[JELLYFIN_DATA_DIR, /config/data]"]
[01:30:40] [INF] [1] Main: Arguments: ["/usr/lib/jellyfin/bin/jellyfin.dll", "--ffmpeg=/usr/lib/jellyfin-ffmpeg/ffmpeg"]
[01:30:40] [INF] [1] Main: Operating system: Linux
[01:30:40] [INF] [1] Main: Architecture: X64
[01:30:40] [INF] [1] Main: 64-Bit Process: True
[01:30:40] [INF] [1] Main: User Interactive: True
[01:30:40] [INF] [1] Main: Processor count: 4
[01:30:40] [INF] [1] Main: Program data path: /config/data
[01:30:40] [INF] [1] Main: Web resources path: /usr/share/jellyfin/web
[01:30:40] [INF] [1] Main: Application directory: /usr/lib/jellyfin/bin/
[01:30:41] [INF] [1] Emby.Server.Implementations.AppBase.BaseConfigurationManager: Setting cache path: /config/cache
[01:30:41] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Defined LAN addresses : [127.0.0.1/32,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16]
[01:30:41] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Defined LAN exclusions : []
[01:30:41] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using LAN addresses: [127.0.0.1/32,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16]
[01:30:41] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using bind addresses: []
[01:30:41] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using bind exclusions: []
[01:30:41] [INF] [1] Emby.Server.Implementations.ApplicationHost: Loading assemblies
[01:30:42] [INF] [1] Emby.Server.Implementations.ApplicationHost: Plugins: OMDb 10.7.0.0
MusicBrainz 10.7.0.0
AudioDB 10.7.0.0

[01:30:42] [INF] [1] Main: Kestrel listening on Any IP4 Address
[01:30:42] [WRN] [1] Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository: Using an in-memory repository. Keys will not be persisted to storage.
[01:30:42] [WRN] [1] Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager: Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
[01:30:42] [WRN] [1] Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager: No XML encryptor configured. Key {90b8f4c7-012f-4976-9160-0b877b42e6f5} may be persisted to storage in unencrypted form.
[01:30:42] [INF] [1] Emby.Server.Implementations.ApplicationHost: Running startup tasks
[01:30:42] [INF] [1] Emby.Server.Implementations.ScheduledTasks.TaskManager: Daily trigger for Extract Chapter Images set to fire at 12/02/2020 02:00, which is 0:29:17.3758668 from now.
[01:30:42] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Found ffmpeg version 4.3.1
[01:30:42] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available decoders: ["h264", "h264_qsv", "h264_cuvid", "hevc", "hevc_qsv", "hevc_cuvid", "mpeg2video", "mpeg2_qsv", "mpeg2_cuvid", "mpeg4", "mpeg4_cuvid", "msmpeg4", "vc1_qsv", "vc1_cuvid", "vp8_cuvid", "vp8_qsv", "vp9_cuvid", "vp9_qsv", "aac", "ac3", "flac", "mp3"]
[01:30:42] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available encoders: ["libx264", "h264_amf", "h264_nvenc", "h264_qsv", "h264_v4l2m2m", "h264_vaapi", "libx265", "hevc_amf", "hevc_nvenc", "hevc_qsv", "hevc_vaapi", "mpeg4", "msmpeg4", "libvpx", "libvpx-vp9", "aac", "ac3", "flac", "libmp3lame", "libopus", "libvorbis", "srt"]
[01:30:42] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available hwaccel types: ["vdpau", "cuda", "vaapi", "qsv", "drm", "opencl"]
[01:30:42] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: FFmpeg: SetByArgument: /usr/lib/jellyfin-ffmpeg/ffmpeg
[01:30:42] [INF] [1] Emby.Server.Implementations.ApplicationHost: ServerId: bcbed9f1effc46ef8ba9343aeb4ed4ab
[01:30:42] [INF] [1] Emby.Dlna.Main.DlnaEntryPoint: Registering publisher for urn:schemas-upnp-org:device:MediaServer:1 on 192.168.2.37/24
[01:30:42] [INF] [1] Emby.Server.Implementations.ApplicationHost: Executed all pre-startup entry points in 0:00:00.0853773
[01:30:42] [INF] [1] Emby.Server.Implementations.ApplicationHost: Core startup complete
[01:30:42] [INF] [1] Emby.Server.Implementations.ApplicationHost: Executed all post-startup entry points in 0:00:00.0831856
[01:30:42] [INF] [1] Main: Startup complete 0:00:02.1030261
[01:30:45] [INF] [11] Emby.Server.Implementations.ScheduledTasks.TaskManager: StartupTrigger fired for task: Update Plugins
[01:30:45] [INF] [11] Emby.Server.Implementations.ScheduledTasks.TaskManager: Queuing task PluginUpdateTask
[01:30:45] [INF] [10] Emby.Server.Implementations.ScheduledTasks.TaskManager: Executing Update Plugins
[01:30:47] [INF] [4] Emby.Server.Implementations.ScheduledTasks.TaskManager: Update Plugins Completed after 0 minute(s) and 2 seconds
[01:30:47] [INF] [4] Emby.Server.Implementations.ScheduledTasks.TaskManager: ExecuteQueuedTasks
  
jellyfin-ffmpeg logs
 
ubuntu@ubuntu-ssd:~/docker-jellyfin/docker-jellyfin$ sudo docker exec -u root -it ce92ae40e5fe /bin/bash
root@ubuntu-ssd:/# /usr/lib/jellyfin-ffmpeg/ffmpeg -v debug -init_hw_device opencl
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --disable-doc --disable-ffplay --disable-shared --disable-libxcb --disable-sdl2 --disable-xlib --enable-gpl --enable-version3 --enable-static --enable-libfontconfig --enable-fontconfig --enable-gmp --enable-gnutls --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --arch=amd64 --enable-libzimg --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-vdpau --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvenc --enable-nvdec --enable-ffnvcodec
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'opencl'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Applying option init_hw_device (initialise hardware device) with argument opencl.
[AVHWDeviceContext @ 0x565409b37d00] 1 OpenCL platforms found.
[AVHWDeviceContext @ 0x565409b37d00] 1 OpenCL devices found on platform "Intel(R) OpenCL HD Graphics".
[AVHWDeviceContext @ 0x565409b37d00] 0.0: Intel(R) OpenCL HD Graphics / Intel(R) Graphics Gen9 [0x591b]
[AVHWDeviceContext @ 0x565409b37d00] cl_intel_va_api_media_sharing found as platform extension.
[AVHWDeviceContext @ 0x565409b37d00] Media sharing must be enabled on context creation to use QSV to OpenCL mapping.
[AVHWDeviceContext @ 0x565409b37d00] QSV to OpenCL mapping not usable.
Successfully parsed a group of options.
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
  
aptalca commented 3 years ago

Excellent, thanks so much. I'll go ahead and publish the mod