Docker Jellyfin HW accelarated transcoding in Raspberry pi

  • Hi...

    I'm trying to deploy jellyfin docker container to support gpu hw transcoding in Raspberry. Following jellyfin/linuxserver.io guidelines it's necessary to mount OpenMax libraries (/opt/vc/lib) inside the container to make it working and here it's where it's failing due to a linking error. When I execute the following command to create the container:

    Code
    docker run -d --name jellyfin --volume /storage/docker/jellyfin:/config --volume /opt/vc/lib:/opt/vc/lib -p 8096:8096 --device=/dev/vchiq:/dev/vchiq --restart=unless-stopped linuxserver/jellyfin

    Jellyfin container logs report the following error not being able to start the app web server:

    Code
    [cont-init.d] 40-gid-video: executing... 
    [jellyfin-init] Pi Libs detected loading
    /sbin/ldconfig.real: Can't link /opt/vc/lib/libfdt.so.1 to libfdt.so
    [cont-init.d] 40-gid-video: exited 0.
    [cont-init.d] 99-custom-scripts: executing... 
    [cont-init.d] 99-custom-scripts: exited 267.
    [cont-init.d] done.
    [services.d] starting services
    [services.d] done.

    Does anybody know how to fix it?.

    Regards,

    Edited once, last by MrThreepwood (January 18, 2020 at 10:45 AM).

  • Rpi 4 hw transcode support was just added to that image and since none of the team members have an rpi 4 available for that purpose, we worked with an end user who did testing and troubleshooting for us (developing blind is not an easy task).

    Do you mind posting an issue on our github so we can properly track it?

    GitHub - linuxserver/docker-jellyfin

  • wondering if it is enough to just compile ffmpeg with the needed options ?

    same problem like at tvheadend (not sure this was fixed for the LS.io dockers)

  • After taking a look at docker-jellyfin project, it seems that the libraries appearing in /opt/vc/lib, mounted as volumen inside the container, are preloaded:

    Code
    # openmax lib loading
    if [ -e "/opt/vc/lib" ] && [ ! -e "/etc/ld.so.conf.d/00-vmcs.conf" ]; then
        echo "[jellyfin-init] Pi Libs detected loading"
        echo "/opt/vc/lib" > "/etc/ld.so.conf.d/00-vmcs.conf"
        ldconfig
    fi    

    The problem is that this folder in Libreelec is a symlink to /usr/lib, so these openmax libraries are mixed with usual OS staff ones, which maybe is making things go wrong.

    Do you know how any other docker apps solve this in LIbreelec?.

    Regards,

    Edited 2 times, last by MrThreepwood (January 20, 2020 at 8:55 PM).

  • Curiously if I mount as volume inside the container exclusively libfdt.so and try to link only this library using ldconfig -l libfdt.so, this works:

    Code
    root@a1538739bbd5:/opt/vc/lib# ldconfig -l libfdt.so
    root@a1538739bbd5:/opt/vc/lib# ls -la
    total 29
    drwxr-xr-x 2 root root  1024 Jan 20 20:35 .
    drwxr-xr-x 3 root root  1024 Jan 20 20:31 ..
    -rwxr-xr-x 1 root root 26328 Nov 23 00:46 libfdt.so
    lrwxrwxrwx 1 root root     9 Jan 20 20:35 libfdt.so.1 -> libfdt.so

    It's a privilege issue. Container tries to create the simlink libfdt.so.1 -> libfdt.so in host /usr/lib (/opt/vc/lib) without writing privileges for that folder. What would be the correct way of doing in similar docker images in Libreelec? Installing OpenMax libraries directly in the container?.

    Regards,

  • Just to provide an update here, we updated both jellyfin and emby addons in the linuxserver repo. They now both support omx hw transcode.

    Go into the addon settings and toggle openmax. When the container is recreated, necessary devices and drivers will be mapped in.

    One gotcha though, neither supports hw decode. They only do hw encode. According to jellyfin documentation, that is an upstream limitation: Hardware Acceleration | Documentation - Jellyfin Project

    I also tested v4l2 (everyone says it's the future). It is detected and used by both emby and jellyfin (again, only for encode) but unfortunately the image has a green filter over it. No idea why, so we didn't enable that in the addon yet. Let me know if you have any idea what causes it and/or how to fix it.