imagegenius / docker-immich

Monolithic (Single) Docker Container for Immich
GNU General Public License v3.0
513 stars 27 forks source link

Switch to jellyfin-ffmpeg for hardware transcoding #152

Closed GlenLowland closed 1 year ago

GlenLowland commented 1 year ago

Immich has switched to jellyfin-ffmpeg as it is required for hardware transcoding. See: https://github.com/immich-app/immich/blob/main/server/bin/install-ffmpeg.sh

martabal commented 1 year ago

Yes, I know it but I didn't have time to test it yet. For now, I only tested with intel QSV and it worked (see #148)

GlenLowland commented 1 year ago

I also can test Intel QSV only.

GlenLowland commented 1 year ago

@martabal I am running 1.72.1 and transcoding using Intel QSV doesn't work for me. Here are the logs:

[Nest] 467  - 08/07/2023, 7:02:51 PM     LOG [MediaService] Start encoding video 7debeaed-b81c-472c-9665-bd059b29d03a {"inputOptions":["-init_hw_device qsv=hw","-filter_hw_device hw"],"outputOptions":["-vcodec vp9_qsv","-g 256","-extbrc 1","-refs 5","-bf 7","-low_power 1","-acodec opus","-movflags faststart","-fps_mode passthrough","-v verbose","-vf format=nv12,hwupload=extra_hw_frames=64,scale_qsv=-1:720","-preset 6","-q:v 31"],"twoPass":false}
INFO:     127.0.0.1:37848 - "POST /sentence-transformer/encode-image HTTP/1.1" 200 OK
[Nest] 467  - 08/07/2023, 7:02:52 PM   ERROR [MediaRepository] ffmpeg version 5.1.2-3ubuntu1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
  configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Routing option strict to both codec and muxer layer
[AVHWDeviceContext @ 0x558c045b2600] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x558c045b2600] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x558c045b2600] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x558c045b2600] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x558c045b2600] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x558c045b2600] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x558c045b2600] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x558c045b2600] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.2 ().
[AVHWDeviceContext @ 0x558c045b2600] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x558c045b2100] Initialize MFX session: API version is 1.35, implementation version is 1.35
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/photos/library/admin/2023/08/07/PXL_20230807_174234015.TS.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 131072
    compatible_brands: isomiso2mp41
    creation_time   : 2023-08-07T17:43:03.000000Z
    location        : +00.0000-0.0000/
    location-eng    : +00.0000-0.0000/
    com.android.capture.fps: 30.000000
  Duration: 00:00:27.04, start: 0.000000, bitrate: 20201 kb/s
  Stream #0:0[0x1](eng): Data: none (mett / 0x7474656D), 50 kb/s (default)
    Metadata:
      creation_time   : 2023-08-07T17:43:03.000000Z
      handler_name    : MetaHandle
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      creation_time   : 2023-08-07T17:43:03.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Video: hevc (Main), 1 reference frame (hvc1 / 0x31637668), yuvj420p(pc, bt709, left), 1920x1080 (1920x1088), 19952 kb/s, SAR 1:1 DAR 16:9, 30 fps, 29.92 tbr, 90k tbn (default)
    Metadata:
      creation_time   : 2023-08-07T17:43:03.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
  Stream #0:3[0x4](eng): Data: none (mett / 0x7474656D) (default)
    Metadata:
      creation_time   : 2023-08-07T17:43:03.000000Z
      handler_name    : MetaHandle
Codec AVOption extbrc (Extended bitrate control) specified for output file #0 (/photos/encoded-video/f80c7eac-f9c4-429b-ae4a-bfd2816a8c21/7debeaed-b81c-472c-9665-bd059b29d03a.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:2 -> #0:0 (hevc (native) -> vp9 (vp9_qsv))
  Stream #0:1 -> #0:1 (aac (native) -> opus (native))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:2 @ 0x558c05383640] w:1920 h:1080 pixfmt:yuvj420p tb:1/90000 fr:359/12 sar:1/1
[auto_scale_0 @ 0x558c05385c40] w:iw h:ih flags:'' interl:0
[Parsed_format_0 @ 0x558c04b47040] auto-inserting filter 'auto_scale_0' between the filter 'graph 0 input from stream 0:2' and the filter 'Parsed_format_0'
[swscaler @ 0x558c05386f40] [swscaler @ 0x558c05394940] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c05386f40] [swscaler @ 0x558c053d7d00] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c05386f40] [swscaler @ 0x558c0541ac80] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c05386f40] [swscaler @ 0x558c0545dc00] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c05386f40] [swscaler @ 0x558c0549ec80] deprecated pixel format used, make sure you did set range correctly
[auto_scale_0 @ 0x558c05385c40] w:1920 h:1080 fmt:yuvj420p sar:1/1 -> w:1920 h:1080 fmt:nv12 sar:1/1 flags:0x0
[AVHWDeviceContext @ 0x558c054c4280] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.2 ().
[AVHWDeviceContext @ 0x558c054c4280] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x558c055128c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.2 ().
[AVHWDeviceContext @ 0x558c055128c0] Driver not found in known nonstandard list, using standard behaviour.
[Parsed_scale_qsv_2 @ 0x558c05382f80] Scaling mode: 0
[Parsed_scale_qsv_2 @ 0x558c05382f80] VPP: input is video memory surface
[Parsed_scale_qsv_2 @ 0x558c05382f80] VPP: output is video memory surface
[Parsed_scale_qsv_2 @ 0x558c05382f80] w:1920 h:1080 -> w:1280 h:720
[swscaler @ 0x558c0541ac80] [swscaler @ 0x558c0549b940] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0541ac80] [swscaler @ 0x558c0545a8c0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0541ac80] [swscaler @ 0x558c05485100] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0541ac80] [swscaler @ 0x558c054c6200] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0541ac80] [swscaler @ 0x558c0543ff80] deprecated pixel format used, make sure you did set range correctly
[auto_scale_0 @ 0x558c05385c40] w:1920 h:1080 fmt:yuvj420p sar:1/1 -> w:1920 h:1080 fmt:nv12 sar:1/1 flags:0x0
[swscaler @ 0x558c0545a8c0] [swscaler @ 0x558c05485100] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0545a8c0] [swscaler @ 0x558c054c6200] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0545a8c0] [swscaler @ 0x558c0543ff80] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0545a8c0] [swscaler @ 0x558c0544cf40] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0545a8c0] [swscaler @ 0x558c05688b00] deprecated pixel format used, make sure you did set range correctly
[auto_scale_0 @ 0x558c05385c40] w:1920 h:1080 fmt:yuvj420p sar:1/1 -> w:1920 h:1080 fmt:nv12 sar:1/1 flags:0x0
[swscaler @ 0x558c0545a8c0] [swscaler @ 0x558c05485100] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0545a8c0] [swscaler @ 0x558c054c6200] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0545a8c0] [swscaler @ 0x558c0543ff80] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0545a8c0] [swscaler @ 0x558c0544cf40] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c0545a8c0] [swscaler @ 0x558c05688b00] deprecated pixel format used, make sure you did set range correctly
[auto_scale_0 @ 0x558c05385c40] w:1920 h:1080 fmt:yuvj420p sar:1/1 -> w:1920 h:1080 fmt:nv12 sar:1/1 flags:0x0
[vp9_qsv @ 0x558c04684a80] Using input frames context (format qsv) with vp9_qsv encoder.
[vp9_qsv @ 0x558c04684a80] Encoder: input is video memory surface
[vp9_qsv @ 0x558c04684a80] Using the constant quantization parameter (CQP) ratecontrol method
[vp9_qsv @ 0x558c04684a80] Error querying encoder params: unsupported (-3)
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
[AVIOContext @ 0x558c04687d40] Statistics: 0 bytes written, 0 seeks, 0 writeouts
[AVIOContext @ 0x558c04637400] Statistics: 2693433 bytes read, 5 seeks
Conversion failed!

[Nest] 467  - 08/07/2023, 7:02:52 PM   ERROR [MediaService] Error: ffmpeg exited with code 1: Conversion failed!

[Nest] 467  - 08/07/2023, 7:02:52 PM   ERROR [MediaService] Error occurred during transcoding. Retrying with QSV acceleration disabled.

I am using Intel 11th gen, followed all the guides and set up the system properly as transcoding is working fine in Jellyfin. /dev/dri device is passed to the container. I tried transcoding to both HEVC and VP9 with the same result. Also tried to specify max bitrate (2600k) or no bitrate (0) with the same result. When I switch immich to use VA-API the transcoding starts working. So only problem with Intel QSV. But on Jellyfin QSV works fine.

martabal commented 1 year ago

Thanks for the report @GlenLowland !

Indeed vp9 does not really like it... However, It seems there's no errors with transcoding to h264 or h265

martabal commented 1 year ago

I tried it and the conclusion is ... weird.

It seems to be a driver issue with the vp9 encoder.

https://en.wikipedia.org/wiki/VP9#Hardware_implementations https://github.com/intel/media-driver/issues/771 https://www.reddit.com/r/VP9/comments/g9uzzv/comment/jfj45ji/?utm_source=share&utm_medium=web2x&context=3

GlenLowland commented 1 year ago

I wasn't able to try #161 (see my comment in the PR). But as for my setup even HEVC transcoding doesn't work unfortunately. I wonder wether jellyfin-ffmpeg will solve it.

dsippel commented 1 year ago

For me hardware accelerated transcoding via intel quicksync is also not working. Might be related to this issue here?

https://github.com/immich-app/immich/issues/3595

Could you add this to the image?

martabal commented 1 year ago

Currently, we can't reproduce it with our hardware, but if you provide logs and more contexts to your issues we'll certainly merge it !

Did you test with the linuxserver/mods:jellyfin-opencl-intel docker mod ?

dsippel commented 1 year ago

Nope. How do I add this to this image here?

martabal commented 1 year ago

Add

    environment:
      - DOCKER_MODS=linuxserver/mods:jellyfin-opencl-intel

to your docker-compose

dsippel commented 1 year ago

Thanks. Added it, but it still doesn't seem to work. Uploaded a video. I get this in the Docker log:

[Nest] 1049 - 08/09/2023, 8:50:15 PM LOG [MediaService] Generating video thumbnail [Nest] 1049 - 08/09/2023, 8:50:18 PM LOG [MediaService] Successfully generated video thumbnail 57838798-9b6a-4d2e-829c-ddb193df89d2 [Nest] 1049 - 08/09/2023, 8:50:19 PM LOG [MediaService] Start encoding video 57838798-9b6a-4d2e-829c-ddb193df89d2 {"inputOptions":["-init_hw_device qsv=hw","-filter_hw_device hw"],"outputOptions":["-vcodec h264_qsv","-g 256","-extbrc 1","-refs 5","-bf 7","-acodec aac","-movflags faststart","-fps_mode passthrough","-v verbose","-vf format=nv12,hwupload=extra_hw_frames=64,scale_qsv=-1:720","-preset 6","-global_quality 23"],"twoPass":false} INFO: 127.0.0.1:45962 - "POST /image-classifier/tag-image HTTP/1.1" 200 OK INFO: 127.0.0.1:45974 - "POST /sentence-transformer/encode-image HTTP/1.1" 200 OK INFO: 127.0.0.1:45972 - "POST /facial-recognition/detect-faces HTTP/1.1" 200 OK [Nest] 453 - 08/09/2023, 8:50:35 PM LOG [CommunicationGateway] Client JCxw5Tc6L4TMT-ONAAAD disconnected from Websocket [Nest] 453 - 08/09/2023, 8:50:36 PM LOG [CommunicationGateway] Client 4VkeEMOjVDNxBnB0AAAB disconnected from Websocket [Nest] 1049 - 08/09/2023, 8:57:24 PM LOG [MediaService] Encoding success 57838798-9b6a-4d2e-829c-ddb193df89d2

The CPU still maxes out with ffmpeg. How can I tell if hw transcoding is working or not?

Here are my ffmepg settings on the web interface:

Screenshot 2023-08-09 at 21 01 14

Also: the /dev/dri pass through to the docker works great for Plex for example...

martabal commented 1 year ago

Where's the problem ? The video is correctly encoded (LOG [MediaService] Encoding success 57838798-9b6a-4d2e-829c-ddb193df89d2)

dsippel commented 1 year ago

I know it is correctly encoded. But it's not using the intel GPU as far as I can tell. The CPU is maxing out and it took 7 min to transcode the 1 min video

martabal commented 1 year ago

Oh sorry, I misunderstood. But from your logs, it is using your GPU. Can you check your gpu usage with intel_gpu_top ?

dsippel commented 1 year ago

Very strange. It seems to use the GPU, yet ffmpeg uses a lot of CPU... here are some screenshots.

Screenshot 2023-08-09 at 22 00 28 Screenshot 2023-08-09 at 22 01 18

PS: I limited the docker to only use 6 CPU cores otherwise it would completely block the machine...

martabal commented 1 year ago

You can test if it's better with this image ghcr.io/imagegenius/igpipepr-immich:1.72.2-PR-161. If it's not, it's definitely an upstream issue

dsippel commented 1 year ago

Thanks for all the help and effort! Hmm. It's the same with this image. FFMPEG still maxes out the CPU. Intel_gpu_top shows the utilization of the GPU which remains very low. Maybe it's something in the FFMPEG options that's causing this. Unfortunately I know too little about these options.

Here is the log output for the ffmpeg transcoding: [Nest] 1071 - 08/10/2023, 5:26:06 AM LOG [MediaService] Start encoding video e7535b7b-9452-4c80-a2e0-d5cbe377d9c3 {"inputOptions":["-init_hw_device qsv=hw","-filter_hw_device hw"],"outputOptions":["-vcodec h264_qsv","-g 256","-extbrc 1","-refs 5","-bf 7","-acodec aac","-movflags faststart","-fps_mode passthrough","-v verbose","-vf format=nv12,hwupload=extra_hw_frames=64,scale_qsv=-1:720","-preset 7","-global_quality 23"],"twoPass":false}

Any suggestions?

martabal commented 1 year ago

If you have the same results with the jellyfin ffmpeg, it's probably an Immich issue.

Deathproof76 commented 1 year ago

I had to do some troubleshooting to get my 13th gen UHD 770, which absolutely refuses ffmpeg5, working. I ended up with the following one shot script to start the container, install jellyfin ffmpeg6 and to also set permissions for /dev/dri straight:

#!/bin/bash
#### assuming that you execute from the same folder as your docker-compose.yml, purely optional but it makes sense to get everything  to start together
docker compose pull
docker compose up -d

#### download and install current jellyfin ffmpeg within the docker container named immich
#### also appended DOCKER_MODS=linuxserver/mods:jellyfin-opencl-intel  in the docker-compose.yml in the evironment section
####a lib for the igpu driver seems to be broken, which is why I also added apt --fix-broken install. maybe due to the dockermod, haven't tested further
docker exec -it immich bash -c "apt update && \
    apt upgrade -y && \
    apt --fix-broken install -y &&  \
    apt install -y wget && \
    wget https://repo.jellyfin.org/releases/server/ubuntu/versions/jellyfin-ffmpeg/6.0-5/jellyfin-ffmpeg6_6.0-5-lunar_amd64.deb && \
    apt install -y ./jellyfin-ffmpeg6_6.0-5-lunar_amd64.deb && \
    rm -rf ./jellyfin-ffmpeg6_6.0-5-lunar_amd64.deb && \
    ln -sf /usr/lib/jellyfin-ffmpeg/ffmpeg /usr/bin/ffmpeg && \
    ln -sf /usr/lib/jellyfin-ffmpeg/ffprobe /usr/bin/ffprobe"

###also had a permissions issue, the abc user didn't have access to /dev/dri; most likely due to  "environment: - PUID=1000 - PGID=1000" in the compose, which is fixed by this
DOCKER_COMMANDS=$(cat << EOM
groupadd render;
usermod -a -G render abc;
chown :render /dev/dri/renderD128 /dev/dri/card0;
chmod g+rw /dev/dri/renderD128 /dev/dri/card0;
EOM
)

docker exec -it immich bash -c "$DOCKER_COMMANDS"

I just start this as start.sh from the folder where my immich docker-compose.yml is located and qsv "just works™"

edit: btw encoding to vp9 via vaapi only produced low bitrate video regardless of settings. Don't know why, but seems to be the same on the host machine, which is why I tried to get qsv going

martabal commented 1 year ago

Thanks for the feedback @Deathproof76. Did you try with this image ghcr.io/imagegenius/igpipepr-immich:1.72.2-pr-161 ?

Deathproof76 commented 1 year ago

will do and report back tomorrow 👍

martabal commented 1 year ago

@GlenLowland Can you confirm your transcoding issue is solved ?

GlenLowland commented 1 year ago

@martabal I've done some basic tests, it works now! HEVC video shot on my phone has been GPU transcoded to VP9!

Deathproof76 commented 1 year ago

Thanks for the feedback @Deathproof76. Did you try with this image ghcr.io/imagegenius/igpipepr-immich:1.72.2-pr-161 ?

Sorry for the delay. I already upgraded to ghcr.io/imagegenius/igpipepr-immich:1.73.0-PR-161. For this one I don't have to install jellyfin ffmpeg. But I still need - DOCKER_MODS=linuxserver/mods:jellyfin-opencl-intel and also part of my script due to permissions:

DOCKER_COMMANDS=$(cat << EOM
groupadd render;
usermod -a -G render abc;
chown :render /dev/dri/renderD128 /dev/dri/card0;
chmod g+rw /dev/dri/renderD128 /dev/dri/card0;
EOM
)

# Execute the commands inside the Docker container named immich
docker exec -it immich bash -c "$DOCKER_COMMANDS"

Here's my full docker-compose.yml:

---
version: "2.1"
services:
  immich:
    image: ghcr.io/imagegenius/immich:1.73.0-PR-161
    devices:
      - /dev/dri/card0:/dev/dri/card0
      - /dev/dri/renderD128:/dev/dri/renderD128
    container_name: immich
    restart: unless-stopped
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - DB_HOSTNAME=xxxxxxxxxxx
      - DB_USERNAME=postgres
      - DB_PASSWORD=postgres
      - DB_DATABASE_NAME=immich
      - REDIS_HOSTNAME=xxxxxxxxxxxxxxx
      - DISABLE_MACHINE_LEANRNING=false #optional
      - DISABLE_TYPESENSE=false #optional
      - DB_PORT=xxxxx#optional
      - REDIS_PORT=xxxxx#optional
      - REDIS_PASSWORD=xxxxxxxxx
      - CUDA_ACCELERATION=false #optional
      - DOCKER_MODS=linuxserver/mods:jellyfin-opencl-intel
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]
    volumes:
      - /mnt/Dockerspace/immich/config:/config
      - /mnt/Dockerspace/immich/photos:/photos
      - /mnt/Dockerspace/immich/machine-learning:/config/machine-learning #optional
    ports:
      -xxxxxxxxxxxxxx

  redis2:
    image: redis
    ports:
      - xxxxxxxxxxxx
    container_name: redis2
    restart: unless-stopped
    command: redis-server --requirepass xxxxxxxxxxxxxx

  postgres14:
    image: postgres:14
    ports:
      - xxxxxxxxxxxx
    container_name: postgres14
    restart: unless-stopped
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: immich
    volumes:
      - /mnt/Dockerspace/immich/postgres:/var/lib/postgresql/data

If I don't use the script I get:

immich      | [Nest] 1038  - 08/17/2023, 1:43:23 PM   ERROR [MediaRepository] ffmpeg version 6.0-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
immich      |   built with gcc 12 (Ubuntu 12.3.0-1ubuntu1~23.04)
immich      |   configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
immich      |   libavutil      58.  2.100 / 58.  2.100
immich      |   libavcodec     60.  3.100 / 60.  3.100
immich      |   libavformat    60.  3.100 / 60.  3.100
immich      |   libavdevice    60.  1.100 / 60.  1.100
immich      |   libavfilter     9.  3.100 /  9.  3.100
immich      |   libswscale      7.  1.100 /  7.  1.100
immich      |   libswresample   4. 10.100 /  4. 10.100
immich      |   libpostproc    57.  1.100 / 57.  1.100
immich      | [AVHWDeviceContext @ 0x55d2fc40fb00] Failed to open /dev/dri/card0 as DRM device node.
immich      | [AVHWDeviceContext @ 0x55d2fc40fb00] No VA display found for device /dev/dri/card0.
immich      | Device creation failed: -22.
immich      | Failed to set value 'vaapi=accel:/dev/dri/card0' for option 'init_hw_device': Invalid argument
immich      | Error parsing global options: Invalid argument
immich      | 
immich      | [Nest] 1038  - 08/17/2023, 1:43:23 PM   ERROR [MediaService] Error: ffmpeg exited with code 1: Device creation failed: -22.
immich      | Failed to set value 'vaapi=accel:/dev/dri/card0' for option 'init_hw_device': Invalid argument
immich      | Error parsing global options: Invalid argument
immich      | 
immich      | [Nest] 1038  - 08/17/2023, 1:43:23 PM   ERROR [MediaService] Error occurred during transcoding. Retrying with VAAPI acceleration disabled.
immich      | [Nest] 1038  - 08/17/2023, 1:43:23 PM     LOG [MediaService] Encoding success 7f7943d1-303b-49c8-80cd-2aea83f3c8f9
immich      | [Nest] 1038  - 08/17/2023, 1:43:24 PM     LOG [MediaService] Start encoding video d259fd11-fbfe-4f03-8f6d-a48f946ccd7b {"inputOptions":["-init_hw_device vaapi=accel:/dev/dri/card0","-filter_hw_device accel"],"outputOptions":["-vcodec vp9_vaapi","-acodec aac","-movflags faststart","-fps_mode passthrough","-v verbose","-vf format=nv12,hwupload","-compression_level 3","-threads 14","-b:v 5414k","-maxrate 7850k","-minrate 2707k","-rc_mode 3"],"twoPass":false}
immich      | [Nest] 1038  - 08/17/2023, 1:43:24 PM   ERROR [MediaRepository] ffmpeg version 6.0-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers

Haven't tried with

    environment:
      - PUID=0
      - PGID=0

But it might be related

martabal commented 1 year ago

@GlenLowland Awesome !

@Deathproof76 I created a PR for your issue (#168), please pull ghcr.io/imagegenius/igpipepr-immich:1.73.0-pr-168 once it's built. You won't need your custom docker mod anymore

Deathproof76 commented 1 year ago

@martabal Just wanted to confirm that hw transcoding is working without additional dockermods or scripts 👍 thank you very much!

martabal commented 1 year ago

Nice !