refactor: build FFmpeg from source with NVIDIA CUDA support and remove unnecessary development libraries
Some checks failed
Build Worker Base and Application Images / check-base-changes (push) Successful in 8s
Build Worker Base and Application Images / build-base (push) Failing after 4m23s
Build Worker Base and Application Images / build-docker (push) Has been skipped
Build Worker Base and Application Images / deploy-stack (push) Has been skipped

This commit is contained in:
Siwat Sirichai 2025-09-26 00:41:49 +07:00
parent 59e8448f0d
commit e2e5356047

View file

@ -24,14 +24,6 @@ RUN apt-get update && apt-get install -y \
libvpx-dev \ libvpx-dev \
libmp3lame-dev \ libmp3lame-dev \
libv4l-dev \ libv4l-dev \
# FFmpeg development libraries for OpenCV integration
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libavdevice-dev \
libavfilter-dev \
libswscale-dev \
libswresample-dev \
# TurboJPEG for fast JPEG encoding # TurboJPEG for fast JPEG encoding
libturbojpeg0-dev \ libturbojpeg0-dev \
# Python development # Python development
@ -52,14 +44,35 @@ RUN cd /tmp && \
make install && \ make install && \
rm -rf /tmp/* rm -rf /tmp/*
# Download and install prebuilt FFmpeg with CUDA support # Build FFmpeg from source with NVIDIA CUDA support
RUN cd /tmp && \ RUN cd /tmp && \
echo "Installing prebuilt FFmpeg with CUDA support..." && \ echo "Building FFmpeg with NVIDIA CUDA support..." && \
wget https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz && \ # Download FFmpeg source
tar -xf ffmpeg-master-latest-linux64-gpl.tar.xz && \ wget https://ffmpeg.org/releases/ffmpeg-7.1.tar.xz && \
cd ffmpeg-master-latest-linux64-gpl && \ tar -xf ffmpeg-7.1.tar.xz && \
# Copy binaries to system paths cd ffmpeg-7.1 && \
cp bin/* /usr/local/bin/ && \ # Configure with NVIDIA support
./configure \
--prefix=/usr/local \
--enable-shared \
--enable-pic \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--enable-cuda-nvcc \
--enable-cuvid \
--enable-nvdec \
--enable-nvenc \
--enable-libnpp \
--extra-cflags=-I/usr/local/cuda/include \
--extra-ldflags=-L/usr/local/cuda/lib64 \
--enable-libx264 \
--enable-libx265 \
--enable-libvpx \
--enable-libmp3lame && \
# Build and install
make -j$(nproc) && \
make install && \
ldconfig && \ ldconfig && \
# Verify CUVID decoders are available # Verify CUVID decoders are available
echo "=== Verifying FFmpeg CUVID Support ===" && \ echo "=== Verifying FFmpeg CUVID Support ===" && \