From b335f1f612ca01af6cd00391c2c9345a89c85fc6 Mon Sep 17 00:00:00 2001 From: Tohru <65994850+Tohrusky@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:15:17 +0000 Subject: [PATCH] ci: use pre-built vs-ffmpeg-docker (#41) --- .circleci/config.yml | 60 +--- .github/workflows/{CI.yml => CI-test.yml} | 4 +- Makefile | 16 +- README.md | 11 +- vs-ffmpeg-rocm.dockerfile | 316 ---------------------- vs-ffmpeg.dockerfile | 260 ------------------ vs-pytorch-rocm.dockerfile | 63 ++++- vs-pytorch.dockerfile | 7 +- 8 files changed, 83 insertions(+), 654 deletions(-) rename .github/workflows/{CI.yml => CI-test.yml} (91%) delete mode 100644 vs-ffmpeg-rocm.dockerfile delete mode 100644 vs-ffmpeg.dockerfile diff --git a/.circleci/config.yml b/.circleci/config.yml index b57a906..31f0bb6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,40 +1,6 @@ version: 2.1 jobs: - pre-build-ff-cuda: - docker: - - image: cimg/go:1.17 - resource_class: small - steps: - - checkout - - setup_remote_docker: - docker_layer_caching: true - - run: | - make ff - mkdir -p images/cuda - docker image save -o "images/cuda/vs-ffmpeg_cuda.tar" vs-ffmpeg:cuda - - persist_to_workspace: - root: . - paths: - - images/cuda - - pre-build-ff-rocm: - docker: - - image: cimg/go:1.17 - resource_class: small - steps: - - checkout - - setup_remote_docker: - docker_layer_caching: true - - run: | - make ff-rocm - mkdir -p images/rocm - docker image save -o "images/rocm/vs-ffmpeg_rocm.tar" vs-ffmpeg:rocm - - persist_to_workspace: - root: . - paths: - - images/rocm - build-cuda: docker: - image: cimg/go:1.17 @@ -43,10 +9,7 @@ jobs: - checkout - setup_remote_docker: docker_layer_caching: true - - attach_workspace: - at: . - run: | - docker image load -i "images/cuda/vs-ffmpeg_cuda.tar" echo $DOCKERHUB_PASSWORD | docker login -u lychee0 --password-stdin make release @@ -58,10 +21,7 @@ jobs: - checkout - setup_remote_docker: docker_layer_caching: true - - attach_workspace: - at: . - run: | - docker image load -i "images/rocm/vs-ffmpeg_rocm.tar" echo $DOCKERHUB_PASSWORD | docker login -u lychee0 --password-stdin make release-rocm @@ -73,10 +33,7 @@ jobs: - checkout - setup_remote_docker: docker_layer_caching: true - - attach_workspace: - at: . - run: | - docker image load -i "images/cuda/vs-ffmpeg_cuda.tar" echo $DOCKERHUB_PASSWORD | docker login -u lychee0 --password-stdin make release-dev @@ -88,10 +45,7 @@ jobs: - checkout - setup_remote_docker: docker_layer_caching: true - - attach_workspace: - at: . - run: | - docker image load -i "images/rocm/vs-ffmpeg_rocm.tar" echo $DOCKERHUB_PASSWORD | docker login -u lychee0 --password-stdin make release-rocm-dev @@ -99,27 +53,17 @@ workflows: version: 2 build_all: jobs: - - pre-build-ff-cuda - - pre-build-ff-rocm - build-cuda: - requires: - - pre-build-ff-cuda filters: tags: only: /^v.*/ branches: ignore: /.*/ - build-rocm: - requires: - - pre-build-ff-rocm filters: tags: only: /^v.*/ branches: ignore: /.*/ - - build-cuda-dev: - requires: - - pre-build-ff-cuda - - build-rocm-dev: - requires: - - pre-build-ff-rocm + - build-cuda-dev + - build-rocm-dev diff --git a/.github/workflows/CI.yml b/.github/workflows/CI-test.yml similarity index 91% rename from .github/workflows/CI.yml rename to .github/workflows/CI-test.yml index cf8b997..e57109c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI-test.yml @@ -1,4 +1,4 @@ -name: CI +name: CI-test on: push: @@ -17,7 +17,7 @@ jobs: lint: strategy: matrix: - os-version: ["ubuntu-20.04"] + os-version: ["ubuntu-22.04"] python-version: ["3.10"] runs-on: ${{ matrix.os-version }} diff --git a/Makefile b/Makefile index c54e0b1..d213b23 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,16 @@ .DEFAULT_GOAL := default version := v0.2.0 +VS_FFMPEG_DOCKER_VERSION := v0.0.1 .PHONY: lint ## pip install pre-commit lint: pre-commit install pre-commit run --all-files -.PHONY: ff -ff: - docker buildx build -f vs-ffmpeg.dockerfile -t vs-ffmpeg . - docker tag vs-ffmpeg vs-ffmpeg:latest - docker tag vs-ffmpeg vs-ffmpeg:cuda - -.PHONY: ff-rocm -ff-rocm: - docker buildx build -f vs-ffmpeg-rocm.dockerfile -t vs-ffmpeg . - docker tag vs-ffmpeg vs-ffmpeg:rocm - .PHONY: pt pt: - docker buildx build -f vs-pytorch.dockerfile -t lychee0/vs-pytorch . + docker buildx build -f vs-pytorch.dockerfile -t lychee0/vs-pytorch --build-arg BASE_CONTAINER_TAG=${VS_FFMPEG_DOCKER_VERSION} . docker tag lychee0/vs-pytorch lychee0/vs-pytorch:latest docker tag lychee0/vs-pytorch lychee0/vs-pytorch:dev docker tag lychee0/vs-pytorch lychee0/vs-pytorch:cuda-dev @@ -42,7 +32,7 @@ pt-release: .PHONY: pt-rocm pt-rocm: - docker buildx build -f vs-pytorch-rocm.dockerfile -t lychee0/vs-pytorch . + docker buildx build -f vs-pytorch-rocm.dockerfile -t lychee0/vs-pytorch --build-arg BASE_CONTAINER_TAG=${VS_FFMPEG_DOCKER_VERSION} . docker tag lychee0/vs-pytorch lychee0/vs-pytorch:rocm-dev docker tag lychee0/vs-pytorch lychee0/vs-pytorch:rocm-${version} docker tag lychee0/vs-pytorch lychee0/vs-pytorch:rocm diff --git a/README.md b/README.md index a7511c5..a8aff7c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,13 @@ # vs-playground +[![CI-test](https://github.com/TensoRaws/vs-playground/actions/workflows/CI-test.yml/badge.svg)](https://github.com/TensoRaws/vs-playground/actions/workflows/CI-test.yml) +[![Release](https://github.com/TensoRaws/vs-playground/actions/workflows/Release.yml/badge.svg)](https://github.com/TensoRaws/vs-playground/actions/workflows/Release.yml) [![CircleCI](https://dl.circleci.com/status-badge/img/circleci/RJWBNXdmdaDACvcacXFQ3e/Ft9gQaqD6LLAwZL3wjB4WL/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/circleci/RJWBNXdmdaDACvcacXFQ3e/Ft9gQaqD6LLAwZL3wjB4WL/tree/main) dev with docker and jupyter notebook! +### [Base Image](https://github.com/TensoRaws/vs-ffmpeg-docker) + ### Preparations - docker and docker-compose @@ -41,16 +45,17 @@ the playground image has sshd installed, you can ssh into the container to dev ### Build -build [base image](./vs-pytorch.dockerfile) (default for FinalRip) and [playground image](./vs-playground.dockerfile) +build [image](./vs-pytorch.dockerfile) (default for FinalRip) and [playground image](./vs-playground.dockerfile) ```bash -make ff && make pt && make pg +make pt && make pg ``` -`make ff-rocm && make pt-rocm && make pg-rocm` for AMD GPU +`make pt-rocm && make pg-rocm` for AMD GPU ### Reference +- [vs-ffmpeg-docker](https://github.com/TensoRaws/vs-ffmpeg-docker) - [VapourSynth](https://www.vapoursynth.com/) - [yuuno](https://github.com/Irrational-Encoding-Wizardry/yuuno) diff --git a/vs-ffmpeg-rocm.dockerfile b/vs-ffmpeg-rocm.dockerfile deleted file mode 100644 index 5e7ed95..0000000 --- a/vs-ffmpeg-rocm.dockerfile +++ /dev/null @@ -1,316 +0,0 @@ -FROM ubuntu:22.04 - -# Set environment variables to avoid user interaction during the installation process -ENV DEBIAN_FRONTEND=noninteractive - -### -# prepare environment -### - -RUN apt update && apt upgrade -y - -# Install Python versions and pip -RUN apt install -y \ - python3.10 \ - python3.10-venv \ - python3.10-dev \ - python3-pip \ - python-is-python3 - -RUN apt install -y \ - libgl1-mesa-glx \ - curl \ - wget \ - make \ - cmake \ - libssl-dev \ - libffi-dev \ - libopenblas-dev \ - git - -### -# Install compilers and build tools -### - -# from https://github.com/styler00dollar/VSGAN-tensorrt-docker/blob/main/Dockerfile#L382 -RUN apt install autoconf libtool nasm ninja-build yasm pkg-config -y - -RUN apt --fix-broken install - -RUN pip install meson ninja cython - -# install g++13 -RUN apt install build-essential manpages-dev software-properties-common -y -RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y -RUN apt update -y && apt install gcc-13 g++-13 -y -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13 -RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13 - -# install checkinstall -RUN apt install checkinstall -y - -### -# Set the working directory for ROCM -### -WORKDIR /amd - -### -# Install dependencies for ROCM -### - -# Install necessary dependencies -RUN apt install -y \ - software-properties-common \ - && add-apt-repository ppa:deadsnakes/ppa \ - && add-apt-repository universe \ - && apt update - -RUN wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.2-0ubuntu2.1_amd64.deb -RUN apt install -y ./libtinfo5_6.2-0ubuntu2.1_amd64.deb && rm -f ./libtinfo5_6.2-0ubuntu2.1_amd64.deb - -RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb -RUN apt install -y ./libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb && rm -f ./libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb - -RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/universe/s/suitesparse/libccolamd2_5.10.1+dfsg-4build1_amd64.deb -RUN apt install -y ./libccolamd2_5.10.1+dfsg-4build1_amd64.deb && rm -f ./libccolamd2_5.10.1+dfsg-4build1_amd64.deb - -RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcamd2_5.7.1+dfsg-2_amd64.deb -RUN apt install -y ./libcamd2_5.7.1+dfsg-2_amd64.deb && rm -f ./libcamd2_5.7.1+dfsg-2_amd64.deb - -RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcolamd2_5.7.1+dfsg-2_amd64.deb -RUN apt install -y ./libcolamd2_5.7.1+dfsg-2_amd64.deb && rm -f ./libcolamd2_5.7.1+dfsg-2_amd64.deb - -RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libamd2_5.7.1+dfsg-2_amd64.deb -RUN apt install -y ./libamd2_5.7.1+dfsg-2_amd64.deb && rm -f ./libamd2_5.7.1+dfsg-2_amd64.deb - -RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcholmod3_5.7.1+dfsg-2_amd64.deb -RUN apt install -y ./libcholmod3_5.7.1+dfsg-2_amd64.deb && rm -f ./libcholmod3_5.7.1+dfsg-2_amd64.deb - -RUN wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libncurses5_6.2-0ubuntu2.1_amd64.deb -RUN apt install -y ./libncurses5_6.2-0ubuntu2.1_amd64.deb && rm -f ./libncurses5_6.2-0ubuntu2.1_amd64.deb - -RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/m/mime-support/mime-support_3.66_all.deb -RUN apt install -y ./mime-support_3.66_all.deb && rm -f ./mime-support_3.66_all.deb - -RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/universe/libf/libffi7/libffi7_3.3-5ubuntu1_amd64.deb -RUN apt install -y ./libffi7_3.3-5ubuntu1_amd64.deb && rm -f ./libffi7_3.3-5ubuntu1_amd64.deb - -RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/m/mpdecimal/libmpdec2_2.4.2-3_amd64.deb -RUN apt install -y ./libmpdec2_2.4.2-3_amd64.deb && rm -f ./libmpdec2_2.4.2-3_amd64.deb - -# Download the AMD GPU installer package -RUN wget https://repo.radeon.com/amdgpu-install/6.1.3/ubuntu/jammy/amdgpu-install_6.1.60103-1_all.deb - -RUN apt install -y ./amdgpu-install_6.1.60103-1_all.deb && rm -f ./amdgpu-install_6.1.60103-1_all.deb - -RUN amdgpu-install -y --usecase=wsl,rocm --no-dkms - -### -# Set the working directory for VapourSynth and FFmpeg -### -WORKDIR /workspace - -### -# Install VapourSynth -### - -# zimg -# setting pkg version manually since otherwise 'Version' field value '-1': version number is empty -RUN git clone https://github.com/sekrit-twc/zimg --recursive && cd zimg && \ - ./autogen.sh && ./configure && make -j$(nproc) && make install -RUN cd zimg && checkinstall -y -pkgversion=0.0 && apt install /workspace/zimg/zimg_0.0-1_amd64.deb -y - -### Install VapourSynth -ARG VAPOURSYNTH_VERSION=R70 -RUN wget https://github.com/vapoursynth/vapoursynth/archive/refs/tags/${VAPOURSYNTH_VERSION}.tar.gz && \ - tar -zxvf ${VAPOURSYNTH_VERSION}.tar.gz && mv vapoursynth-${VAPOURSYNTH_VERSION} vapoursynth && cd vapoursynth && \ - ./autogen.sh && ./configure && make -j$(nproc) && make install && ldconfig -# install vapoursynth python package -RUN cd vapoursynth && python setup.py install - -### -# Install FFmpeg with Encoders -### - -# -O3 makes sure we compile with optimization. setting CFLAGS/CXXFLAGS seems to override -# default automake cflags. -# -static-libgcc is needed to make gcc not include gcc_s as "as-needed" shared library which -# cmake will include as a implicit library. -# other options to get hardened build (same as ffmpeg hardened) -ARG CFLAGS="-O3 -static-libgcc -fno-strict-overflow -fstack-protector-all -fPIE" -ARG CXXFLAGS="-O3 -static-libgcc -fno-strict-overflow -fstack-protector-all -fPIE" -ARG LDFLAGS="-Wl,-z,relro,-z,now" - -# Vulkan-Headers -RUN git clone https://github.com/KhronosGroup/Vulkan-Headers.git --depth 1 && \ - cd Vulkan-Headers/ && cmake -S . -B build/ && cmake --install build - -# nv-codec-headers -RUN git clone https://github.com/FFmpeg/nv-codec-headers --depth 1 && \ - cd nv-codec-headers && make -j$(nproc) && make install - -RUN git clone https://github.com/gypified/libmp3lame --depth 1 && \ - cd libmp3lame && ./configure --enable-nasm --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/mstorsjo/fdk-aac --depth 1 && \ - cd fdk-aac && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/xiph/ogg --depth 1 && \ - cd ogg && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/xiph/vorbis --depth 1 && \ - cd vorbis && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/xiph/opus --depth 1 && \ - cd opus && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/xiph/theora --depth 1 && \ - cd theora && ./autogen.sh && ./configure --disable-examples --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/webmproject/libvpx --depth 1 && \ - cd libvpx && ./configure --enable-vp9-highbitdepth --disable-unit-tests --disable-examples --enable-static && \ - make -j$(nproc) install - -RUN git clone https://code.videolan.org/videolan/x264.git --depth 1 && \ - cd x264 && ./configure --enable-pic --enable-static && make -j$(nproc) install - -ARG X265_VERSION=4.1 -ARG X265_URL="https://bitbucket.org/multicoreware/x265_git/downloads/x265_$X265_VERSION.tar.gz" -# multilib.sh will build 8,10,12bit libraries and link them together to 8bit's directory -RUN wget -O x265_git.tar.bz2 "$X265_URL" && tar xf x265_git.tar.bz2 && cd x265_*/build/linux && \ - MAKEFLAGS="-j$(nproc)" ./multilib.sh && \ - make -C 8bit -j$(nproc) install - -RUN git clone https://github.com/webmproject/libwebp --depth 1 && \ - cd libwebp && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/xiph/speex --depth 1 && \ - cd speex && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone --depth 1 https://aomedia.googlesource.com/aom --depth 1 && \ - cd aom && \ - mkdir build_tmp && cd build_tmp && cmake -DENABLE_TESTS=0 -DENABLE_NASM=on -DCMAKE_INSTALL_LIBDIR=lib .. && make -j$(nproc) install - -RUN git clone https://github.com/georgmartius/vid.stab --depth 1 && \ - cd vid.stab && cmake . && make -j$(nproc) install - -RUN git clone https://github.com/ultravideo/kvazaar --depth 1 && \ - cd kvazaar && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -# dependencies for libass and ffmpeg -RUN apt install libfreetype-dev libfribidi-dev libfontconfig-dev -y -# dependencies for libass -RUN apt install libharfbuzz-dev libunibreak-dev -y -# libass -RUN git clone https://github.com/libass/libass --depth 1 && \ - cd libass && ./autogen.sh && ./configure --enable-static && make -j$(nproc) && make install - -RUN git clone https://github.com/uclouvain/openjpeg --depth 1 && \ - cd openjpeg && cmake -G "Unix Makefiles" && make -j$(nproc) install - -RUN git clone https://code.videolan.org/videolan/dav1d --depth 1 && \ - cd dav1d && meson build --buildtype release -Ddefault_library=static && ninja -C build install - -# add extra CFLAGS that are not enabled by -O3 -# http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/build/generic/configure.in?revision=2146&view=markup -ARG XVID_VERSION=1.3.7 -ARG XVID_URL="https://downloads.xvid.com/downloads/xvidcore-$XVID_VERSION.tar.gz" -ARG XVID_SHA256=abbdcbd39555691dd1c9b4d08f0a031376a3b211652c0d8b3b8aa9be1303ce2d -RUN wget -O libxvid.tar.gz "$XVID_URL" && \ - echo "$XVID_SHA256 libxvid.tar.gz" | sha256sum --status -c - && \ - tar xf libxvid.tar.gz && \ - cd xvidcore/build/generic && \ - CFLAGS="$CFLAGS -fstrength-reduce -ffast-math" \ - ./configure && make -j$(nproc) && make install - -# configure use tcl sh -RUN apt install tcl -y -RUN git clone https://github.com/Haivision/srt --depth 1 && \ - cd srt && ./configure --cmake-install-libdir=lib --cmake-install-includedir=include --cmake-install-bindir=bin && \ - make -j$(nproc) && make install - -RUN git clone https://github.com/gianni-rosato/svt-av1-psy --depth 1 && \ - cd svt-av1-psy/Build && \ - cmake \ - -G"Unix Makefiles" \ - -DCMAKE_VERBOSE_MAKEFILE=ON \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DBUILD_SHARED_LIBS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - .. && \ - make -j$(nproc) install - -RUN git clone https://github.com/pkuvcl/davs2 --depth 1 && \ - cd davs2/build/linux && ./configure --disable-asm --enable-pic && \ - make -j$(nproc) install - -RUN git clone https://github.com/Netflix/vmaf --depth 1 && \ - cd vmaf/libvmaf && meson build --buildtype release && ninja -vC build install - -RUN git clone https://github.com/cisco/openh264 --depth 1 && \ - cd openh264 && meson build --buildtype release && ninja -C build install - -RUN git clone https://github.com/mpeg5/xeve && \ - cd xeve && mkdir build && cd build && cmake .. && make -j$(nproc) && make install - -# dependencies for ffmpeg -RUN apt install libsoxr-dev libxml2-dev -y -RUN git clone https://github.com/FFmpeg/FFmpeg --depth 1 -RUN cd FFmpeg && \ - CFLAGS="${CFLAGS}" && \ - ./configure \ - --extra-cflags="-fopenmp -lcrypto -lz -ldl" \ - --extra-cxxflags="-fopenmp -lcrypto -lz -ldl" \ - --extra-ldflags="-fopenmp -lcrypto -lz -ldl" \ - --toolchain=hardened \ - --enable-static \ - --enable-shared \ - --disable-debug \ - --enable-pic \ - --enable-gpl \ - --enable-gray \ - --enable-nonfree \ - --enable-openssl \ - --enable-iconv \ - --enable-libxml2 \ - --enable-libmp3lame \ - --enable-libfdk-aac \ - --enable-libvorbis \ - --enable-libopus \ - --enable-libtheora \ - --enable-libvpx \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libwebp \ - --enable-libspeex \ - --enable-libaom \ - --enable-libvidstab \ - --enable-libkvazaar \ - --enable-libfreetype \ - --enable-fontconfig \ - --enable-libfribidi \ - --enable-libass \ - --enable-libsoxr \ - --enable-libopenjpeg \ - --enable-libdav1d \ - #--enable-librav1e \ # I'm lazy to compile it - --enable-libsrt \ - --enable-libsvtav1 \ - --enable-libdavs2 \ - --enable-libvmaf \ - --enable-libxeve \ - #--enable-cuda-nvcc \ # ERROR: failed checking for nvcc - --enable-vapoursynth \ - #--enable-hardcoded-tables \ - --enable-libopenh264 \ - --enable-optimizations \ - #--enable-cuda-llvm \ # ERROR: cuda_llvm requested but not found - #--enable-nvdec \ # Disable for ROCM - #--enable-nvenc \ # Disable for ROCM - #--enable-cuvid \ # Disable for ROCM - #--enable-cuda \ # Disable for ROCM - --enable-pthreads \ - --enable-runtime-cpudetect \ - --enable-lto && \ - #--enable-vulkan && \ # currently can't get it working - make -j$(nproc) && make install diff --git a/vs-ffmpeg.dockerfile b/vs-ffmpeg.dockerfile deleted file mode 100644 index cb08f04..0000000 --- a/vs-ffmpeg.dockerfile +++ /dev/null @@ -1,260 +0,0 @@ -FROM ubuntu:22.04 - -# Set environment variables to avoid user interaction during the installation process -ENV DEBIAN_FRONTEND=noninteractive - -### -# prepare environment -### - -RUN apt update && apt upgrade -y - -# Install Python versions and pip -RUN apt install -y \ - python3.10 \ - python3.10-venv \ - python3.10-dev \ - python3-pip \ - python-is-python3 - -RUN apt install -y \ - libgl1-mesa-glx \ - curl \ - wget \ - make \ - cmake \ - libssl-dev \ - libffi-dev \ - libopenblas-dev \ - git - -### -# Install compilers and build tools -### - -# from https://github.com/styler00dollar/VSGAN-tensorrt-docker/blob/main/Dockerfile#L382 -RUN apt install autoconf libtool nasm ninja-build yasm pkg-config -y - -RUN apt --fix-broken install - -RUN pip install meson ninja cython - -# install g++13 -RUN apt install build-essential manpages-dev software-properties-common -y -RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y -RUN apt update -y && apt install gcc-13 g++-13 -y -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13 -RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13 - -# install checkinstall -RUN apt install checkinstall -y - -### -# Set the working directory for VapourSynth and FFmpeg -### -WORKDIR /workspace - -### -# Install VapourSynth -### - -# zimg -# setting pkg version manually since otherwise 'Version' field value '-1': version number is empty -RUN git clone https://github.com/sekrit-twc/zimg --recursive && cd zimg && \ - ./autogen.sh && ./configure && make -j$(nproc) && make install -RUN cd zimg && checkinstall -y -pkgversion=0.0 && apt install /workspace/zimg/zimg_0.0-1_amd64.deb -y - -### Install VapourSynth -ARG VAPOURSYNTH_VERSION=R70 -RUN wget https://github.com/vapoursynth/vapoursynth/archive/refs/tags/${VAPOURSYNTH_VERSION}.tar.gz && \ - tar -zxvf ${VAPOURSYNTH_VERSION}.tar.gz && mv vapoursynth-${VAPOURSYNTH_VERSION} vapoursynth && cd vapoursynth && \ - ./autogen.sh && ./configure && make -j$(nproc) && make install && ldconfig -# install vapoursynth python package -RUN cd vapoursynth && python setup.py install - -### -# Install FFmpeg with Encoders -### - -# -O3 makes sure we compile with optimization. setting CFLAGS/CXXFLAGS seems to override -# default automake cflags. -# -static-libgcc is needed to make gcc not include gcc_s as "as-needed" shared library which -# cmake will include as a implicit library. -# other options to get hardened build (same as ffmpeg hardened) -ARG CFLAGS="-O3 -static-libgcc -fno-strict-overflow -fstack-protector-all -fPIE" -ARG CXXFLAGS="-O3 -static-libgcc -fno-strict-overflow -fstack-protector-all -fPIE" -ARG LDFLAGS="-Wl,-z,relro,-z,now" - -# Vulkan-Headers -RUN git clone https://github.com/KhronosGroup/Vulkan-Headers.git --depth 1 && \ - cd Vulkan-Headers/ && cmake -S . -B build/ && cmake --install build - -# nv-codec-headers -RUN git clone https://github.com/FFmpeg/nv-codec-headers --depth 1 && \ - cd nv-codec-headers && make -j$(nproc) && make install - -RUN git clone https://github.com/gypified/libmp3lame --depth 1 && \ - cd libmp3lame && ./configure --enable-nasm --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/mstorsjo/fdk-aac --depth 1 && \ - cd fdk-aac && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/xiph/ogg --depth 1 && \ - cd ogg && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/xiph/vorbis --depth 1 && \ - cd vorbis && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/xiph/opus --depth 1 && \ - cd opus && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/xiph/theora --depth 1 && \ - cd theora && ./autogen.sh && ./configure --disable-examples --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/webmproject/libvpx --depth 1 && \ - cd libvpx && ./configure --enable-vp9-highbitdepth --disable-unit-tests --disable-examples --enable-static && \ - make -j$(nproc) install - -RUN git clone https://code.videolan.org/videolan/x264.git --depth 1 && \ - cd x264 && ./configure --enable-pic --enable-static && make -j$(nproc) install - -ARG X265_VERSION=4.1 -ARG X265_URL="https://bitbucket.org/multicoreware/x265_git/downloads/x265_$X265_VERSION.tar.gz" -# multilib.sh will build 8,10,12bit libraries and link them together to 8bit's directory -RUN wget -O x265_git.tar.bz2 "$X265_URL" && tar xf x265_git.tar.bz2 && cd x265_*/build/linux && \ - MAKEFLAGS="-j$(nproc)" ./multilib.sh && \ - make -C 8bit -j$(nproc) install - -RUN git clone https://github.com/webmproject/libwebp --depth 1 && \ - cd libwebp && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone https://github.com/xiph/speex --depth 1 && \ - cd speex && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -RUN git clone --depth 1 https://aomedia.googlesource.com/aom --depth 1 && \ - cd aom && \ - mkdir build_tmp && cd build_tmp && cmake -DENABLE_TESTS=0 -DENABLE_NASM=on -DCMAKE_INSTALL_LIBDIR=lib .. && make -j$(nproc) install - -RUN git clone https://github.com/georgmartius/vid.stab --depth 1 && \ - cd vid.stab && cmake . && make -j$(nproc) install - -RUN git clone https://github.com/ultravideo/kvazaar --depth 1 && \ - cd kvazaar && ./autogen.sh && ./configure --enable-static && make -j$(nproc) install - -# dependencies for libass and ffmpeg -RUN apt install libfreetype-dev libfribidi-dev libfontconfig-dev -y -# dependencies for libass -RUN apt install libharfbuzz-dev libunibreak-dev -y -# libass -RUN git clone https://github.com/libass/libass --depth 1 && \ - cd libass && ./autogen.sh && ./configure --enable-static && make -j$(nproc) && make install - -RUN git clone https://github.com/uclouvain/openjpeg --depth 1 && \ - cd openjpeg && cmake -G "Unix Makefiles" && make -j$(nproc) install - -RUN git clone https://code.videolan.org/videolan/dav1d --depth 1 && \ - cd dav1d && meson build --buildtype release -Ddefault_library=static && ninja -C build install - -# add extra CFLAGS that are not enabled by -O3 -# http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/build/generic/configure.in?revision=2146&view=markup -ARG XVID_VERSION=1.3.7 -ARG XVID_URL="https://downloads.xvid.com/downloads/xvidcore-$XVID_VERSION.tar.gz" -ARG XVID_SHA256=abbdcbd39555691dd1c9b4d08f0a031376a3b211652c0d8b3b8aa9be1303ce2d -RUN wget -O libxvid.tar.gz "$XVID_URL" && \ - echo "$XVID_SHA256 libxvid.tar.gz" | sha256sum --status -c - && \ - tar xf libxvid.tar.gz && \ - cd xvidcore/build/generic && \ - CFLAGS="$CFLAGS -fstrength-reduce -ffast-math" \ - ./configure && make -j$(nproc) && make install - -# configure use tcl sh -RUN apt install tcl -y -RUN git clone https://github.com/Haivision/srt --depth 1 && \ - cd srt && ./configure --cmake-install-libdir=lib --cmake-install-includedir=include --cmake-install-bindir=bin && \ - make -j$(nproc) && make install - -RUN git clone https://github.com/gianni-rosato/svt-av1-psy --depth 1 && \ - cd svt-av1-psy/Build && \ - cmake \ - -G"Unix Makefiles" \ - -DCMAKE_VERBOSE_MAKEFILE=ON \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DBUILD_SHARED_LIBS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - .. && \ - make -j$(nproc) install - -RUN git clone https://github.com/pkuvcl/davs2 --depth 1 && \ - cd davs2/build/linux && ./configure --disable-asm --enable-pic && \ - make -j$(nproc) install - -RUN git clone https://github.com/Netflix/vmaf --depth 1 && \ - cd vmaf/libvmaf && meson build --buildtype release && ninja -vC build install - -RUN git clone https://github.com/cisco/openh264 --depth 1 && \ - cd openh264 && meson build --buildtype release && ninja -C build install - -RUN git clone https://github.com/mpeg5/xeve && \ - cd xeve && mkdir build && cd build && cmake .. && make -j$(nproc) && make install - -# dependencies for ffmpeg -RUN apt install libsoxr-dev libxml2-dev -y -RUN git clone https://github.com/FFmpeg/FFmpeg --depth 1 -RUN cd FFmpeg && \ - CFLAGS="${CFLAGS}" && \ - ./configure \ - --extra-cflags="-fopenmp -lcrypto -lz -ldl" \ - --extra-cxxflags="-fopenmp -lcrypto -lz -ldl" \ - --extra-ldflags="-fopenmp -lcrypto -lz -ldl" \ - --toolchain=hardened \ - --enable-static \ - --enable-shared \ - --disable-debug \ - --enable-pic \ - --enable-gpl \ - --enable-gray \ - --enable-nonfree \ - --enable-openssl \ - --enable-iconv \ - --enable-libxml2 \ - --enable-libmp3lame \ - --enable-libfdk-aac \ - --enable-libvorbis \ - --enable-libopus \ - --enable-libtheora \ - --enable-libvpx \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libwebp \ - --enable-libspeex \ - --enable-libaom \ - --enable-libvidstab \ - --enable-libkvazaar \ - --enable-libfreetype \ - --enable-fontconfig \ - --enable-libfribidi \ - --enable-libass \ - --enable-libsoxr \ - --enable-libopenjpeg \ - --enable-libdav1d \ - #--enable-librav1e \ # I'm lazy to compile it - --enable-libsrt \ - --enable-libsvtav1 \ - --enable-libdavs2 \ - --enable-libvmaf \ - --enable-libxeve \ - #--enable-cuda-nvcc \ # ERROR: failed checking for nvcc - --enable-vapoursynth \ - #--enable-hardcoded-tables \ - --enable-libopenh264 \ - --enable-optimizations \ - #--enable-cuda-llvm \ # ERROR: cuda_llvm requested but not found - --enable-nvdec \ - --enable-nvenc \ - --enable-cuvid \ - --enable-cuda \ - --enable-pthreads \ - --enable-runtime-cpudetect \ - --enable-lto && \ - #--enable-vulkan && \ # currently can't get it working - make -j$(nproc) && make install diff --git a/vs-pytorch-rocm.dockerfile b/vs-pytorch-rocm.dockerfile index 1645eb7..e2536a4 100644 --- a/vs-pytorch-rocm.dockerfile +++ b/vs-pytorch-rocm.dockerfile @@ -1,5 +1,66 @@ -FROM vs-ffmpeg:rocm +ARG BASE_CONTAINER_TAG=latest +FROM lychee0/vs-ffmpeg-docker:${BASE_CONTAINER_TAG} + +### +# Set the working directory for ROCM +### +WORKDIR /amd + +### +# Install dependencies for ROCM +### + +# Install necessary dependencies +RUN apt install -y \ + software-properties-common \ + && add-apt-repository ppa:deadsnakes/ppa \ + && add-apt-repository universe \ + && apt update + +RUN wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.2-0ubuntu2.1_amd64.deb +RUN apt install -y ./libtinfo5_6.2-0ubuntu2.1_amd64.deb && rm -f ./libtinfo5_6.2-0ubuntu2.1_amd64.deb + +RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb +RUN apt install -y ./libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb && rm -f ./libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb + +RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/universe/s/suitesparse/libccolamd2_5.10.1+dfsg-4build1_amd64.deb +RUN apt install -y ./libccolamd2_5.10.1+dfsg-4build1_amd64.deb && rm -f ./libccolamd2_5.10.1+dfsg-4build1_amd64.deb + +RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcamd2_5.7.1+dfsg-2_amd64.deb +RUN apt install -y ./libcamd2_5.7.1+dfsg-2_amd64.deb && rm -f ./libcamd2_5.7.1+dfsg-2_amd64.deb + +RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcolamd2_5.7.1+dfsg-2_amd64.deb +RUN apt install -y ./libcolamd2_5.7.1+dfsg-2_amd64.deb && rm -f ./libcolamd2_5.7.1+dfsg-2_amd64.deb + +RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libamd2_5.7.1+dfsg-2_amd64.deb +RUN apt install -y ./libamd2_5.7.1+dfsg-2_amd64.deb && rm -f ./libamd2_5.7.1+dfsg-2_amd64.deb + +RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcholmod3_5.7.1+dfsg-2_amd64.deb +RUN apt install -y ./libcholmod3_5.7.1+dfsg-2_amd64.deb && rm -f ./libcholmod3_5.7.1+dfsg-2_amd64.deb + +RUN wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libncurses5_6.2-0ubuntu2.1_amd64.deb +RUN apt install -y ./libncurses5_6.2-0ubuntu2.1_amd64.deb && rm -f ./libncurses5_6.2-0ubuntu2.1_amd64.deb + +RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/m/mime-support/mime-support_3.66_all.deb +RUN apt install -y ./mime-support_3.66_all.deb && rm -f ./mime-support_3.66_all.deb + +RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/universe/libf/libffi7/libffi7_3.3-5ubuntu1_amd64.deb +RUN apt install -y ./libffi7_3.3-5ubuntu1_amd64.deb && rm -f ./libffi7_3.3-5ubuntu1_amd64.deb + +RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/m/mpdecimal/libmpdec2_2.4.2-3_amd64.deb +RUN apt install -y ./libmpdec2_2.4.2-3_amd64.deb && rm -f ./libmpdec2_2.4.2-3_amd64.deb + +# Download the AMD GPU installer package +RUN wget https://repo.radeon.com/amdgpu-install/6.1.3/ubuntu/jammy/amdgpu-install_6.1.60103-1_all.deb + +RUN apt install -y ./amdgpu-install_6.1.60103-1_all.deb && rm -f ./amdgpu-install_6.1.60103-1_all.deb + +RUN amdgpu-install -y --usecase=wsl,rocm --no-dkms + +### +# Set the working directory for VapourSynth +### WORKDIR /workspace ### diff --git a/vs-pytorch.dockerfile b/vs-pytorch.dockerfile index b43be50..7b6e76f 100644 --- a/vs-pytorch.dockerfile +++ b/vs-pytorch.dockerfile @@ -1,5 +1,10 @@ -FROM vs-ffmpeg:cuda +ARG BASE_CONTAINER_TAG=latest +FROM lychee0/vs-ffmpeg-docker:${BASE_CONTAINER_TAG} + +### +# Set the working directory for VapourSynth +### WORKDIR /workspace ###