FFmpeg build script merged between MSYS2 and Linux
Just note of merged build script is deprecated. It is improved one build shell script of FFmpeg-VVC for Windows MSYS2 & Linux. sudo is removed, so I made sure new prefix folder with no administrator privileges and variables are improved. - Martin Eesmaa
This commit is contained in:
parent
e9a9cd8a15
commit
1dc5734ada
113
FFMPEGMINGW.sh
113
FFMPEGMINGW.sh
|
@ -1,113 +0,0 @@
|
|||
echo Updating and upgrading MSYS2 packages... if system core update requires reboot this application, please run this script again after being updated.
|
||||
pacman -Syu
|
||||
echo Installing MSYS2 packages...
|
||||
pacman -S python git nasm vim wget $MINGW_PACKAGE_PREFIX-{toolchain,cmake,autotools,meson,ninja}
|
||||
echo Starting process of FFmpeg build with libvvenc and libvvdec...
|
||||
[ ! -d buildffmpegwin ] && mkdir buildffmpegwin
|
||||
cd buildffmpegwin
|
||||
|
||||
clonepull() {
|
||||
if [ ! -d "$1" ]; then
|
||||
git clone --depth=1 "$2" "$1"
|
||||
else
|
||||
git -C "$1" pull
|
||||
fi
|
||||
}
|
||||
|
||||
clonepull FFmpeg-VVC https://github.com/MartinEesmaa/FFmpeg-VVC
|
||||
clonepull vvenc https://github.com/fraunhoferhhi/vvenc
|
||||
clonepull vvdec https://github.com/fraunhoferhhi/vvdec
|
||||
clonepull fdk-aac https://github.com/mstorsjo/fdk-aac
|
||||
clonepull SDL https://github.com/libsdl-org/SDL -b SDL2
|
||||
clonepull libxml2 https://github.com/gnome/libxml2
|
||||
clonepull opus https://github.com/xiph/opus
|
||||
clonepull libjxl https://github.com/libjxl/libjxl
|
||||
clonepull zimg https://github.com/sekrit-twc/zimg
|
||||
clonepull soxr https://github.com/chirlu/soxr
|
||||
clonepull dav1d https://code.videolan.org/videolan/dav1d
|
||||
clonepull codec2 https://github.com/drowe67/codec2
|
||||
clonepull vmaf https://github.com/netflix/vmaf
|
||||
|
||||
if [ ! -d libjxl ]; then
|
||||
sed -i 's/-lm/-lm -lstdc++/g' libjxl/lib/jxl/libjxl.pc.in libjxl/lib/threads/libjxl_threads.pc.in
|
||||
git -C libjxl submodule update --init --recursive --depth 1 --recommend-shallow
|
||||
fi
|
||||
|
||||
if [ ! -d zimg ]; then
|
||||
git -C zimg submodule update --init --recursive --depth 1
|
||||
wget https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/zimg/0001-libm_wrapper-define-__CRT__NO_INLINE-before-math.h.patch
|
||||
git -C zimg apply 0001-libm_wrapper-define-__CRT__NO_INLINE-before-math.h.patch
|
||||
rm 0001-libm_wrapper-define-__CRT__NO_INLINE-before-math.h.patch
|
||||
fi
|
||||
|
||||
echo Starting to build fdk-aac:
|
||||
cd fdk-aac
|
||||
./autogen.sh && ./configure --enable-static --disable-shared --prefix=$MSYSTEM_PREFIX && make install -j $nproc
|
||||
cd ..
|
||||
|
||||
echo Starting to build libxml2:
|
||||
cd libxml2
|
||||
./autogen.sh && ./configure --enable-static --disable-shared --prefix=$MSYSTEM_PREFIX && make install -j $nproc
|
||||
cd ..
|
||||
|
||||
echo Starting to build sdl2:
|
||||
mkdir -p SDL/build
|
||||
cd build && cmake -DCMAKE_EXE_LINKER_FLAGS="-static" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$MSYSTEM_PREFIX .. -G "MinGW Makefiles" && cmake --build . --target install -j $nproc
|
||||
cd ../../
|
||||
|
||||
echo Starting to build libopus to improve decode quality on FFmpeg:
|
||||
cd opus
|
||||
./autogen.sh && CFLAGS="-O2 -D_FORTIFY_SOURCE=0" LDFLAGS="-flto -s" ./configure --enable-static --disable-shared --prefix=$MSYSTEM_PREFIX && make install -j $nproc
|
||||
cd ..
|
||||
|
||||
echo Starting to build libjxl:
|
||||
mkdir -p libjxl/build && cd libjxl/build && cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_PLUGINS=ON -DJPEGXL_ENABLE_MANPAGES=OFF -DJPEGXL_FORCE_SYSTEM_BROTLI=ON -DJPEGXL_FORCE_SYSTEM_GTEST=ON -DCMAKE_INSTALL_PREFIX=$MSYSTEM_PREFIX .. && ninja install
|
||||
cd ../../
|
||||
|
||||
echo Starting to build dav1d:
|
||||
mkdir -p dav1d/build && cd dav1d/build && meson -Denable_docs=false -Ddefault_library=static -Dprefix=$MSYSTEM_PREFIX .. && ninja install
|
||||
cd ../../
|
||||
|
||||
echo Starting to build zimg:
|
||||
cd zimg && ./autogen.sh && ./configure --disable-shared --prefix=$MSYSTEM_PREFIX && make install -j $nproc
|
||||
cd ..
|
||||
|
||||
echo Starting to build soxr:
|
||||
mkdir -p soxr/build && cd soxr/build && cmake -D{WITH_LSR_BINDINGS,BUILD_TESTS,WITH_OPENMP}=off -DCMAKE_INSTALL_PREFIX=$MSYSTEM_PREFIX -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev .. -G "MinGW Makefiles"
|
||||
cmake --build . -j $nproc --target install
|
||||
cd ../../
|
||||
|
||||
echo Starting to build codec2:
|
||||
cd codec2
|
||||
sed -i 's|if(WIN32)|if(FALSE)|g' CMakeLists.txt
|
||||
grep -ERl "\b(lsp|lpc)_to_(lpc|lsp)" --include="*.[ch]" | \
|
||||
xargs -r sed -ri "s;((lsp|lpc)_to_(lpc|lsp));c2_\1;g"
|
||||
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$MSYSTEM_PREFIX -D{UNITTEST,INSTALL_EXAMPLES}=off -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS="-static" .. -G "MinGW Makefiles"
|
||||
cmake --build . -j $nproc --target install
|
||||
cd ../../
|
||||
|
||||
echo Starting to build vmaf to apply calculate VVC video references from original video:
|
||||
mkdir -p vmaf/libvmaf/build && cd vmaf/libvmaf/build && CFLAGS="-msse2 -mfpmath=sse -mstackrealign" meson -Denable_docs=false -Ddefault_library=static -Denable_float=true -Dbuilt_in_models=true -Dprefix=$MSYSTEM_PREFIX .. && ninja install
|
||||
cd ../../../
|
||||
sed -i 's/-lm/-lm -lstdc++/g' $MSYSTEM_PREFIX/lib/pkgconfig/libvmaf.pc
|
||||
|
||||
echo Starting to build vvenc...
|
||||
cd vvenc
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$MSYSTEM_PREFIX -DVVENC_ENABLE_LINK_TIME_OPT=OFF .. -G "MinGW Makefiles"
|
||||
cmake --build . --target install -j $nproc
|
||||
cd ../../
|
||||
echo Starting to build vvdec...
|
||||
cd vvdec
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$MSYSTEM_PREFIX -DVVDEC_ENABLE_LINK_TIME_OPT=OFF .. -G "MinGW Makefiles"
|
||||
cmake --build . --target install -j $nproc
|
||||
cd ../../
|
||||
|
||||
echo Starting configuring and making FFmpeg VVCEasy build...
|
||||
cd FFmpeg-VVC
|
||||
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-libfdk-aac --enable-static --enable-libvvenc --enable-libvvdec --enable-pic \
|
||||
--enable-zlib --enable-libxml2 --enable-libdav1d --enable-libopus --enable-libcodec2 --enable-libjxl --enable-libzimg \
|
||||
--enable-libvmaf --enable-libsoxr --extra-ldexeflags=-static --pkg-config-flags=-static --disable-w32threads --enable-sdl2 --extra-version=VVCEasy && \
|
||||
make -j
|
||||
echo FFmpeg VVC version tools are now compiled, please see buildffmpegwin/FFmpeg folder.
|
|
@ -1,10 +1,71 @@
|
|||
#!/bin/bash
|
||||
PREFIX=/usr/local
|
||||
echo Building FFmpeg VVCEasy Linux version...
|
||||
sudo apt update && sudo apt upgrade -y && \
|
||||
|
||||
printf "\033[33m"
|
||||
echo "Warning: It is deprecated, but you're welcome to use it anyway."
|
||||
printf "\033[39m"
|
||||
PREFIX="$(pwd)/buildffmpeg/prefix"
|
||||
echo "Note: Your prefix folder with full directory will be built: $PREFIX"
|
||||
case "$(uname -s)" in
|
||||
Linux*)
|
||||
OS="Linux"
|
||||
DISTRO=$(cat /etc/*release | grep ^ID= | cut -d= -f2 | tr -d '"')
|
||||
echo "Building FFmpeg VVCEasy $OS version..."
|
||||
echo "Updating and upgrading system packages..."
|
||||
|
||||
case $DISTRO in
|
||||
debian|ubuntu)
|
||||
echo "Detected Debian/Ubuntu"
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
echo "Installing dependencies for Debian/Ubuntu..."
|
||||
sudo apt install build-essential cmake nasm autoconf pkg-config \
|
||||
python3-setuptools ninja-build python3-pip libtool git wget xxd -y && \
|
||||
python3-setuptools ninja-build python3-pip libtool git wget xxd -y
|
||||
sudo pip3 install meson
|
||||
;;
|
||||
arch)
|
||||
echo "Detected Arch Linux"
|
||||
sudo pacman -Syu --noconfirm
|
||||
echo "Installing dependencies for Arch..."
|
||||
sudo pacman -S --noconfirm base-devel cmake nasm autoconf pkg-config \
|
||||
python-setuptools ninja python-pip libtool git wget xxd
|
||||
sudo pip install meson
|
||||
;;
|
||||
fedora)
|
||||
echo "Detected Fedora"
|
||||
sudo dnf update -y
|
||||
echo "Installing dependencies for Fedora..."
|
||||
sudo dnf install -y gcc gcc-c++ cmake nasm autoconf pkgconfig \
|
||||
python3-setuptools ninja-build python3-pip libtool git wget xxd
|
||||
sudo pip3 install meson
|
||||
;;
|
||||
gentoo)
|
||||
echo "Detected Gentoo"
|
||||
sudo emerge --sync
|
||||
echo "Installing dependencies for Gentoo..."
|
||||
sudo emerge -av dev-util/cmake media-libs/nasm sys-devel/autoconf \
|
||||
dev-python/setuptools dev-util/ninja dev-python/pip sys-libs/libtool \
|
||||
dev-vcs/git net-misc/wget app-editors/vim
|
||||
sudo pip3 install meson
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported Linux distribution: $DISTRO"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
MSYS*|MINGW*)
|
||||
OS="Windows"
|
||||
extra="--disable-w32threads --enable-libcodec2"
|
||||
echo "Building FFmpeg VVCEasy Windows version..."
|
||||
echo "Updating and upgrading MSYS2 packages..."
|
||||
pacman -Syu
|
||||
echo "Installing MSYS2 packages..."
|
||||
pacman -S python git nasm vim wget xxd $MINGW_PACKAGE_PREFIX-{toolchain,cmake,autotools,meson,ninja}
|
||||
;;
|
||||
*)
|
||||
echo "Only for Windows & Linux are only supported"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
clonepull() {
|
||||
if [ ! -d "$1" ]; then
|
||||
|
@ -14,6 +75,11 @@ clonepull() {
|
|||
fi
|
||||
}
|
||||
|
||||
[ ! -d buildffmpeg ] && mkdir buildffmpeg
|
||||
cd buildffmpeg
|
||||
|
||||
[ ! -d prefix ] && mkdir prefix
|
||||
|
||||
clonepull FFmpeg-VVC https://github.com/MartinEesmaa/FFmpeg-VVC
|
||||
clonepull vvenc https://github.com/fraunhoferhhi/vvenc
|
||||
clonepull vvdec https://github.com/fraunhoferhhi/vvdec
|
||||
|
@ -25,9 +91,12 @@ clonepull libjxl https://github.com/libjxl/libjxl
|
|||
clonepull zimg https://github.com/sekrit-twc/zimg
|
||||
clonepull soxr https://github.com/chirlu/soxr
|
||||
clonepull dav1d https://code.videolan.org/videolan/dav1d
|
||||
clonepull codec2 https://github.com/drowe67/codec2
|
||||
clonepull vmaf https://github.com/netflix/vmaf
|
||||
|
||||
if [ $OS = "Windows" ]; then
|
||||
clonepull codec2 https://github.com/drowe67/codec2
|
||||
fi
|
||||
|
||||
if [ ! -d libjxl ]; then
|
||||
sed -i 's/-lm/-lm -lstdc++/g' libjxl/lib/jxl/libjxl.pc.in libjxl/lib/threads/libjxl_threads.pc.in
|
||||
git -C libjxl submodule update --init --recursive --depth 1 --recommend-shallow
|
||||
|
@ -40,34 +109,40 @@ git -C zimg apply 0001-libm_wrapper-define-__CRT__NO_INLINE-before-math.h.patch
|
|||
rm 0001-libm_wrapper-define-__CRT__NO_INLINE-before-math.h.patch
|
||||
fi
|
||||
|
||||
cd vvenc && sudo make install-release install-prefix=$PREFIX disable-lto=1 && \
|
||||
cd .. && \
|
||||
cd vvdec && sudo make install-release install-prefix=$PREFIX disable-lto=1 && \
|
||||
cd .. && \
|
||||
cd fdk-aac && ./autogen.sh && ./configure --prefix=$PREFIX --enable-static --disable-shared && sudo make install -j $nproc && \
|
||||
cd .. && \
|
||||
cd libxml2 && ./autogen.sh && ./configure --prefix=$PREFIX --enable-static --disable-shared && sudo make install -j $nproc && \
|
||||
cd .. && \
|
||||
cd opus && ./autogen.sh && CFLAGS="-O2 -D_FORTIFY_SOURCE=0" LDFLAGS="-flto -s" ./configure --prefix=$PREFIX --enable-static --disable-shared && sudo make install -j $nproc && \
|
||||
cd .. && \
|
||||
mkdir -p libjxl/build && cd libjxl/build && cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_PLUGINS=ON -DJPEGXL_ENABLE_MANPAGES=OFF -DJPEGXL_FORCE_SYSTEM_BROTLI=ON -DJPEGXL_FORCE_SYSTEM_GTEST=ON -DCMAKE_INSTALL_PREFIX=$PREFIX .. -G Ninja && sudo ninja install && \
|
||||
cd ../../ && \
|
||||
mkdir -p vmaf/libvmaf/build && cd vmaf/libvmaf/build && CFLAGS="-msse2 -mfpmath=sse -mstackrealign" meson -Denable_docs=false -Ddefault_library=static -Denable_float=true -Dbuilt_in_models=true -Dprefix=$PREFIX .. && sudo ninja install && \
|
||||
cd ../../../ && \
|
||||
sudo sed -i 's/-lm/-lm -lstdc++/g' $PREFIX/lib/x86_64-linux-gnu/pkgconfig/libvmaf.pc && \
|
||||
cd SDL && mkdir build && cd build && cmake -DCMAKE_EXE_LINKER_FLAGS="-static" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. && sudo make install -j $nproc && \
|
||||
cd ../../ && \
|
||||
cd zimg && ./autogen.sh && ./configure --disable-shared --prefix=$PREFIX && sudo make install -j $nproc && \
|
||||
cd .. && \
|
||||
mkdir -p soxr/build && cd soxr/build && cmake -D{WITH_LSR_BINDINGS,BUILD_TESTS,WITH_OPENMP}=off -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev .. && \
|
||||
sudo cmake --build . -j $nproc --target install && \
|
||||
cd ../../ && \
|
||||
mkdir -p dav1d/build && cd dav1d/build && meson -Denable_docs=false -Ddefault_library=static -Dprefix=$PREFIX .. && sudo ninja install && \
|
||||
cd ../../ && \
|
||||
cd FFmpeg-VVC && \
|
||||
./configure --enable-static --pkg-config-flags="--static" --extra-ldexeflags="-static" \
|
||||
make="make install-r install-prefix=$PREFIX"
|
||||
autogen="./autogen.sh && ./configure --prefix=$PREFIX --enable-static --disable-shared && make install -j $(nproc)"
|
||||
|
||||
cd vvenc && $make && cd ..
|
||||
cd vvdec && $make && cd ..
|
||||
cd fdk-aac && $autogen && cd ..
|
||||
cd libxml2 && $autogen && cd ..
|
||||
cd opus && ./autogen.sh && CFLAGS="-O2 -D_FORTIFY_SOURCE=0" LDFLAGS="-flto -s" ./configure --prefix=$PREFIX --enable-static --disable-shared && make install -j $(nproc) && cd ..
|
||||
mkdir -p libjxl/build && cd libjxl/build && cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_{TESTING,SHARED_LIBS}=OFF -DJPEGXL_ENABLE_{BENCHMARK,MANPAGES}=OFF -DJPEGXL_{ENABLE_PLUGINS,FORCE_SYSTEM_BROTLI}=ON -DCMAKE_INSTALL_PREFIX=$PREFIX .. -G Ninja && ninja install && cd ../../
|
||||
mkdir -p vmaf/libvmaf/build && cd vmaf/libvmaf/build && CFLAGS="-msse2 -mfpmath=sse -mstackrealign" meson -Denable_docs=false -Ddefault_library=static -Denable_float=true -Dbuilt_in_models=true -Dprefix=$PREFIX .. && ninja install && cd ../../../
|
||||
mkdir -p SDL/build && cd SDL/build && cmake -DCMAKE_EXE_LINKER_FLAGS="-static" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. && make install -j $(nproc) && cd ../../
|
||||
cd zimg && $autogen && cd ..
|
||||
mkdir -p soxr/build && cd soxr/build && cmake -D{WITH_LSR_BINDINGS,BUILD_TESTS,WITH_OPENMP}=off -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF .. && cmake --build . -j $(nproc) --target install && cd ../../
|
||||
mkdir -p dav1d/build && cd dav1d/build && meson -Denable_docs=false -Ddefault_library=static -Dprefix=$PREFIX .. && ninja install && cd ../../
|
||||
|
||||
sed -i 's/-lm/-lm -lstdc++/g' $PREFIX/lib/pkgconfig/libvmaf.pc
|
||||
|
||||
if [ "$OS" = "Windows" ]; then
|
||||
cd codec2
|
||||
sed -i 's|if(WIN32)|if(FALSE)|g' CMakeLists.txt
|
||||
grep -ERl "\b(lsp|lpc)_to_(lpc|lsp)" --include="*.[ch]" | \
|
||||
xargs -r sed -ri "s;((lsp|lpc)_to_(lpc|lsp));c2_\1;g"
|
||||
mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -D{UNITTEST,INSTALL_EXAMPLES}=off -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS="-static" .. -G "MinGW Makefiles"
|
||||
cmake --build . -j $nproc --target install
|
||||
cd ../../
|
||||
fi
|
||||
|
||||
cd FFmpeg-VVC
|
||||
chmod +x configure
|
||||
./configure --prefix=$PREFIX --enable-static --pkg-config-flags="--static" --extra-ldexeflags="-static" \
|
||||
--enable-libfdk-aac --enable-libvvenc --enable-libvvdec --enable-pic \
|
||||
--enable-libxml2 --enable-libopus --enable-libdav1d --enable-libjxl --enable-libzimg --enable-libvmaf --enable-libsoxr --enable-sdl2 && \
|
||||
--enable-libxml2 --enable-libopus --enable-libdav1d --enable-libjxl --enable-libzimg \
|
||||
--enable-libvmaf --enable-libsoxr --enable-sdl2 $extra --extra-version=VVCEasy && \
|
||||
make -j
|
||||
echo You are ready to preview VVC, view VVC information or convert from VVC using ffmpeg, ffplay and ffprobe.
|
||||
echo - Martin Eesmaa
|
||||
cd ..
|
||||
echo It is ready to go for prebuilt binaries of FFmpeg-VVC, you need to go directory called FFmpeg-VVC.
|
||||
echo "- 2024 Martin Eesmaa (VVCEasy, MIT License)"
|
||||
|
|
Loading…
Reference in New Issue