Hello! I’m making Dokerfile image for my python script + ffmpeg
I have docker image:
# Use the NVIDIA CUDA base image with the desired CUDA version
FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu20.04
# Set environment variables to prevent interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies and set timezone non-interactively
RUN apt-get update && apt-get install -y \
tzdata \
build-essential \
pkg-config \
git \
wget \
yasm \
nasm \
libx264-dev \
libx265-dev \
libnuma-dev \
libvpx-dev \
libfdk-aac-dev \
libmp3lame-dev \
libopus-dev \
libass-dev \
libfreetype6-dev \
libfontconfig1-dev \
python3.9 \
python3.9-venv \
python3.9-dev \
curl \
htop \
&& ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*
# Update alternatives to set python3.9 as default
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 \
&& update-alternatives --set python3 /usr/bin/python3.9
# Install pip for Python 3.9
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.9
# Set environment variables for CUDA
ENV PATH=/usr/local/cuda/bin:${PATH}
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
# Install Jupyter and other Python dependencies
RUN pip3 install jupyter jupyterlab
# Clone FFmpeg source
RUN git clone https://github.com/FFmpeg/FFmpeg.git /ffmpeg
RUN git clone https://github.com/FFmpeg/nv-codec-headers.git /nv-codec-headers
# Install nv-codec-headers
WORKDIR /nv-codec-headers
RUN make
RUN make install
# Build FFmpeg with NVIDIA support
WORKDIR /ffmpeg
RUN ./configure \
--prefix=/usr/local \
--enable-cuda-nvcc \
--enable-cuvid \
--enable-nvenc \
--enable-nonfree \
--enable-libnpp \
--extra-cflags=-I/usr/local/cuda/include \
--extra-ldflags=-L/usr/local/cuda/lib64 \
--enable-gpl \
--enable-libx264 \
--enable-libx265 \
--enable-libvpx \
--enable-libfdk-aac \
--enable-libmp3lame \
--enable-libopus \
--enable-libass \
--enable-libfreetype \
--enable-libfontconfig \
&& make -j$(nproc) \
&& make install \
&& make clean
# Install TensorRT dependencies
RUN apt-get update && apt-get install -y \
libnvinfer8 \
libnvonnxparsers8 \
libnvparsers8 \
libnvinfer-plugin8 \
&& rm -rf /var/lib/apt/lists/*
# Install TensorRT Python package
RUN pip3 install nvidia-pyindex \
&& pip3 install onnxruntime-gpu \
&& pip3 install opencv-python \
&& pip3 install onnx
# Verify installation
RUN ffmpeg -version
# Expose the Jupyter Notebook port
EXPOSE 8888
# Set the working directory
WORKDIR /superres
# Set entrypoint to Jupyter lab
ENTRYPOINT ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root", "--NotebookApp.token=''", "--NotebookApp.iopub_data_rate_limit=1.0e10"]
And I have few problems:
1)When I run this command: ffmpeg -i test_video_720p.mp4 -c:v h264_nvenc -preset slow -b:v 5M output.mp4
I get this:
And I cant find the solution.
Also I have a problem - I can’t upload files more then 1 MB on server + my terminal works strange (I cant use arrows - I get ^]]A)