fix: use nvdec

This commit is contained in:
ziesorx 2025-09-25 22:16:19 +07:00
parent f9a67935d6
commit b919a1ebe2
5 changed files with 328 additions and 19 deletions

View file

@ -1,18 +1,54 @@
# Base image with all ML dependencies
# Base image with all ML dependencies and NVIDIA Video Codec SDK
FROM pytorch/pytorch:2.8.0-cuda12.6-cudnn9-runtime
# Install system dependencies
# Install system dependencies including GStreamer with NVDEC support
RUN apt update && apt install -y \
libgl1 \
libglib2.0-0 \
libgstreamer1.0-0 \
libgtk-3-0 \
libavcodec58 \
libgomp1 \
# GStreamer base
libgstreamer1.0-0 \
libgstreamer-plugins-base1.0-0 \
libgstreamer-plugins-bad1.0-0 \
gstreamer1.0-tools \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-libav \
# GStreamer Python bindings
python3-gst-1.0 \
# NVIDIA specific GStreamer plugins for hardware acceleration
gstreamer1.0-vaapi \
# FFmpeg with hardware acceleration support
ffmpeg \
libavcodec-extra \
libavformat58 \
libswscale5 \
libgomp1 \
# Additional codecs
libx264-155 \
libx265-179 \
# TurboJPEG for fast JPEG encoding
libturbojpeg0-dev \
&& rm -rf /var/lib/apt/lists/*
# Install NVIDIA DeepStream (includes hardware accelerated GStreamer plugins)
# This provides nvv4l2decoder, nvvideoconvert, etc.
RUN apt update && apt install -y \
wget \
software-properties-common \
&& wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb \
&& dpkg -i cuda-keyring_1.0-1_all.deb \
&& apt update \
&& apt install -y libnvidia-decode-535 \
&& rm -rf /var/lib/apt/lists/* cuda-keyring_1.0-1_all.deb
# Set environment variables for hardware acceleration
ENV OPENCV_FFMPEG_CAPTURE_OPTIONS="video_codec;h264_cuvid"
ENV GST_PLUGIN_PATH="/usr/lib/x86_64-linux-gnu/gstreamer-1.0"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
# Copy and install base requirements (ML dependencies that rarely change)
COPY requirements.base.txt .
RUN pip install --no-cache-dir -r requirements.base.txt