Skip to content

Commit

Permalink
Merge pull request #181 from markus-perl/ffmpeg-v6
Browse files Browse the repository at this point in the history
Ffmpeg v6
  • Loading branch information
markus-perl authored Mar 2, 2023
2 parents 0328348 + 9ef607e commit 1df7e94
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 111 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,30 +103,6 @@ jobs:
run: |
docker run --rm ffmpeg:cuda-ubuntu -buildconf
build-cuda-rocky-docker:
name: build in Rockylinux docker with cuda
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: pull base image
id: cuda_centos_pull
run: |
docker pull nvidia/cuda:11.6.0-devel-centos8
docker pull rockylinux:8
- name: run if cuda_centos_pull failed
if: failure() && steps.cuda_centos_pull.outcome == 'failure'
run: |
docker pull nvidia/cuda:11.6.0-devel-centos8
docker pull rockylinux:8
- name: build ffmpeg
run: |
docker build -t ffmpeg:cuda-rocky -f cuda-rocky.dockerfile .
- name: test run ffmepg
run: |
docker run --rm ffmpeg:cuda-rocky -buildconf
build-full-static:
name: full static build in docker
runs-on: ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ workspace
.idea
linux
.artifacts
build
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,9 @@ $ docker build --tag=ffmpeg:default --output type=local,dest=build -f Dockerfile
##### CUDA
These builds are always built with the --enable-gpl-and-non-free switch, as CUDA is non-free. See https://ffmpeg.org/legal.html
```bash
export DOCKER_BUILDKIT=1

## Set the DIST (`ubuntu` or `rocky`) and VER (ubuntu: `16.04` , `18.04`, `20.04` or rocky: `8`) environment variables to select the preferred Docker base image.
$ export DIST=centos
$ export VER=8

## Start the build
$ docker build --tag=ffmpeg:cuda-$DIST -f cuda-$DIST.dockerfile --build-arg VER=$VER .
$ docker build --tag=ffmpeg:cuda-$DIST -f cuda-ubunu.dockerfile --build-arg .
```

Build an `export.dockerfile` that copies only what you need from the image you just built as follows. When running,
Expand Down
57 changes: 29 additions & 28 deletions build-ffmpeg
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# LICENSE: https://github.com/markus-perl/ffmpeg-build-script/blob/master/LICENSE

PROGNAME=$(basename "$0")
FFMPEG_VERSION=5.1
SCRIPT_VERSION=1.43
FFMPEG_VERSION=6.0
SCRIPT_VERSION=1.44
CWD=$(pwd)
PACKAGES="$CWD/packages"
WORKSPACE="$CWD/workspace"
Expand Down Expand Up @@ -387,8 +387,8 @@ if build "libtool" "2.4.7"; then
fi

if $NONFREE_AND_GPL; then
if build "openssl" "1.1.1s"; then
download "https://www.openssl.org/source/openssl-1.1.1s.tar.gz"
if build "openssl" "1.1.1t"; then
download "https://www.openssl.org/source/openssl-1.1.1t.tar.gz"
if $MACOS_M1; then
sed -n 's/\(##### GNU Hurd\)/"darwin64-arm64-cc" => { \n inherit_from => [ "darwin-common", asm("aarch64_asm") ],\n CFLAGS => add("-Wall"),\n cflags => add("-arch arm64 "),\n lib_cppflags => add("-DL_ENDIAN"),\n bn_ops => "SIXTY_FOUR_BIT_LONG", \n perlasm_scheme => "macosx", \n}, \n\1/g' Configurations/10-main.conf
execute ./Configure --prefix="${WORKSPACE}" no-shared no-asm darwin64-arm64-cc
Expand All @@ -397,7 +397,7 @@ if $NONFREE_AND_GPL; then
fi
execute make -j $MJOBS
execute make install_sw
build_done "openssl" "1.1.1s"
build_done "openssl" "1.1.1t"
fi
CONFIGURE_OPTIONS+=("--enable-openssl")
else
Expand All @@ -418,12 +418,12 @@ else
fi

if [[ ! $ARCH == 'arm64' ]]; then
if build "gnutls" "3.7.8"; then
download "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/gnutls-3.7.8.tar.xz"
if build "gnutls" "3.7.9"; then
download "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/gnutls-3.7.9.tar.xz"
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static --disable-doc --disable-tools --disable-cxx --disable-tests --disable-gtk-doc-html --disable-libdane --disable-nls --enable-local-libopts --disable-guile --with-included-libtasn1 --with-included-unistring --without-p11-kit CPPFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
execute make -j $MJOBS
execute make install
build_done "gnutls" "3.7.8"
build_done "gnutls" "3.7.9"
fi
# CONFIGURE_OPTIONS+=("--enable-gmp" "--enable-gnutls")
fi
Expand Down Expand Up @@ -454,8 +454,8 @@ if command_exists "python3"; then
done
fi
if command_exists "meson"; then
if build "dav1d" "1.0.0"; then
download "https://code.videolan.org/videolan/dav1d/-/archive/1.0.0/dav1d-1.0.0.tar.gz"
if build "dav1d" "1.1.0"; then
download "https://code.videolan.org/videolan/dav1d/-/archive/1.0.0/dav1d-1.1.0.tar.gz"
make_dir build

CFLAGSBACKUP=$CFLAGS
Expand All @@ -471,7 +471,7 @@ if command_exists "python3"; then
export CFLAGS=$CFLAGSBACKUP
fi

build_done "dav1d" "1.0.0"
build_done "dav1d" "1.1.0"
fi
CONFIGURE_OPTIONS+=("--enable-libdav1d")
fi
Expand All @@ -493,11 +493,11 @@ if ! $MACOS_M1; then
fi

if command_exists "cargo"; then
if build "rav1e" "0.6.2"; then
if build "rav1e" "0.6.3"; then
execute cargo install --version "0.9.14+cargo-0.66" cargo-c
download "https://github.com/xiph/rav1e/archive/refs/tags/v0.6.2.tar.gz"
download "https://github.com/xiph/rav1e/archive/refs/tags/v0.6.3.tar.gz"
execute cargo cinstall --prefix="${WORKSPACE}" --library-type=staticlib --crt-static --release
build_done "rav1e" "0.6.2"
build_done "rav1e" "0.6.3"
fi
CONFIGURE_OPTIONS+=("--enable-librav1e")
fi
Expand Down Expand Up @@ -567,8 +567,8 @@ EOF
CONFIGURE_OPTIONS+=("--enable-libx265")
fi

if build "libvpx" "1.12.0"; then
download "https://github.com/webmproject/libvpx/archive/refs/tags/v1.12.0.tar.gz" "libvpx-1.12.0.tar.gz"
if build "libvpx" "1.13.0"; then
download "https://github.com/webmproject/libvpx/archive/refs/tags/v1.13.0.tar.gz" "libvpx-1.13.0.tar.gz"

if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Applying Darwin patch"
Expand All @@ -580,7 +580,7 @@ if build "libvpx" "1.12.0"; then
execute make -j $MJOBS
execute make install

build_done "libvpx" "1.12.0"
build_done "libvpx" "1.13.0"
fi
CONFIGURE_OPTIONS+=("--enable-libvpx")

Expand Down Expand Up @@ -837,13 +837,13 @@ fi
## other library
##

if build "libsdl" "2.26.1"; then
download "https://www.libsdl.org/release/SDL2-2.26.1.tar.gz"
if build "libsdl" "2.26.3"; then
download "https://www.libsdl.org/release/SDL2-2.26.3.tar.gz"
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static
execute make -j $MJOBS
execute make install

build_done "libsdl" "2.26.1"
build_done "libsdl" "2.26.3"
fi

if $NONFREE_AND_GPL; then
Expand All @@ -870,11 +870,11 @@ fi

if [[ "$OSTYPE" == "linux-gnu" ]]; then
if command_exists "nvcc"; then
if build "nv-codec" "11.1.5.0"; then
download "https://github.com/FFmpeg/nv-codec-headers/releases/download/n11.1.5.0/nv-codec-headers-11.1.5.0.tar.gz"
if build "nv-codec" "11.1.5.2"; then
download "https://github.com/FFmpeg/nv-codec-headers/releases/download/n11.1.5.2/nv-codec-headers-11.1.5.2.tar.gz"
execute make PREFIX="${WORKSPACE}"
execute make install PREFIX="${WORKSPACE}"
build_done "nv-codec" "11.1.5.0"
execute make PREFIX="${WORKSPACE}/usr" install
build_done "nv-codec" "11.1.5.2"
fi
CFLAGS+=" -I/usr/local/cuda/include"
LDFLAGS+=" -L/usr/local/cuda/lib64"
Expand All @@ -899,12 +899,12 @@ if [[ "$OSTYPE" == "linux-gnu" ]]; then
fi
fi

if build "amf" "1.4.28"; then
download 'https://github.com/GPUOpen-LibrariesAndSDKs/AMF/archive/refs/tags/v1.4.28.tar.gz' 'AMF-1.4.28.tar.gz' 'AMF-1.4.28'
if build "amf" "1.4.29"; then
download 'https://github.com/GPUOpen-LibrariesAndSDKs/AMF/archive/refs/tags/v1.4.29.tar.gz' 'AMF-1.4.29.tar.gz' 'AMF-1.4.29'
execute rm -rf "${WORKSPACE}/include/AMF"
execute mkdir -p "${WORKSPACE}/include/AMF"
execute cp -r "${PACKAGES}"/AMF-1.4.28/AMF-1.4.28/amf/public/include/* "${WORKSPACE}/include/AMF/"
build_done "amf" "1.4.28"
execute cp -r "${PACKAGES}"/AMF-1.4.29/AMF-1.4.29/amf/public/include/* "${WORKSPACE}/include/AMF/"
build_done "amf" "1.4.29"
fi
CONFIGURE_OPTIONS+=("--enable-amf")
fi
Expand All @@ -929,6 +929,7 @@ download "https://github.com/FFmpeg/FFmpeg/archive/refs/heads/release/$FFMPEG_VE
--enable-static \
--enable-small \
--enable-version3 \
--disable-ffnvcodec \
--extra-cflags="${CFLAGS}" \
--extra-ldexeflags="${LDEXEFLAGS}" \
--extra-ldflags="${LDFLAGS}" \
Expand Down
49 changes: 0 additions & 49 deletions cuda-rocky.dockerfile

This file was deleted.

17 changes: 13 additions & 4 deletions cuda-ubuntu.dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
ARG VER=22.04

FROM nvidia/cuda:11.8.0-devel-ubuntu${VER} AS build
FROM ubuntu:${VER} AS build

ARG CUDAVER=11.8.0-1

ENV DEBIAN_FRONTEND noninteractive
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,video

RUN apt-get update \
&& apt-get -y --no-install-recommends install build-essential curl ca-certificates libva-dev python3 python-is-python3 ninja-build meson \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* \
&& update-ca-certificates
&& apt-get -y --no-install-recommends install wget ca-certificates \
&& update-ca-certificates \
&& wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
&& dpkg -i cuda-keyring_1.0-1_all.deb \
&& apt-get update

RUN apt-get -y --no-install-recommends install build-essential curl libva-dev python3 python-is-python3 ninja-build meson \
cuda="${CUDAVER}" \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*


WORKDIR /app
COPY ./build-ffmpeg /app/build-ffmpeg
Expand Down

0 comments on commit 1df7e94

Please sign in to comment.