linuxserver / docker-jellyfin

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

Latest images break Intel acceleration support #105

Closed lreeves closed 3 years ago

lreeves commented 3 years ago

linuxserver.io


I believe this is related to https://github.com/linuxserver/docker-jellyfin/pull/102 - but essentially on the latest releases of this image QuickSync encoding fails with the following error:

[AVHWDeviceContext @ 0x55d39838b080] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so has no function __vaDriverInit_1_0
[AVHWDeviceContext @ 0x55d39838b080] Failed to initialise VAAPI connection: -1 (unknown libva error).

I believe that the ffmpeg included is compiled against a different version of the VA-API that the Intel packages are using (1.10 versus 1.11) and this breaks both QuickSync and VA-API acceleration. If I downgrade the package used in the container like so:

apt install intel-media-va-driver-non-free=21.1.2+i526~u20.04

Then everything works as expected again. It's probably easy to pin the version to this but I'm not sure if that's the proper fix versus compiling ffmpeg against the newer libraries. @nyanmisaka - if the former is fine I can whip up a PR, just let me know!

Environment

OS: Docker host is Debian Bullseye CPU architecture: x86_64, Intel i5-11400 How docker service was installed: From the official repo using Docker compose.

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

Docker-compose YAML:

---
version: "2.1"
services:
  jellyfin:
    image: ghcr.io/linuxserver/jellyfin:latest
    container_name: jellyfin
    environment:
      - PUID=1006
      - PGID=1006
      - TZ=America/New_York
      - LIBVA_DRIVER_NAME=iHD
      #- JELLYFIN_PublishedServerUrl=192.168.0.5 #optional
    group_add:
      - 105
    volumes:
      - /flash/docker/jellyfin:/config
      - /home/media/share/Television:/data/tvshows:ro
      - /home/media/share/Movies:/data/movies:ro
    ports:
      - 14001:8096
      - 14002:8920 #optional
      #- 7359:7359/udp #optional
      #- 1900:1900/udp #optional
    devices:
      - /dev/dri:/dev/dri #optional
      - /dev/dri/renderD128:/dev/dri/renderD128
      - /dev/dri/card0:/dev/dri/card0
    restart: unless-stopped

Docker logs

[AVHWDeviceContext @ 0x55d39838b080] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so has no function __vaDriverInit_1_0
[AVHWDeviceContext @ 0x55d39838b080] Failed to initialise VAAPI connection: -1 (unknown libva error).
github-actions[bot] commented 3 years ago

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

nyanmisaka commented 3 years ago

Please wait for the jellyfin-ffmpeg 4.3.2-1.

https://github.com/jellyfin/jellyfin-ffmpeg/blob/cec5a97aac350ebd458d5b66cfb2a5c56ea2f110/docker-build.sh#L97

Hukuma1 commented 3 years ago

Seeing the same issue.

Looks like 4.3.2-1 got released 4 hours ago: https://github.com/jellyfin/jellyfin-ffmpeg/releases/tag/v4.3.2-1

nyanmisaka commented 3 years ago

jellyfin-ffmpeg 4.3.2-1 is now available. How can we trigger a new build for docker-jellyfin? https://repo.jellyfin.org/releases/server/ubuntu/versions/jellyfin-ffmpeg/4.3.2-1/

tobbenb commented 3 years ago

If it's just a dependency, it will be updated once a week, so we will have to trigger it manually to update before the weekly package trigger. I'll have a look and see if I can find out how to trigger it manually.

tobbenb commented 3 years ago

Can you guys try to pull the new version and see if that fixes your issue? It should have the correct ffmpeg version now. The package versions are in the package_versions.txt in the root of the repo.

a-usov commented 3 years ago

Latest image does indeed fix the issue with Intel Quicksync for me

lreeves commented 3 years ago

Yep same here, thanks - I'll close this issue now :-)

yuxincs commented 3 years ago

Now having the same issue, seems like ede49b23395ac766f811e1466a452ea04579e1e1 has reverted the jellyfin-ffmpeg back to 4.3.1-4

Haaroon commented 3 years ago

This issue still exists on ubuntu based machines, below found on reddit by user GroceryBagHead fixes it

apt update
TEMP_DEB="$(mktemp)" &&
wget -O "$TEMP_DEB" 'https://repo.jellyfin.org/releases/server/ubuntu/versions/jellyfin-ffmpeg/4.3.2-1/jellyfin-ffmpeg_4.3.2-1-focal_amd64.deb' &&
dpkg -i "$TEMP_DEB"
rm -f "$TEMP_DEB"
vchelban commented 3 years ago

On latest ghcr.io/linuxserver/jellyfin:amd64-10.7.7-1-ls131 I have to use next commands (inside container) to fix QuickSync recode:

ln -sf /lib/x86_64-linux-gnu/libva.so.2.1200.0 /lib/jellyfin-ffmpeg/lib/libva.so.2
ln -sf /lib/x86_64-linux-gnu/libva.so.2.1200.0 /lib/jellyfin-ffmpeg/lib/libva.so
tevenfeng commented 2 years ago

On latest ghcr.io/linuxserver/jellyfin:amd64-10.7.7-1-ls131 I have to use next commands (inside container) to fix QuickSync recode:

ln -sf /lib/x86_64-linux-gnu/libva.so.2.1200.0 /lib/jellyfin-ffmpeg/lib/libva.so.2
ln -sf /lib/x86_64-linux-gnu/libva.so.2.1200.0 /lib/jellyfin-ffmpeg/lib/libva.so

OMG, finally got it to work after 2 days of searching.... THANK YOU soooooo much~

Well, actually I dont know why we have to do such things, shouldn't that be well-configured out of the box, or is it just something else wrong?

Prototyped commented 2 years ago

I fixed this for myself building a container based on the Linuxserver container for Jellyfin:

FROM ghcr.io/linuxserver/jellyfin

RUN set -ex; \
    env DEBIAN_FRONTEND=noninteractive apt -y update; \
    env DEBIAN_FRONTEND=noninteractive apt -y --no-install-recommends full-upgrade; \
    env DEBIAN_FRONTEND=noninteractive apt -y --no-install-recommends install vainfo; \
    env DEBIAN_FRONTEND=noninteractive apt -y clean; \
    rm -rf /var/cache/apt/archives/*

RUN set -ex; \
    curl -fLSso /tmp/jellyfin-ffmpeg.deb 'https://repo.jellyfin.org/releases/server/ubuntu/versions/jellyfin-ffmpeg/4.3.2-1/jellyfin-ffmpeg_4.3.2-1-focal_amd64.deb'; \
    dpkg -i /tmp/jellyfin-ffmpeg.deb; \
    rm -f /tmp/jellyfin-ffmpeg.deb; \
    ln -f /usr/lib/x86_64-linux-gnu/libva* /usr/lib/jellyfin-ffmpeg/lib/

In effect it upgrades the OS, installs the correct jellyfin-ffmpeg package, and replaces the VA-API implementation that jellyfin-ffmpeg uses with the one from the OS. I have a cron job that tries to pull the ghcr.io/linuxserver/jellyfin container and, if there's a new version, rebuilds my Jellyfin container using the above Dockerfile.