Skip to content

Latest commit

 

History

History
390 lines (243 loc) · 8.26 KB

File metadata and controls

390 lines (243 loc) · 8.26 KB

Using AviSynth+ on POSIX systems

As of version 3.5, AviSynth+ can now be built and used natively on Linux, macOS, and BSD.

.. toctree::
    :maxdepth: 3

Depending on your OS or distribution, the commands to fetch the necessary prerequisites for building AviSynth+ differ.

At a bare minimum:

  • CMake 3.8 or higher.
  • GCC 8 or higher, or similarly recent version of Clang or AppleClang.

Note

The use of Ninja as the generator for CMake is a matter of personal preference. Feel free to use GNU Make if so compelled (i.e. just a plain 'cmake ..' invocation).

sudo apt-get install build-essential cmake git ninja-build checkinstall
git clone 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

18.04 ships with GCC 7, which is not sufficient to build AviSynth+ without the use of the filesystem submodule.

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

Not all Linux distributions have checkinstall in their repositories, either due to a lack of checkinstall working with their package management system or simply due to omission. In these cases, the install step is a little different:

sudo ninja install
sudo ldconfig
Requires Homebrew:
brew install cmake ninja gcc

GCC isn't strictly necessary for AviSynth+, but it can side-step the need to use an external implementation on High Sierra and Mojave.

Apple's libc++ doesn't support the C++17 filesystem functionality on either of these versions of macOS, so we have to resort to using an external implementation as a submodule.

git clone --recursive https://github.com/AviSynth/AviSynthPlus && \
cd AviSynthPlus && \
mkdir avisynth-build && \
cd avisynth-build

cmake ../ -G Ninja && \
ninja && \
sudo ninja install

C++17 filesystem support is available on Catalina, so it can be built with the default Clang installation.

cmake ../ -G Ninja && \
ninja && \
sudo ninja install

Tested on FreeBSD 12.1.

pkg install cmake git gmake ninja

git clone https://github.com/AviSynth/AviSynthPlus && \
cd AviSynthPlus && \
mkdir avisynth-build && \
cd avisynth-build
cmake ../ && \
gmake -j$(nproc) && \
gmake install
cmake ../ -G Ninja && \
ninja && \
sudo ninja install

On all of these OSes, AviSynth+ can interface with FFmpeg. This change was applied to the FFmpeg git master branch on 2020-04-05.

To compile a basic build of FFmpeg that supports AviSynth+, the following steps will suffice:

First, enable the Sources repository by either enabling it using the Software Sources dialog or by uncommenting the right lines in /etc/apt/sources.list.

sudo apt-get build-dep ffmpeg
sudo apt-get install nasm libsdl2-dev

Homebrew prerequisites:

brew install xz sdl2 pkg-config nasm
pkg install nasm sdl2
git clone https://git.videolan.org/git/ffmpeg.git
cd ffmpeg
    ./configure --prefix=$HOME/ffmpeg_build --enable-gpl --enable-version3 \
    --disable-doc --disable-debug --enable-pic --enable-avisynth && \
make -j$(nproc) && \
make install

Installing FFmpeg to the system can be done by leaving out the --prefix option and then using the following checkinstall command:

sudo checkinstall --pkgname=ffmpeg --pkgversion="7:$(git rev-list \
--count HEAD)-g$(git rev-parse --short HEAD)" --backup=no --deldoc=yes \
--delspec=yes --deldesc=yes --strip=yes --stripso=yes --addso=yes \
--fstrans=no --default
    ./configure --prefix=$HOME/ffmpeg_build --enable-gpl --enable-version3 --disable-doc \
    --disable-debug --enable-avisynth
make -j$(nproc)
make install

On Catalina, --extra-cflags="-fno-stack-check" is necessary when using AppleClang as the compiler.

    ./configure --prefix=$HOME/ffmpeg_build --enable-gpl --enable-version3 --disable-doc \
    --disable-debug --enable-pic --enable-avisynth --cc=cc
gmake -j$(nproc)
gmake install

FFplay can be used to preview scripts in a pinch; if mpv or VLC is built against the patched version of FFmpeg, those can be used to play back scripts in a more comfortable player experience.

The easiest two scripts to test the installation are Version or Colorbars/ColorbarsHD.

Version()
Colorbars() # or ColorbarsHD()

And running this script in the test build of FFmpeg:

cd ~/ffmpeg_build/bin
[create the script in this directory, for ease of testing]

# to play the script:
./ffplay -i test.avs

# to convert as usual:
./ffmpeg -i test.avs [encoding options]

Loading actual video sources will require a source filter. FFMS2 doesn't require any porting to these OSes, making it the most straightforward option at the moment.

FFMS2 doesn't require any additional prerequisites, so it can be built straight away.

git clone https://github.com/ffms/ffms2 && \
cd ffms2
    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
brew install autoconf automake libtool m4

    PKG_CONFIG_PATH=$HOME/ffmpeg_build/lib/pkgconfig \
    CPPFLAGS="-I/usr/local/include/avisynth" \
    ./autogen.sh --enable-shared --enable-avisynth && \
make -j$(nproc) && \
sudo make install
pkg install autoconf automake libtool m4

    PKG_CONFIG_PATH=$HOME/ffmpeg_build/lib/pkgconfig \
    CPPFLAGS="-I/usr/local/include/avisynth" \
    ./autogen.sh --enable-shared --enable-avisynth && \
gmake -j$(nproc) && \
gmake install

AviSynth+ will use several directories for autoloading: the avisynth/ subdirectory where libavisynth.so was installed, $HOME/.avisynth, and the directory given to the USER_AVS_PLUGINDIR_LOCATION configuration option (defaults to $HOME/.local/lib/avisynth). The latter of which can hold plugins (and symlinks to plugins) or AVSI files without needing root permissions.

On FreeBSD, procfs needs to be mounted first in order for autoloading to function.

Back to the :doc:`main page <../../index>`

$ Date: 2021-01-01 20:26:18-05:00 $