HW acceleration seems to function poorly on RTX 3060 Ti #3299

Closed
opened 2026-02-05 08:09:31 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @kjkent on GitHub (May 27, 2024).

The bug

If this is expected behavior, I apologize for the noise. It appears that ffmpeg may not be fully utilizing hardware acceleration on my machine, with an RTX 3060 Ti, as transcoding looks like it's hitting the CPU (Ryzen 3600X) far harder than the GPU. Running 6 concurrent transcoding jobs (to 1080p/HEVC/Opus), I'm seeing ~40-60% CPU use across 12 cores but only ~9% GPU utilization with 3.3G of 8G GPU memory used:

btop:
image

nvidia-smi:
image

The OS that Immich Server is running on

Arch (6.9.2-arch1-1)

Version of Immich Server

v1.105.1

Version of Immich Mobile App

N/A

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

x-immich-env: &immich-env
  env_file: ./.env
  restart: always
  user: ${UID}:${GID}
  networks:
    - immich

services:
  immich-server:
    <<: *immich-env
    command: [ "start.sh", "immich" ]
    container_name: immich-server
    image: ghcr.io/immich-app/immich-server:release
    labels:
      traefik.enable: "true"
      traefik.http.services.immich.loadbalancer.server.port: "3001"
      traefik.http.routers.immich.entrypoints: "websecure"
      traefik.http.routers.immich.rule: "Host(`immich.<redacted url>`)"
    networks:
      - traefik-proxy
      - immich
    volumes:
      - ./media:/usr/src/app/upload
      - ./import:/import:ro
    depends_on:
      - immich-redis
      - immich-postgres

  immich-microservices:
    <<: *immich-env
    container_name: immich-microservices
    command: [ "start.sh", "microservices" ]
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities:
                - gpu
                - compute
                - video
    image: ghcr.io/immich-app/immich-server:release
    volumes:
      - ./media:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - ./reverse-geocoding-dump:/usr/src/app/.reverse-geocoding-dump
    depends_on:
      - immich-redis
      - immich-postgres

  immich-machine-learning:
    <<: *immich-env
    container_name: immich-machine-learning
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities:
                - gpu
    image: ghcr.io/immich-app/immich-machine-learning:release-cuda
    volumes:
      - ml_model-cache:/cache
      - ml_dot-cache:/.cache
      - ./ml_config:/.config

  immich-redis:
    <<: *immich-env
    container_name: immich-redis
    image: redis:6.2-alpine
    volumes:
      - ./redis:/data

  immich-postgres:
    <<: *immich-env
    command: ["postgres", "-c" ,"shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"]
    container_name: immich-postgres
    image: tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0 
    environment:
      POSTGRES_USER: "${DB_USERNAME}"
      POSTGRES_PASSWORD: "${DB_PASSWORD}"
      POSTGRES_DB: "${DB_DATABASE_NAME}"
      PGDATA: '/var/lib/postgresql/data/pgdata'
      POSTGRES_INITDB_ARGS: '--data-checksums'
      # SElinux fixes// :z == shared mount || :Z == private unshared mount
    volumes:
      - ./postgres:/var/lib/postgresql/data:Z

networks:
  immich:
    name: "immich"
  traefik-proxy:
    external: true

volumes:
  ml_model-cache:
  ml_dot-cache:

Your .env content

DB_USERNAME=kjkent
DB_PASSWORD=<redacted>
DB_DATABASE_NAME=immich
DB_HOSTNAME=immich-postgres
REDIS_HOSTNAME=immich-redis
PGDATA=/var/lib/postgresql/data/pgdata

API_TOKEN=<redacted> // this is read by a script to import images via the server's cli


### Reproduction steps

```bash
1. Start a transcode of all videos via the web GUI with the following settings:

{
  "ffmpeg": {
    "crf": 28,
    "threads": 0,
    "preset": "slower",
    "targetVideoCodec": "hevc",
    "acceptedVideoCodecs": [
      "hevc"
    ],
    "targetAudioCodec": "libopus",
    "acceptedAudioCodecs": [
      "libopus"
    ],
    "targetResolution": "1080",
    "maxBitrate": "0",
    "bframes": -1,
    "refs": 0,
    "gopSize": 0,
    "npl": 0,
    "temporalAQ": true,
    "cqMode": "auto",
    "twoPass": true,
    "preferredHwDevice": "auto",
    "transcode": "optimal",
    "tonemap": "hable",
    "accel": "nvenc"
  },
  "job": {
    "thumbnailGeneration": {
      "concurrency": 6
    },
    "videoConversion": {
      "concurrency": 6
    }
  }
}

2.
3.
...

Relevant log output

In terms of log output, when I had the jobs set to ~15 instead of six, it maxed out the CPU yet GPU utilization stayed low, however I did get a CUDA error from `immich-microservices` where it failed to allocate memory.

Aside from this, pretty much 0 log output from the microservices container aside from a websocket initialization notice.

Additional information

I'm hesitant to report this as it may just be my misaligned settings. I do have another bug to report where I think the server is responding with an inappropriate status code when videos are requested from Chrome, when Immich is behind a reverse proxy with gzip encoding enabled. I'm going to verify and get more info before filing that.

I noticed that 3dd34280a2 changes the settings for nvenc & introduces nvdec so I can see if there's any difference by bumping my container images to main

Thank you for developing Immich -- it's an incredible undertaking, implemented incredibly well! I hope one day to contribute.

Originally created by @kjkent on GitHub (May 27, 2024). ### The bug If this is expected behavior, I apologize for the noise. It appears that ffmpeg may not be fully utilizing hardware acceleration on my machine, with an RTX 3060 Ti, as transcoding looks like it's hitting the CPU (Ryzen 3600X) far harder than the GPU. Running 6 concurrent transcoding jobs (to 1080p/HEVC/Opus), I'm seeing ~40-60% CPU use across 12 cores but only ~9% GPU utilization with 3.3G of 8G GPU memory used: `btop`: ![image](https://github.com/immich-app/immich/assets/96310790/d88c39ea-9ab3-419c-9c1a-0c04c8cea7d8) `nvidia-smi`: ![image](https://github.com/immich-app/immich/assets/96310790/7bc21fb5-52c4-47f5-9c69-5ee4bc990ac2) ### The OS that Immich Server is running on Arch (6.9.2-arch1-1) ### Version of Immich Server v1.105.1 ### Version of Immich Mobile App N/A ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML x-immich-env: &immich-env env_file: ./.env restart: always user: ${UID}:${GID} networks: - immich services: immich-server: <<: *immich-env command: [ "start.sh", "immich" ] container_name: immich-server image: ghcr.io/immich-app/immich-server:release labels: traefik.enable: "true" traefik.http.services.immich.loadbalancer.server.port: "3001" traefik.http.routers.immich.entrypoints: "websecure" traefik.http.routers.immich.rule: "Host(`immich.<redacted url>`)" networks: - traefik-proxy - immich volumes: - ./media:/usr/src/app/upload - ./import:/import:ro depends_on: - immich-redis - immich-postgres immich-microservices: <<: *immich-env container_name: immich-microservices command: [ "start.sh", "microservices" ] deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: - gpu - compute - video image: ghcr.io/immich-app/immich-server:release volumes: - ./media:/usr/src/app/upload - /etc/localtime:/etc/localtime:ro - ./reverse-geocoding-dump:/usr/src/app/.reverse-geocoding-dump depends_on: - immich-redis - immich-postgres immich-machine-learning: <<: *immich-env container_name: immich-machine-learning deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: - gpu image: ghcr.io/immich-app/immich-machine-learning:release-cuda volumes: - ml_model-cache:/cache - ml_dot-cache:/.cache - ./ml_config:/.config immich-redis: <<: *immich-env container_name: immich-redis image: redis:6.2-alpine volumes: - ./redis:/data immich-postgres: <<: *immich-env command: ["postgres", "-c" ,"shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"] container_name: immich-postgres image: tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0 environment: POSTGRES_USER: "${DB_USERNAME}" POSTGRES_PASSWORD: "${DB_PASSWORD}" POSTGRES_DB: "${DB_DATABASE_NAME}" PGDATA: '/var/lib/postgresql/data/pgdata' POSTGRES_INITDB_ARGS: '--data-checksums' # SElinux fixes// :z == shared mount || :Z == private unshared mount volumes: - ./postgres:/var/lib/postgresql/data:Z networks: immich: name: "immich" traefik-proxy: external: true volumes: ml_model-cache: ml_dot-cache: ``` ### Your .env content ```Shell DB_USERNAME=kjkent DB_PASSWORD=<redacted> DB_DATABASE_NAME=immich DB_HOSTNAME=immich-postgres REDIS_HOSTNAME=immich-redis PGDATA=/var/lib/postgresql/data/pgdata API_TOKEN=<redacted> // this is read by a script to import images via the server's cli ``` ``` ### Reproduction steps ```bash 1. Start a transcode of all videos via the web GUI with the following settings: { "ffmpeg": { "crf": 28, "threads": 0, "preset": "slower", "targetVideoCodec": "hevc", "acceptedVideoCodecs": [ "hevc" ], "targetAudioCodec": "libopus", "acceptedAudioCodecs": [ "libopus" ], "targetResolution": "1080", "maxBitrate": "0", "bframes": -1, "refs": 0, "gopSize": 0, "npl": 0, "temporalAQ": true, "cqMode": "auto", "twoPass": true, "preferredHwDevice": "auto", "transcode": "optimal", "tonemap": "hable", "accel": "nvenc" }, "job": { "thumbnailGeneration": { "concurrency": 6 }, "videoConversion": { "concurrency": 6 } } } 2. 3. ... ``` ### Relevant log output ```shell In terms of log output, when I had the jobs set to ~15 instead of six, it maxed out the CPU yet GPU utilization stayed low, however I did get a CUDA error from `immich-microservices` where it failed to allocate memory. Aside from this, pretty much 0 log output from the microservices container aside from a websocket initialization notice. ``` ### Additional information I'm hesitant to report this as it may just be my misaligned settings. I do have another bug to report where I think the server is responding with an inappropriate status code when videos are requested from Chrome, when Immich is behind a reverse proxy with gzip encoding enabled. I'm going to verify and get more info before filing that. I noticed that https://github.com/immich-app/immich/pull/9452/commits/3dd34280a265044a4cd9863f22ed06a12627bfc7 changes the settings for nvenc & introduces nvdec so I can see if there's any difference by bumping my container images to `main` Thank you for developing Immich -- it's an incredible undertaking, implemented incredibly well! I hope one day to contribute.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#3299