datarhei / restreamer

The Restreamer is a complete streaming server solution for self-hosting. It has a visually appealing user interface and no ongoing license costs. Upload your live stream to YouTube, Twitch, Facebook, Vimeo, or other streaming solutions like Wowza. Receive video data from OBS and publish it with the RTMP and SRT server.
https://docs.datarhei.com/restreamer/
Apache License 2.0
3.78k stars 438 forks source link

Docker Compose with enconding nvidia cuda (NVENC) support #795

Closed danielgoz closed 3 weeks ago

danielgoz commented 1 month ago

Hi there.

I love the app but it is killing my CPU :-(

I am running it in docker with nvidia toolkit (other containers i.e frigate using the gpu all good)

how should I set my docker compose to enable NVENC encoding?

my current docker compose:

version: '3.3'
services:
    restreamer:
        container_name: restreamer
        volumes:
            - './config:/core/config'
            - './data:/core/data'
        ports:
            - '8080:8080'
            - '8181:8181'
            - '1935:1935'
            - '1936:1936'
            - '6000:6000/udp'
        restart: always
        image: 'datarhei/restreamer:cuda-latest'
        runtime: nvidia
        environment:
          - NVIDIA_DRIVER_CAPABILITIES=all
          - NVIDIA_VISIBLE_DEVICES=all
        deploy:
          resources:
            reservations:
              devices:
                - driver: nvidia
                  capabilities: [gpu]
        devices:
          - /dev/dri:/dev/dri

Thanks

danielgoz commented 1 month ago

figured it out. it should be:

version: '3.3'
services:
    restreamer:
        container_name: restreamer
        volumes:
            - './config:/core/config'
            - './data:/core/data'
        ports:
            - '8080:8080'
            - '8181:8181'
            - '1935:1935'
            - '1936:1936'
            - '6000:6000/udp'
        restart: always
        image: 'datarhei/restreamer:cuda-latest'
        runtime: nvidia

now, how do I know if it is indeed using the GPU. I can see this in nvidia-smi:

| 0 N/A N/A 247564 C /usr/local/bin/ffmpeg 306MiB |

is that it?

ioppermann commented 3 weeks ago

If you see the process in nvidia-smi then it's using the GPU for encoding.