linuxserver / docker-jellyfin

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

Hardware acceleration not working (libbcm_host.so not found) #108

Closed nurtext closed 3 years ago

nurtext commented 3 years ago

linuxserver.io

Hardware accelerated encoding not working


Expected Behavior

Hardware acceleration using docker on an Raspberry Pi 4

Current Behavior

Acceleration won't work

Steps to Reproduce

  1. Spun up the docker container as described in readme
  2. Made sure all mappings, etc. are correct
  3. Tried to playback a movie from my library using my android device with transcoding set to 720p / 8 Mbit

Environment

OS: Raspbian OS full 64bit CPU architecture: arm64 How docker service was installed: get.docker.com standard method

Command used to create docker container (run/create/compose/screenshot)

docker run -d --name=jellyfin --restart=always --net=host --device=/dev/vchiq:/dev/vchiq -v jellyfin:/config -v /media/external:/media -v /opt/vc/lib:/opt/vc/lib -e PUID=1000 -e PGID=1000 -e TZ='Europe/Berlin' -e UMASK_SET='022' linuxserver/jellyfin:latest

Docker logs

[18:23:22] [INF] [23] Jellyfin.Api.Helpers.TranscodingJobHelper: /usr/lib/jellyfin-ffmpeg/ffmpeg -i file:"/media/Filme/(500) Days of Summer (2009)/(500) Days of Summer.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_omx -b:v 7232000 -maxrate 7232000 -bufsize 14464000 -level 41  -force_key_frames:0 "expr:gte(t,0+n_forced*3)" -g:v:0 72 -keyint_min:v:0 72 -sc_threshold:v:0 0 -vf "scale=trunc(min(max(iw\,ih*dar)\,1920)/2)*2:trunc(ow/dar/2)*2" -start_at_zero -vsync -1 -codec:a:0 libmp3lame -ac 2 -ab 640000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/config/data/transcodes/047722faa9b3ed8892810dbd9edf08be%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/config/data/transcodes/047722faa9b3ed8892810dbd9edf08be.m3u8"
[18:23:23] [ERR] [12] Jellyfin.Api.Helpers.TranscodingJobHelper: FFmpeg exited with code 1

Transcoding log

Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_omx))
  Stream #0:1 -> #0:1 (dts (dca) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[h264_omx @ 0x55afb8a3e0] /opt/vc/lib/libbcm_host.so not found
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[libmp3lame @ 0x55afb8bd30] 3 frames left in the queue on closing
Conversion failed!

Directory index

Host:

pi@dragon:~ $ ls -la /opt/vc/lib/
insgesamt 3412
drwxr-xr-x 4 root root   4096 Mai  1 14:16 .
drwxr-xr-x 7 root root   4096 Mai  1 14:16 ..
-rw-r--r-- 1 root root  79698 Mai  1 14:16 libbcm_host.so
-rw-r--r-- 1 root root 210148 Mai  1 14:16 libbrcmEGL.so
-rw-r--r-- 1 root root 105644 Mai  1 14:16 libbrcmGLESv2.so
-rw-r--r-- 1 root root 103542 Mai  1 14:16 libbrcmOpenVG.so
-rw-r--r-- 1 root root  78386 Mai  1 14:16 libbrcmWFC.so
-rw-r--r-- 1 root root 380659 Mai  1 14:16 libcontainers.so
-rw-r--r-- 1 root root  16360 Mai  1 14:16 libdebug_sym.so
-rw-r--r-- 1 root root  13610 Mai  1 14:16 libdebug_sym_static.a
-rw-r--r-- 1 root root  62180 Mai  1 14:16 libdtovl.so
-rw-r--r-- 1 root root 210148 Mai  1 14:16 libEGL.so
-rw-r--r-- 1 root root 251410 Mai  1 14:16 libEGL_static.a
-rw-r--r-- 1 root root 345611 Mai  1 14:16 libelftoolchain.so
lrwxrwxrwx 1 root root     12 Mai  1 14:16 libGLESv1_CM.so -> libGLESv2.so
-rw-r--r-- 1 root root 105636 Mai  1 14:16 libGLESv2.so
-rw-r--r-- 1 root root 100652 Mai  1 14:16 libGLESv2_static.a
-rw-r--r-- 1 root root  13322 Mai  1 14:16 libkhrn_client.a
-rw-r--r-- 1 root root 457900 Mai  1 14:16 libkhrn_static.a
-rw-r--r-- 1 root root  75749 Mai  1 14:16 libmmal_components.so
-rw-r--r-- 1 root root  86523 Mai  1 14:16 libmmal_core.so
-rw-r--r-- 1 root root  15309 Mai  1 14:16 libmmal.so
-rw-r--r-- 1 root root  91330 Mai  1 14:16 libmmal_util.so
-rw-r--r-- 1 root root  44589 Mai  1 14:16 libmmal_vc_client.so
-rw-r--r-- 1 root root  32974 Mai  1 14:16 libopenmaxil.so
-rw-r--r-- 1 root root 103534 Mai  1 14:16 libOpenVG.so
-rw-r--r-- 1 root root  29854 Mai  1 14:16 libvchiq_arm.so
-rw-r--r-- 1 root root  82676 Mai  1 14:16 libvchostif.a
-rw-r--r-- 1 root root  28342 Mai  1 14:16 libvcilcs.a
-rw-r--r-- 1 root root 178843 Mai  1 14:16 libvcos.so
-rw-r--r-- 1 root root  31441 Mai  1 14:16 libvcsm.so
-rw-r--r-- 1 root root  78386 Mai  1 14:16 libWFC.so
drwxr-xr-x 2 root root   4096 Mai  1 14:16 pkgconfig
drwxr-xr-x 2 root root   4096 Mai  1 14:16 plugins

Container:

root@dragon:/# ls -la /opt/vc/lib/
total 3412
drwxr-xr-x 4 root root   4096 May  1 14:16 .
drwxr-xr-x 3 root root   4096 May  1 18:22 ..
-rw-r--r-- 1 root root  79698 May  1 14:16 libbcm_host.so
-rw-r--r-- 1 root root 210148 May  1 14:16 libbrcmEGL.so
-rw-r--r-- 1 root root 105644 May  1 14:16 libbrcmGLESv2.so
-rw-r--r-- 1 root root 103542 May  1 14:16 libbrcmOpenVG.so
-rw-r--r-- 1 root root  78386 May  1 14:16 libbrcmWFC.so
-rw-r--r-- 1 root root 380659 May  1 14:16 libcontainers.so
-rw-r--r-- 1 root root  16360 May  1 14:16 libdebug_sym.so
-rw-r--r-- 1 root root  13610 May  1 14:16 libdebug_sym_static.a
-rw-r--r-- 1 root root  62180 May  1 14:16 libdtovl.so
-rw-r--r-- 1 root root 210148 May  1 14:16 libEGL.so
-rw-r--r-- 1 root root 251410 May  1 14:16 libEGL_static.a
-rw-r--r-- 1 root root 345611 May  1 14:16 libelftoolchain.so
lrwxrwxrwx 1 root root     12 May  1 14:16 libGLESv1_CM.so -> libGLESv2.so
-rw-r--r-- 1 root root 105636 May  1 14:16 libGLESv2.so
-rw-r--r-- 1 root root 100652 May  1 14:16 libGLESv2_static.a
-rw-r--r-- 1 root root  13322 May  1 14:16 libkhrn_client.a
-rw-r--r-- 1 root root 457900 May  1 14:16 libkhrn_static.a
-rw-r--r-- 1 root root  75749 May  1 14:16 libmmal_components.so
-rw-r--r-- 1 root root  86523 May  1 14:16 libmmal_core.so
-rw-r--r-- 1 root root  15309 May  1 14:16 libmmal.so
-rw-r--r-- 1 root root  91330 May  1 14:16 libmmal_util.so
-rw-r--r-- 1 root root  44589 May  1 14:16 libmmal_vc_client.so
-rw-r--r-- 1 root root  32974 May  1 14:16 libopenmaxil.so
-rw-r--r-- 1 root root 103534 May  1 14:16 libOpenVG.so
-rw-r--r-- 1 root root  29854 May  1 14:16 libvchiq_arm.so
-rw-r--r-- 1 root root  82676 May  1 14:16 libvchostif.a
-rw-r--r-- 1 root root  28342 May  1 14:16 libvcilcs.a
-rw-r--r-- 1 root root 178843 May  1 14:16 libvcos.so
-rw-r--r-- 1 root root  31441 May  1 14:16 libvcsm.so
-rw-r--r-- 1 root root  78386 May  1 14:16 libWFC.so
drwxr-xr-x 2 root root   4096 May  1 14:16 pkgconfig
drwxr-xr-x 2 root root   4096 May  1 14:16 plugins
github-actions[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

tobbenb commented 3 years ago

It's not strange it can't find the lib as it's owned by root. So you need to give the user you used in PUID & PGID have permission to read the lib.

nurtext commented 3 years ago

That's wrong. As you can see above my permissions on host and container are both '-rw-r--r--' (0644) which means U+RW, G+R, W+R so everyone has read access. Anyway, I tried with setting PUID and PGID to zero (root) and it still doesn't work.

j0nnymoe commented 3 years ago

Did you try chowning it to the PUID/PGID before you decided that's wrong?

nurtext commented 3 years ago

That being said, no need for chown'ing any system files (which is always a very bad idea). Anyway consider this solved, because I think I've found the issue:

https://github.com/jellyfin/jellyfin/issues/4023

Would be a good idea to have this information in README.