Sign inSign up

thaigps/livekit-gpu

By thaigps

Updated 4 months ago

Image
0

109

thaigps/livekit-gpu repository overview

LiveKit Server with NVIDIA GPU Support

A Dockerized LiveKit server bundled with FFmpeg compiled for NVIDIA NVENC/NVDEC, suitable for live streaming workloads that benefit from hardware-accelerated transcoding.

Prerequisites on Host

  1. NVIDIA Driver (>= 535 recommended)

    nvidia-smi   # should print your GPU info
    
  2. NVIDIA Container Toolkit

    distribution=$(. /etc/os-release; echo $ID$VERSION_ID)
    curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | \
        sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
    curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
        sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
        sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
    
    sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
    sudo nvidia-ctk runtime configure --runtime=docker
    sudo systemctl restart docker
    
  3. Verify

    docker run --rm --gpus all nvidia/cuda:12.4.1-base-ubuntu22.04 nvidia-smi
    

Build & Run

docker compose build
docker compose up -d
docker compose logs -f

Verify GPU + FFmpeg inside the container

# GPU visible?
docker compose exec livekit nvidia-smi

# NVENC encoders available?
docker compose exec livekit ffmpeg -hide_banner -encoders | grep nvenc

# Quick transcode test
docker compose exec livekit ffmpeg -f lavfi -i testsrc=duration=5:size=1280x720:rate=30 \
    -c:v h264_nvenc -f null -

Important Notes

  • GPU arch: The Dockerfile compiles FFmpeg for compute_75 (Turing — RTX 20-series, T4). Adjust --nvccflags in the FFmpeg build stage for your GPU:
    • Ampere (RTX 30-series, A100): compute_86
    • Ada Lovelace (RTX 40-series): compute_89
    • Hopper (H100): compute_90
  • Networking: network_mode: host is recommended for WebRTC. If you must use bridge networking, expose the full UDP range (50000-60000) which can be slow on Docker Desktop.
  • Production keys: Replace the keys section in livekit.yaml. Generate with:
    docker compose exec livekit livekit-server generate-keys
    
  • External IP: For public deployments, set rtc.external_ip in livekit.yaml to your server's public IP, or rely on use_external_ip: true if the server can detect it via STUN.
  • Ingress/Egress: This image runs the LiveKit server only. For RTMP ingress or recording, deploy livekit-ingress and livekit-egress as separate services — both can use this same GPU-enabled FFmpeg base.

Connecting a client

Default dev credentials (CHANGE FOR PRODUCTION):

  • URL: ws://YOUR_HOST:7880
  • API Key: devkey
  • Secret: secretsecretsecretsecretsecretsecret

Generate a token:

docker compose exec livekit livekit-server create-token \
    --api-key devkey --api-secret secretsecretsecretsecretsecretsecret \
    --join --room test-room --identity test-user

Tag summary

Content type

Image

Digest

sha256:4522341d5

Size

1.5 GB

Last updated

4 months ago

docker pull thaigps/livekit-gpu