How to Install the Latest Static Build of FFmpeg

Updated on November 21, 2023
How to Install the Latest Static Build of FFmpeg header image

Introduction

FFmpeg is a complete cross-platform solution to record, convert, and stream audio and video. This tutorial will show you how to install the latest version of FFmpeg. This guide uses Ubuntu 20.04 as an example, but will work on Debian 10, Centos 8, Fedora 32, and any Linux system with kernels 3.2.0 and up.

Prerequisites

About the two branches of FFmpeg

The FFmpeg project maintains two branches of its source codes: master and release. The master branch receives faster bug fixes, additional features, and security patches. It works well 99% of the time and is recommended for normal use.

Approximately every six months, the FFmpeg project makes a stable release, which includes selected changes from the master branch. Between major releases, point releases will appear that add important bug fixes but no new features. This tutorial provides instructions for both branches, choose the branch that meets your need.

Install FFmpeg

🤚 Attention: Uninstall any existing versions of FFmpeg to avoid conflicts.

  1. Create a folder to store the static build.

     $ sudo mkdir -p /opt/ffmpeg
     $ cd /opt/ffmpeg
  2. Download the archive.

    If using the master build:

     $ sudo wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz
     $ sudo wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz.md5
     $ md5sum -c ffmpeg-git-amd64-static.tar.xz.md5

    If using the release build:

     $ sudo wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
     $ sudo wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz.md5
     $ md5sum -c ffmpeg-release-amd64-static.tar.xz.md5

    Verify that md5sum returns an OK message before proceeding with the installation.

  3. Extract the static build from the archive.

     $ sudo tar xvf ffmpeg*.xz
     $ cd ffmpeg-*-static
     $ ls

    You will see something like this:

     ffmpeg  ffprobe  GPLv3.txt  manpages  model  qt-faststart  readme.txt
  4. Install the binaries globally.

     $ sudo ln -s "${PWD}/ffmpeg" /usr/local/bin/
     $ sudo ln -s "${PWD}/ffprobe" /usr/local/bin/

Test FFmpeg

  1. Go to your home folder and download a video file.

     $ cd ~
     $ wget https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4 -O origin.mp4
  2. Convert it to streaming compatible version.

     $ ffmpeg -i origin.mp4 -c copy -movflags +faststart streaming.mp4
  3. Verify the resulting video with ffprobe:

     $ ffprobe streaming.mp4

    If you see output like this, FFmpeg is working properly.

     Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'streaming.mp4':
     Metadata:
         major_brand     : isom
         minor_version   : 512
         compatible_brands: isomiso2avc1mp41
         title           : Big Buck Bunny - https://archive.org/details/BigBuckBunny_124
         encoder         : Lavf58.49.100
         comment         : license:http://creativecommons.org/licenses/by/3.0/
     Duration: 00:09:56.50, start: 0.000000, bitrate: 829 kb/s
         Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 697 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
         Metadata:
         handler_name    : VideoHandler
         Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
         Metadata:
         handler_name    : SoundHandler

Conclusion

If you want to learn more about FFmpeg, see the following resources.