Last active
September 14, 2024 12:31
-
-
Save hekmon/b273e55139183370c5000f766fccc128 to your computer and use it in GitHub Desktop.
ffmpeg w vmaf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -ti --name ffmpeg_vmaf nvidia/cuda:12.5.1-devel-ubuntu24.04 /bin/bash | |
# cuda 12.6.0 and 12.6.1 produce a ffmpeg binary that segfault when using vmaf_cuda filter within ffmpeg | |
# INSIDE THE CONTAINER | |
## VMAF | |
apt update && apt upgrade -y | |
apt install -y libopenjp2-7-dev ninja-build cmake git python3-full python3-pip nasm xxd pkg-config curl unzip | |
git clone https://github.com/Netflix/vmaf.git && cd vmaf && git checkout master && cd .. | |
git clone https://github.com/FFmpeg/FFmpeg.git && cd FFmpeg && git checkout n7.0.2 && cd .. | |
git clone https://github.com/FFmpeg/nv-codec-headers.git && cd nv-codec-headers && git checkout n12.2.72.0 && make && make install && cd .. | |
python3 -m venv ffmpegvmaf | |
cd ffmpegvmaf/bin | |
export PATH="$(pwd):$PATH" | |
cd / | |
python3 -m pip install meson | |
cd vmaf && meson libvmaf/build libvmaf -Denable_cuda=true -Denable_avx512=true --buildtype release && ninja -vC libvmaf/build && ninja -vC libvmaf/build install && cd .. | |
## OTHERS | |
apt install -y nasm libx264-dev libx265-dev libnuma-dev libvpx-dev libfdk-aac-dev libopus-dev libdav1d-dev | |
## BUILD | |
cd FFmpeg && ./configure \ | |
--enable-libnpp \ | |
--enable-nonfree \ | |
--enable-nvdec \ | |
--enable-nvenc \ | |
--enable-cuvid \ | |
--enable-cuda \ | |
--enable-cuda-nvcc \ | |
--enable-libvmaf \ | |
--enable-ffnvcodec \ | |
--enable-gpl \ | |
--enable-nonfree \ | |
--enable-libx264 \ | |
--enable-libx265 \ | |
--enable-libvpx \ | |
--enable-libfdk-aac \ | |
--enable-libopus \ | |
--enable-libdav1d \ | |
--disable-stripping \ | |
--extra-cflags="-I/usr/local/cuda/include" \ | |
--extra-ldflags="-L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64/stubs/" && \ | |
make -j$(nproc) && make install | |
# OUTSIDE THE CONTAINER | |
docker cp ffmpeg_vmaf:/usr/local/bin/ffmpeg /usr/local/bin/ffmpeg | |
## libvmaf | |
docker cp ffmpeg_vmaf:/usr/local/lib/x86_64-linux-gnu/libvmaf.so.3.0.0 /usr/local/lib/libvmaf.so.3.0.0 | |
ln -s /usr/local/lib/libvmaf.so.3.0.0 /usr/local/lib/libvmaf.so.3 | |
## aac | |
docker cp ffmpeg_vmaf:/usr/lib/x86_64-linux-gnu/libfdk-aac.so.2.0.2 /usr/local/lib/libfdk-aac.so.2.0.2 | |
ln -s /usr/local/lib/libfdk-aac.so.2.0.2 /usr/local/lib/libfdk-aac.so.2 | |
## vpx | |
docker cp ffmpeg_vmaf:/usr/lib/x86_64-linux-gnu/libvpx.so.9.0.0 /usr/local/lib/libvpx.so.9.0.0 | |
ln -s /usr/local/lib/libvpx.so.9.0.0 /usr/local/lib/libvpx.so.9 | |
## dav1d | |
docker cp ffmpeg_vmaf:/usr/lib/x86_64-linux-gnu/libdav1d.so.7.0.0 /usr/local/lib/libdav1d.so.7.0.0 | |
ln -s /usr/local/lib/libdav1d.so.7.0.0 /usr/local/lib/libdav1d.so.7 | |
## opus | |
docker cp ffmpeg_vmaf:/usr/lib/x86_64-linux-gnu/libopus.so.0.9.0 /usr/local/lib/libopus.so.0.9.0 | |
ln -s /usr/local/lib/libopus.so.0.9.0 /usr/local/lib/libopus.so.0 | |
## x264 | |
docker cp ffmpeg_vmaf:/usr/lib/x86_64-linux-gnu/libx264.so.164 /usr/local/lib/libx264.so.164 | |
## x265 | |
docker cp ffmpeg_vmaf:/usr/lib/x86_64-linux-gnu/libx265.so.199 /usr/local/lib/libx265.so.199 | |
LD_LIBRARY_PATH=/usr/local/lib/ ffmpeg | |
# or to make it permanent | |
echo '/usr/local/lib' > /etc/ld.so.conf.d/99local.conf | |
ldconfig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment