HaveAGitGat / Tdarr

Tdarr - Distributed transcode automation using FFmpeg/HandBrake + Audio/Video library analytics + video health checking (Windows, macOS, Linux & Docker)
2.72k stars 89 forks source link

Docker Node not using Intel QSV #977

Open matthewprobasco opened 2 months ago

matthewprobasco commented 2 months ago

Describe the bug I have TDARR server and node running in docker alongside plex container. Plex is using intel QSV without issue to transcode. The TDARR node does not use it and instead is always doing CPU transcode.

To Reproduce Docker Compose:

version: "3.3"
networks:
  tdarr_network:
    external: true

services:
  tdarr:
    image: ghcr.io/haveagitgat/tdarr:latest
    container_name: tdarr
    restart: unless-stopped
    networks:
      tdarr_network:
        ipv4_address: 172.21.0.10
    ports:
      - 8265:8265 # webUI port
      - 8266:8266 # server port
    volumes:
      - /media/DOCKER_LOCAL_PERSISTENT_DATA/tdarr/server:/app/server
      - /media/DOCKER_PERSISTENT_DATA/tdarr/configs:/app/configs
      - /media/DOCKER_PERSISTENT_DATA/tdarr/logs:/app/logs
      - /media/PLEX_DATA/data/media:/media
      - /media/PLEX_DATA/transcode/tdarr:/temp
      - /etc/timezone:/etc/timezone:ro
    env_file:
      - stack.env
    environment:
      - UMASK_SET=002
      - serverIP=172.21.0.10 #0.0.0.0
      - serverPort=8266
      - webUIPort=8265
      - inContainer=true
      - ffmpegVersion=6
    devices:
      - /dev/dri:/dev/dri
  tdarr-node:
    image: ghcr.io/haveagitgat/tdarr_node:latest
    container_name: tdarr-node
    restart: unless-stopped
    networks:
      tdarr_network:
        ipv4_address: 172.21.0.11
    volumes:
      - /media/DOCKER_PERSISTENT_DATA/tdarr/configs:/app/configs
      - /media/DOCKER_PERSISTENT_DATA/tdarr/logs:/app/logs
      - /media/PLEX_DATA/data/media:/media
      - /media/PLEX_DATA/transcode/tdarr:/temp
      - /etc/timezone:/etc/timezone:ro
    env_file:
      - stack.env
    environment:
      - UMASK_SET=002
      - nodeName=MyExternalNode
      - serverIP=172.21.0.10
      - serverPort=8266
      - inContainer=true
      - ffmpegVersion=6
    devices:
      - /dev/dri:/dev/dri

Using default Tdarr transcode steps: Tdarr_Plugin_MC93_Migz1FFMPEG_CPU

Docker test returns without issue:

docker run \
    --device=/dev/dri:/dev/dri \
    ghcr.io/haveagitgat/tdarr_node:latest \
    /bin/bash -e \
    -c 'ffmpeg \
            -hwaccel qsv -f lavfi -i color=c=black:s=256x256:d=1:r=30 \
            -c:v:0 hevc_qsv \
            -f null /dev/null'

FFMPEG Test returns without issue:

image

However when it runs I see my CPU gets hosed and there is not activity in the igpu:

image image

Expected behavior CPU Use should be minimal and Intel iGPU should be used for HW Accelerated Transcoding

Screenshots

image image

Please provide the following information:

supersnellehenk commented 2 months ago

You're using a CPU plugin and a CPU worker, you'll need to edit your transcode stack to use a QSV plugin and use a GPU worker.

marcaurelios commented 1 month ago

@matthewprobasco did a different GPU plugin fix your issue?

matthewprobasco commented 1 month ago

@marcaurelios unfortunately no. I have tried all of the intel QSV plugins and none of them would work.

dennix85 commented 1 month ago

Arc will not work in container since the Intel libraries are too old, only baremetall or vm node with on windows driver 5085 or lower and on Linux with all updated libraries according to your distrubution, only way to get it work

Edit: Don't forget to update handbrake cli and ffmpeg

marcaurelios commented 1 month ago

@matthewprobasco after tinkering around on tdarr for 3 weeks, I finally got it working with one specific Community Plugin: Boosh QSV FFMPEG transcoding with 70fps on a typical 1080p video running on a N100 MiniPC. These settings might get you also on track.

Using ghcr.io/haveagitgat/tdarr:latest and ghcr.io/haveagitgat/tdarr_node:latest without adding or updating any linux packages. The iHD driver for QSV (and the VAAPI driver) come with the libva package, which is pre-installed on the docker container. The Community Plugin by Boosh made all the difference for me:

image image image image image

Edit: Uploaded Screenshots.

mkozikowsk commented 1 week ago

@marcaurelios Thank you so much for your reply with the solution. It helps me a lot!