Avisynth

From miki
Revision as of 16:14, 9 September 2024 by Mip (talk | contribs) (Created page with "== Build == * From [https://github.com/AviSynth/AviSynthPlus/blob/master/distrib/docs/english/source/avisynthdoc/contributing/posix.rst AviSynth doc]: * And [https://ubuntuforums.org/showthread.php?t=2472506 Can AviSynth on Linux work (Ubuntuforums)]. ;Build avisynthplus * Instruction from AviSynth doc, added {{deb|libdevil-dev}} as suggested on Ubuntuforums. * This creates and installs a nice deb package. <source lang="bash"> sudo apt-get install build-essential git cm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Build

Build avisynthplus
  • Instruction from AviSynth doc, added libdevil-dev as suggested on Ubuntuforums.
  • This creates and installs a nice deb package.
sudo apt-get install build-essential git cmake checkinstall libdevil-dev pkgconf ninja-build
# +libdevil-dev from ubuntuforums post

# Build (copy-paste from avisynth doc):
git clone --recursive https://github.com/AviSynth/AviSynthPlus && \
cd AviSynthPlus && \
mkdir avisynth-build && \
cd avisynth-build && \

cmake ../ -G Ninja && \
ninja && \
    sudo checkinstall --pkgname=avisynth --pkgversion="$(grep -r \
    Version avs_core/avisynth.pc | cut -f2 -d " ")-$(date --rfc-3339=date | \
    sed 's/-//g')-git" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
    --strip=yes --stripso=yes --addso=yes --fstrans=no --default ninja install
Build avs2yuv
  • Suggested by ubuntuforums, to test avisynth installation
git clone https://github.com/DJATOM/avs2yuv.git && \
mkdir -p avs2yuv/build && \
cd avs2yuv/build && \
cmake ../ && \
make && \
sudo make install
  • Test avisynth works as expected. Create a file version.avs:
Version(pixel_type="YUV420P8")
  • Play it:
avs2yuv test.avs -o - | mpv -
# Alternatively:
avs2yuv test.avs -o test && mplayer test
  • Re-build ffmpeg package with avisynth enabled
sudo apt install nasm libsdl2-dev devscripts fakeroot build-essential dpkg-dev debhelper dh-autoreconf
sudo apt-get build-dep ffmpeg
apt source ffmpeg
cd ffmpeg-6.1.1/
vi debian/rules
# Add --enable-avisynth to CONFIG lines
dch --local +avisynth
# Tell '* Enable avisynth'
# Rebuild with test disabled
# - We can run the tests manually with:
#     export LD_LIBRARY_PATH="libavcodec:libavdevice:libavfilter:libavformat:libavutil:libpostproc: \
#         libswresample:libswscale";      dh_auto_test -a --sourcedirectory=debian/standard -- -k
# - The failing test is some obscure test about headers missing in some include
DEB_BUILD_OPTIONS=nocheck debuild -us -uc
# This may fail because of some library not present: libGL.so
# This library comes in principe with libgl-dev, but it seems even reinstalling it doesn't create the the symlink
# If so:
#     sudo apt install --reinstall libgl-dev
#     cd /usr/lib/x86_64-linux-gnu/
#     sudo ln -s libGL.so.1 libGL.so
#     cd ~/build/ffmpeg-6.1.1/
#     DEB_BUILD_OPTIONS=nocheck debuild -us -uc
cd ..
# Install the new ffmpeg
# - We take the extra version of packages.
cat install-ffmpeg.sh
# sudo dpkg -r \
#   libavcodec60 libavformat60 libavfilter9
# sudo dpkg -i \
#   ffmpeg_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   ffmpeg-doc_6.1.1-3ubuntu5+avisynth1_all.deb \
#   libavcodec-dev_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavcodec-extra60_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavcodec-extra_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavdevice60_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavdevice-dev_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavfilter-dev_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavfilter-extra_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavfilter-extra9_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavformat-dev_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavformat-extra60_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavformat-extra_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavutil58_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libavutil-dev_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libpostproc57_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libpostproc-dev_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libswresample4_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libswresample-dev_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libswscale7_6.1.1-3ubuntu5+avisynth1_amd64.deb \
#   libswscale-dev_6.1.1-3ubuntu5+avisynth1_amd64.deb \
# 
# # libavcodec60_6.1.1-3ubuntu5+avisynth1_amd64.deb
# # libavfilter9_6.1.1-3ubuntu5+avisynth1_amd64.deb
# # libavformat60_6.1.1-3ubuntu5+avisynth1_amd64.deb
. install-ffmpeg.sh
sudo apt install -f
  • Check that ffmpeg accepts *.avs file:
ffplay -i version.avs
Build ffms2
  • We follow the avisynth doc / ubuntuforums.
git clone https://github.com/ffms/ffms2
cd ffms2
l /usr/local/include/|grep avisynth
PKG_CONFIG_PATH=$HOME/ffmpeg_build/lib/pkgconfig \
CPPFLAGS="-I/usr/local/include/avisynth" \
./autogen.sh --enable-shared --enable-avisynth && \
make -j$(nproc) && \
sudo checkinstall --pkgname=ffms2 --pkgversion="1:$(./version.sh)-git" \
--backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes --stripso=yes \
--addso=yes --fstrans=no --default

# Add ffms2 to avisynth
cd /usr/local/lib/avisynth/
sudo ln -s ../libffms2.so libffms2.so
  • Test that avisynth script accept the FFmpegSource2 command:
cat test.avs
# FFmpegSource2("test.mkv",atrack=-1)
ffplay -i test.avs