Introduction to FFmpeg
        
        
          FFmpeg is a solution to record,
          convert and stream audio and video. It is a very fast video and
          audio converter and it can also acquire from a live audio/video
          source. Designed to be intuitive, the command-line interface
          (ffmpeg) tries to
          figure out all the parameters, when possible. FFmpeg can also convert from any sample rate
          to any other, and resize video on the fly with a high quality
          polyphase filter. FFmpeg can use a
          Video4Linux compatible video source and any Open Sound System audio
          source.
        
        
          ![[Note]](../images/note.png) 
          
            Note
          
          
            Development versions of BLFS may not build or run some packages
            properly if LFS or dependencies have been updated since the most
            recent stable versions of the books.
          
         
        
          Package Information
        
        
          
            - 
              
                Download (HTTP): https://ffmpeg.org/releases/ffmpeg-7.1.2.tar.xz
               
- 
              
                Download MD5 sum: 02fad5aa6db43488f748c397baccc326
               
- 
              
                Download size: 11 MB
               
- 
              
                Estimated disk space required: 209 MB (add 1.7 GB for the
                FATE suite/tests, add 869 MB for documentation)
               
- 
              
                Estimated build time: 1.6 SBU (using parallelism=4; add 3.2
                SBU (with THREADS=4) to run the FATE suite after sample files
                are downloaded; add 0.2 SBU for doxygen docs)
               
 
        
          Additional Downloads
        
        
        
          FFmpeg Dependencies
        
        
          Recommended
        
        
          dav1d-1.5.1, libaom-3.13.1 (for chroma subsampling
          outside of YUV420) libass-0.17.4, fdk-aac-2.0.3, FreeType-2.14.1, LAME-3.100, libvorbis-1.3.7,
          libvpx-1.15.2, Opus-1.5.2, SVT-AV1-3.1.2 (only
          supports YUV420), x264-20250815, x265-4.1, and NASM-3.01
        
        
          Recommended for desktop use
        
        
          alsa-lib-1.2.14, libva-2.22.0, and SDL2-2.32.10
        
        
          Recommended for systems with NVIDIA Video
        
        
          libvdpau-1.5 and libvdpau-va-gl-0.4.2
        
        
          Optional
        
        
          Doxygen-1.15.0, Fontconfig-2.17.1, FriBidi-1.0.16, frei0r-2.5.0, libcdio-2.1.0
          (to identify and play CDs), libdrm-2.4.127 (for “kmsgrab” input),
          libjxl-0.11.1, libplacebo-7.351.0
          (for hardware accelerated color spaces and HDR tonemapping),
          libwebp-1.6.0, OpenJPEG-2.5.4, GnuTLS-3.8.10,
          PulseAudio-17.0, Samba-4.23.1,
          Speex-1.2.1, texlive-20250308 (or install-tl-unx) for PDF and PS documentation,
          v4l-utils-1.32.0, Vulkan-Loader-1.4.328.1, XviD-1.3.7,
          a graphical
          environment, Flite, GSM, libaacplus, libbluray,
          libcaca, libcelt, libdc1394,
          libdca,
          libiec61883,
          libilbc, libmodplug,
          libnut (Git checkout),
          librtmp,
          libssh,
          libtheora,
          libvpl
          (for non-vaapi QuickSync) with one of Intel-MediaSDK
          (Haswell/4000 series or below) or intel-onevpl
          (Broadwell/5000+), OpenAL, OpenCore AMR,
          Srt,
          Schroedinger,
          TwoLAME,
          vo-aaenc,
          vo-amrwbenc,
          and ZVBI
        
       
      
        
          Installation of FFmpeg
        
        
          First, apply a patch that adds an API necessary for some packages
          to build:
        
        patch -Np1 -i ../ffmpeg-7.1.2-chromium_method-1.patch
        
          Install FFmpeg by running the
          following commands:
        
        ./configure --prefix=/usr        \
            --enable-gpl         \
            --enable-version3    \
            --enable-nonfree     \
            --disable-static     \
            --enable-shared      \
            --disable-debug      \
            --enable-libaom      \
            --enable-libass      \
            --enable-libfdk-aac  \
            --enable-libfreetype \
            --enable-libmp3lame  \
            --enable-libopus     \
            --enable-libvorbis   \
            --enable-libvpx      \
            --enable-libx264     \
            --enable-libx265     \
            --enable-openssl     \
            --enable-libdav1d    \
            --enable-libsvtav1   \
            --ignore-tests=enhanced-flv-av1,enhanced-flv-multitrack \
            --docdir=/usr/share/doc/ffmpeg-7.1.2 &&
make &&
gcc tools/qt-faststart.c -o tools/qt-faststart
        
          HTML documentation was built in the previous step. If you have
          texlive-20250308 installed and wish
          to build PDF and Postscript versions of the documentation, issue
          the following commands:
        
        pushd doc &&
for DOCNAME in `basename -s .html *.html`
do
    texi2pdf -b $DOCNAME.texi &&
    texi2dvi -b $DOCNAME.texi &&
    dvips    -o $DOCNAME.ps   \
                $DOCNAME.dvi
done &&
popd &&
unset DOCNAME
        
          If you have Doxygen-1.15.0 installed and you wish to build
          (if --disable-doc was used) or rebuild the html documentation,
          issue:
        
        doxygen doc/Doxyfile
        
          The fate-suite tests include comparisons with installed files, and
          should not be run before the package is installed. Therefore, if
          you desire to run them, instructions are given further below.
        
        
          Now, as the root user:
        
        make install &&
install -v -m755    tools/qt-faststart /usr/bin &&
install -v -m755 -d           /usr/share/doc/ffmpeg-7.1.2 &&
install -v -m644    doc/*.txt /usr/share/doc/ffmpeg-7.1.2
        
          If the PDF and Postscript documentation was built, issue the
          following commands, as the root
          user, to install them:
        
        install -v -m644 doc/*.pdf /usr/share/doc/ffmpeg-7.1.2 &&
install -v -m644 doc/*.ps  /usr/share/doc/ffmpeg-7.1.2
        
          If you used doxygen
          to manually create the API documentation, install it by issuing the
          following commands as the root
          user:
        
        install -v -m755 -d /usr/share/doc/ffmpeg-7.1.2/api                     &&
cp -vr doc/doxy/html/* /usr/share/doc/ffmpeg-7.1.2/api                  &&
find /usr/share/doc/ffmpeg-7.1.2/api -type f -exec chmod -c 0644 \{} \; &&
find /usr/share/doc/ffmpeg-7.1.2/api -type d -exec chmod -c 0755 \{} \;
        
          To properly test the installation you must have rsync-3.4.1
          installed and follow the instructions for the FFmpeg Automated Testing
          Environment (FATE). First, about 1 GB of sample files used to
          run FATE are downloaded with the command:
        
        make fate-rsync SAMPLES=fate-suite/
        
          The fate-suite directory is created
          and the files are downloaded there. That command actually runs an
          rsync command to obtain the sample files. You may want to compress
          and keep this directory for testing again, for testing in another
          system, or for when a new version of ffmpeg is released. Then,
          unpack the sample files in the source directory, and run the
          make fate-rsync ...
          command above to sync with the upstream repository. The download
          size and time are drastically reduced by doing this. Estimated
          values in "Package Information" do not include the download SBU.
          Some samples may have been removed in newer versions, so in order
          to be sure local and server fate samples are identical when you use
          previously saved samples, run the following command:
        
        rsync -vrltLW  --delete --timeout=60 --contimeout=60 \
      rsync://fate-suite.ffmpeg.org/fate-suite/ fate-suite/
        
          Next, execute FATE with the following commands (there are more than
          3800 tests in the suite):
        
        make fate THREADS=N SAMPLES=fate-suite/ | tee ../fate.log &&
grep ^TEST ../fate.log | wc -l
        
          where N is an integer,
          N ≤ number of cores in
          the system.
        
        
          A successful run should return no errors or warnings, just a list
          of tests and total amount at the end.
        
       
      
        
          Command Explanations
        
        
          find ... ;: Fixes
          permissions of documentation files and directories.
        
        
          --enable-gpl: Enables the
          use of GPL code and permits support for postprocessing, swscale and
          many other features.
        
        
          --enable-version3: Enables
          the use of (L)GPL version 3 code.
        
        
          --enable-nonfree: Enables
          the use of nonfree code. Note that the resulting libraries and
          binaries will be unredistributable.
        
        
          --disable-static: This
          switch prevents installation of static versions of the libraries.
        
        
          --enable-shared: Enables
          building shared libraries, otherwise only static libraries are
          built and installed.
        
        
          --disable-debug: Disables
          building debugging symbols into the programs and libraries.
        
        
          --enable-libaom: Enables
          AV1 encoding and decoding via libaom.
        
        
          --enable-libass: Enables
          ASS/SSA subtitle format rendering via libass.
        
        
          --enable-libdav1d: Enables
          AV1 decoding via libdav1d.
        
        
          --enable-libdrm: Use this switch if
          libdrm-2.4.127 is installed to build the
          “kmsgrab”
          input module which is useful for screen capturing or streaming.
        
        
          --enable-libfdk-aac:
          Enables AAC audio encoding via libfdk-aac.
        
        
          --enable-libfreetype:
          Enables Freetype support.
        
        
          --enable-libmp3lame:
          Enables MP3 audio encoding via libmp3lame.
        
        
          --enable-libsvtav1: Enables
          AV1 encoding via libSvtAv1Enc. It
          however only supports chroma subsampling of YUV420.
        
        
          --enable-libvorbis
          --enable-libvpx: Enables
          WebM encoding via libvorbis and
          libvpx.
        
        
          --enable-libx264: Enables
          high-quality H.264/MPEG-4 AVC encoding via libx264.
        
        
          --enable-libx265: Enables
          high-quality H.265/HEVC encoding via libx265.
        
        
          --enable-openssl: Enables
          HTTPS protocol for network streams.
        
        
          --ignore-tests=...:
          Disables tests that fail to run on BLFS without the optional
          packages. Currently the AV1 test is disabled as it needs dav1d to
          do AV1 decoding on the CPU. The test might work if you have a GPU
          that can decode AV1, but this was not tested.
        
        
          --enable-gnutls: Use this option
          instead of --enable-openssl, if you want to use
          GnuTLS instead of OpenSSL for HTTPS protocol.
        
        
          --disable-doc: Disables building html
          documentation. This is only needed if Doxygen-1.15.0
          is installed and you do not want to build the html documentation.
        
        
          --enable-libpulse: Enables support for
          Pulseaudio for audio output.
        
        
          --enable-libplacebo: Enables support
          for libpulse for hardware
          accelerated color spaces.
        
        
          gcc tools/qt-faststart.c -o
          tools/qt-faststart: This builds the qt-faststart program which can
          modify QuickTime formatted movies (.mov or .mp4) so
          that the header information is located at the beginning of the file
          instead of the end. This allows the movie file to begin playing
          before the entire file has been downloaded.
        
        
          ![[Note]](../images/note.png) 
          
            Note
          
          
            Support for most of the dependency packages requires using
            options passed to the configure script. View the
            output from ./configure
            --help for complete information about enabling
            dependency packages.
          
         
       
      
        
          Contents
        
        
          
            
              Installed Programs:
              ffmpeg, ffplay, ffprobe, and
              qt-faststart
            
            
              Installed Libraries:
              libavcodec.so, libavdevice.so,
              libavfilter.so, libavformat.so, libavutil.so, libpostproc.so,
              libswresample.so, and libswscale.so
            
            
              Installed Directories:
              /usr/include/libav{codec,device,filter,format,util},
              /usr/include/libpostproc, /usr/include/libsw{resample,scale},
              /usr/share/doc/ffmpeg-7.1.2, and /usr/share/ffmpeg
            
           
         
        
          
            Short Descriptions
          
          
            
              
              
            
            
              
                | 
                    ffmpeg
                   | 
                    is a command-line tool to convert video files, network
                    streams and input from a TV card to several video formats
                   | 
              
                | 
                    ffplay
                   | 
                    is a very simple and portable media player using the
                    ffmpeglibraries and the
                    SDL library | 
              
                | 
                    ffprobe
                   | 
                    gathers information from multimedia streams and prints it
                    in a human and machine-readable fashion
                   | 
              
                | 
                    qt-faststart
                   | 
                    moves the index file to the front of quicktime (mov/mp4)
                    videos
                   | 
              
                | 
                    libavcodec.so | 
                    is a library containing the FFmpeg codecs (both encoding and
                    decoding)
                   | 
              
                | 
                    libavdevice.so | 
                    is the FFmpeg device
                    handling library
                   | 
              
                | 
                    libavfilter.so | 
                    is a library of filters that can alter video or audio
                    between the decoder and the encoder (or output)
                   | 
              
                | 
                    libavformat.so | 
                    is a library containing the file formats handling (mux
                    and demux code for several formats) used by ffplay as well as
                    allowing the generation of audio or video streams
                   | 
              
                | 
                    libavresample.so | 
                    is a library containing functions for resampling audio
                    and video.
                   | 
              
                | 
                    libavutil.so | 
                    is the FFmpeg utility
                    library
                   | 
              
                | 
                    libpostproc.so | 
                    is the FFmpeg post
                    processing library
                   | 
              
                | 
                    libswresample.so | 
                    is the FFmpeg audio
                    rescaling library, it contains functions for converting
                    audio sample formats
                   | 
              
                | 
                    libswscale.so | 
                    is the FFmpeg image
                    rescaling library
                   |