Rate This Document
Findability
Accuracy
Completeness
Readability

FFmpeg

To use x265 in video encoding, you need to install FFmpeg. After the installation process is complete, view the FFmpeg version to check whether the installation is successful. The installation directory, source code directory, and compilation directory provided in the following procedure are all examples. Replace them with actual ones.

  1. Obtain the ffmpeg-6.0.1.tar.gz software package (see Table 2), upload it to the /home/sourcecode directory, and decompress it.
    tar -zxvf ffmpeg-6.0.1.tar.gz
  2. Create an installation directory.
    mkdir -p /home/ffmpeg/install
  3. Create a source code directory.
    mkdir -p /home/ffmpeg/src
  4. Copy the source code to the source code directory.
    cp -r /home/sourcecode/ffmpeg-6.0.1/* /home/ffmpeg/src 
  5. Create a compilation directory and go to the directory.
    mkdir -p /home/ffmpeg/build && cd /home/ffmpeg/build
  6. Set compilation parameters. Table 1 describes the parameters.
    export PKG_CONFIG_PATH=/home/x265/install/lib/pkgconfig/
    export LD_LIBRARY_PATH=/home/ffmpeg/install/lib/:/home/x265/install/lib/:${LD_LIBRARY_PATH}
    /home/ffmpeg/src/configure --enable-libx265 --enable-gpl --enable-pthreads --disable-autodetect --enable-static --extra-cflags="-I/home/x265/install/include" --extra-ldflags="-L/home/x265/install/lib -lm -lstdc++" --prefix=/home/ffmpeg/install
    Table 1 Compilation parameters

    Parameter

    Description

    export PKG_CONFIG_PATH

    Sets the x265 installation location so that the x265 library files can be found in the subsequent compilation process.

    export LD_LIBRARY_PATH

    Adds the FFmpeg and x265 library file directories to the dynamic link library (DLL) search path so that these library files can be found in the subsequent linking process.

    /home/ffmpeg/src/configure

    Specifies the FFmpeg source code directory and runs the configure script in the directory to configure compilation options.

    --enable-libx265

    Enables support for libx265, which will enable FFmpeg to encode and decode HEVC/H.265 videos.

    --enable-gpl

    Enables the General Public License (GPL) to allow FFmpeg to use some libraries governed by the GPL license.

    --enable-pthreads

    Enables thread support to enhance parallel performance on multi-core processors.

    --disable-autodetect

    Disables automatic detection. You need to manually set the paths and options of the dependency libraries.

    --enable-static

    Enables static linking. The dependency libraries are statically linked to the generated executable file during the compilation. If you require dynamic linking, set this parameter to --enable-shared.

    --extra-cflags="-I/home/x265/install/include"

    Adds the additional C compilation parameter to specify the header file path of the x265 library.

    --extra-ldflags="-L/home/x265/install/lib -lm -lstdc++"

    Adds the additional linker parameters to specify the link library path of the x265 library and link to the standard math library and C++ standard library.

    --prefix=/home/ffmpeg/install

    Specifies the prefix of the installation directory. After the compilation is complete, the software is installed in the specified directory.

  7. Perform the compilation and installation.
    make -j256
    make install
  8. Go to the FFmpeg installation directory.
    cd /home/ffmpeg/install/bin
  9. View the FFmpeg version.
    ./ffmpeg

    If the command output reads "ffmpeg version 6.0.1 Copyright (c) 2000-2023 the FFmpeg developers", the installation is successful.