ffmpeg has the option to build in quite a few dependencies / external libraries, so it's rather complex. Last time I did it I used https://github.com/rdp/ffmpeg-windows-build-helpers but there are other build scripts on GitHub that also seem like they'd be good Answer from ElectronRotoscope on reddit.com
🌐
Johnvansickle
johnvansickle.com › ffmpeg
John Van Sickle - FFmpeg Static Builds
Here you'll find the latest versions of FFmpeg for Linux kernels 3.2.0 and up. For installation instructions please read the FAQ. Note: it's highly recommended to use git master builds, because bug fixes and other improvements are added daily. All static builds available here are licensed under ...
🌐
GitHub
github.com › zimbatm › ffmpeg-static
GitHub - zimbatm/ffmpeg-static: Scripts to build ffmpeg with all the deps statically (webm + h264 included) · GitHub
Once you have the build dependencies, run ./build.sh, wait and you should get the ffmpeg binary in target/bin · # Debian & Ubuntu $ apt-get install build-essential curl tar libass-dev libtheora-dev libvorbis-dev libtool cmake automake autoconf # OS X # 1. install XCode # 2. install XCode command line tools # 3. install homebrew # brew install openssl frei0r sdl2 wget · $ ./build.sh [-j <jobs>] [-B] [-d] # ...
Starred by 539 users
Forked by 259 users
Languages   Shell 71.2% | Perl 24.9% | Dockerfile 3.9%
Discussions

linux - How to compile FFmpeg as static (single file) - Stack Overflow
I would like to compile FFmpeg 4.1.3 as static or single file, After compiled. It's shared binary. Here is what I do Install the dependencies apt-get -y install build-essential autoconf automake... More on stackoverflow.com
🌐 stackoverflow.com
Can anyone tell me how you compile ffmpeg from a GitHub version, preferably into a static build?
ffmpeg has the option to build in quite a few dependencies / external libraries, so it's rather complex. Last time I did it I used https://github.com/rdp/ffmpeg-windows-build-helpers but there are other build scripts on GitHub that also seem like they'd be good More on reddit.com
🌐 r/ffmpeg
19
4
September 26, 2022
linux - bash script to install / update ffmpeg static builds - Stack Overflow
I'm trying to make my first "real" bash script to do some real work than can be executed both manually and through cron jobs. The script should download and install the ffmpeg-static-build from ht... More on stackoverflow.com
🌐 stackoverflow.com
What is ffmpeg static build?
It's simply complied and linked such that there are no dlls (windows) or sos (shared objects: linux) the executable depends to run. Sometimes people want a "self contained" version, for reasons like they need to run different versions and having them self contained allows that. More on reddit.com
🌐 r/ffmpeg
9
2
September 15, 2021
🌐
npm
npmjs.com › package › ffmpeg-static
ffmpeg-static - npm
November 14, 2025 - Static ffmpeg binaries for macOS, Linux, Windows.
      » npm install ffmpeg-static
    
Published   Nov 14, 2025
Version   5.3.0
🌐
Vultr
docs.vultr.com › how-to-install-the-latest-static-build-of-ffmpeg
How to Install the Latest Static Build of FFmpeg Guide | Vultr Docs
April 1, 2025 - The FFmpeg Static Builds website provides the latest builds for Linux kernels 3.2.0 and up.
🌐
GitHub
github.com › eugeneware › ffmpeg-static
GitHub - eugeneware/ffmpeg-static: ffmpeg static binaries for Mac OSX and Linux and Windows · GitHub
Supports macOS (64-bit and arm64), Linux (32 and 64-bit, armhf, arm64), Windows (32 and 64-bit). The ffmpeg version currently used is 6.1.1. The binaries download script downloads binaries from these locations: ... The script extracts build ...
Starred by 1.3K users
Forked by 201 users
Languages   JavaScript 65.5% | Shell 34.5%
🌐
Stack Overflow
stackoverflow.com › questions › 56338654 › how-to-compile-ffmpeg-as-static-single-file
linux - How to compile FFmpeg as static (single file) - Stack Overflow
./configure --disable-shared --enable-static --enable-pthreads --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-filters --enable-openssl --enable-runtime-cpudetect --extra-version=Patrickz
🌐
Reddit
reddit.com › r/ffmpeg › can anyone tell me how you compile ffmpeg from a github version, preferably into a static build?
r/ffmpeg on Reddit: Can anyone tell me how you compile ffmpeg from a GitHub version, preferably into a static build?
September 26, 2022 - In 2026 On Debian-like Linux systems, here is a comprehensive guide for installing the latest versions of the libx264, libx265, libaom-av1, libsvtav1, librav1e, and vvc encoders. It also allows you to add Intel and NVIDIA hardware acceleration: https://mendevi.readthedocs.io/1.2.4/developer_guide/ffmpeg.html ... I really wish there was a script that could clone a git and build a static build from that.
Find elsewhere
🌐
GitHub
github.com › BtbN › FFmpeg-Builds
GitHub - BtbN/FFmpeg-Builds · GitHub
Static Windows (x86_64) and Linux (x86_64) Builds of ffmpeg master and latest release branch.
Starred by 10.7K users
Forked by 1.4K users
Languages   Shell 83.4% | Dockerfile 14.0% | CMake 2.6%
Top answer
1 of 1
4

You got lost with what you're doing. Compare your script with this one.

Copy#!/bin/bash
# Still to come, see if the script runs with root privileges else exit

# Download FFMPEG static daily build and it's md5

# or exit if not
cd ~ || exit 2

# 1. get the file
wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-static.tar.xz

# 2. Check the md5 is correct
if ! diff <(md5sum ffmpeg-git-64bit-static.tar.xz) \
          <(curl -L https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-static.tar.xz.md5)
then 
    printf "%s\n" "md5sum doesn't match..." >&2 
    exit 1
fi

# 3. untar
tar -xf ffmpeg-git-64bit-static.tar.xz

# 4. and so on..
cp ffmpeg-*-static/ff* /usr/bin/
cp ffmpeg-*-static/ff* /usr/local/bin/
cp ffmpeg-*-static/qt-faststart /usr/bin/
cp ffmpeg-*-static/qt-faststart /usr/local/bin/
# Consider change second location to use ln -s
# Remove downloads and do some clean up

rm -fr ffmpeg-*

#EOF

A few fixes to your updated version. I removed your comments to make my own visible.

Copy#!/bin/bash
download_dir=~
dest_dir=/usr/bin/
version=ffmpeg-git-64bit-static.tar.xz
source_url=https://johnvansickle.com/ffmpeg/builds/${version}
md5_url=https://johnvansickle.com/ffmpeg/builds/${version}.md5

# You need braces to build blocks.
# As it was, your script terminated at the exit. Regardless. End of story.
cd ${download_dir} || {
    printf "%s\n" "You can't enter this folder." "Please change download_dir in this script..." >&2
    exit 1
}


if ! diff <(md5sum ${version}) <(curl -s ${md5_url})
then
    # Sum doesn't match is not really an error... I comment out the redirection.
    printf "%s\n" "md5sum doesn't match..." "Downloading new version" # >&2
    rm -f ${version} # >&2 -- Why would you redirect any output to stderr?
    curl ${source_url} -o ${download_dir}/${version} # >&2 -- Same as above.
else
    # You've done this already.
    # diff <(md5sum ${version}) <(curl -s ${md5_url})
    printf "%s\n" "Nothing new to download" # >&2 -- Why is this an error?
    exit # 3 -- I don't think this is any error. You checked and it's fine.
    # It might stay if you really MEAN it.
fi

# I'm not checking further.

tar -xf ffmpeg-git-*-static.tar.xz
mv ${download_dir}/ffmpeg-*-static/ff* "${dest_dir}"
mv ${download_dir}/ffmpeg-*-static/qt-faststart "${dest_dir}"

ln -sfn ${dest_dir}/qt-faststart /usr/local/bin/qt-faststart
ln -sfn ${dest_dir}/ffmpeg /usr/local/bin/ffmpeg
ln -sfn ${dest_dir}/ffmpeg-10bit /usr/local/bin/ffmpeg-10bit
ln -sfn ${dest_dir}/ffprobe /usr/local/bin/ffprobe
ln -sfn ${dest_dir}/ffserver /usr/local/bin/ffserver

rm -fr ffmpeg-git-*-static

Answers to your comment questions.

  1. When is something to be determined as blocks?

    Here you can get a wider picture of blocks. In Bash they're called lists. Run this:

    Copyman bash | grep -A 30 'Compound Commands'
    

    and see what Bash's man has to say about them for a good start. This guide should be more approachable.

  2. How to make it output the current running command to the console ex. the tar -xf etc.?

    The only ready solution I know for this is to run Bash in the debugging mode, if that's what you want. You can turn it on anywhere in the script with

    Copy set -x
    

    Then you turn it off with:

    Copyset +x
    

    You can do the same in the command line.

    You can also set the whole script to run in this mode in the shebang.

    Copy#!/bin/bash -x
    

    Or you can tell the interpreter from the command line to run in this mode,

    Copybash -x ~/bin/your_script.bash
    
🌐
GitHub
github.com › toorop › ffmpeg-static-builder
GitHub - toorop/ffmpeg-static-builder: A comprehensive bash script to build a fully static FFmpeg binary on Ubuntu-based systems with support for modern codecs including x264, x265, VP8/VP9, AV1, MP3, Opus, and NVENC hardware acceleration.
A comprehensive bash script to build a fully static FFmpeg binary on Ubuntu-based systems with support for modern codecs including x264, x265, VP8/VP9, AV1, MP3, Opus, and NVENC hardware accelerati...
Author   toorop
🌐
Martin-riedl
ffmpeg.martin-riedl.de
Martin-Riedl.de - FFmpeg
This project provides static builds of FFmpeg, FFprobe and FFplay.
🌐
GitHub
github.com › pyke369 › sffmpeg
GitHub - pyke369/sffmpeg: full-featured static ffmpeg build helper
sffmpeg is a simple CMake-based full-featured FFmpeg build helper. It currently works on Linux and other POSIX systems (with a few tweaks). It has been tested the most heavily on Linux/x86_64 (Ubuntu 18.04).
Starred by 135 users
Forked by 48 users
Languages   CMake 90.9% | Shell 7.4% | Makefile 1.7% | CMake 90.9% | Shell 7.4% | Makefile 1.7%
🌐
GitHub
github.com › markus-perl › ffmpeg-build-script
GitHub - markus-perl/ffmpeg-build-script: The FFmpeg build script provides an easy way to build a static FFmpeg on OSX and Linux with non-free codecs included. · GitHub
The FFmpeg build script provides an easy way to build a static FFmpeg on OSX and Linux with non-free codecs included. - markus-perl/ffmpeg-build-script
Starred by 1.2K users
Forked by 365 users
Languages   Shell 90.2% | Dockerfile 9.8%
🌐
Super User
superuser.com › questions › 302850 › static-build-ffmpeg-0-8
linux - Static build ffmpeg 0.8 - Super User
Failing that kind of solution, here's a tangent, but it should work, go setup a SuSE box just like that one, download and compile ffmpeg from source, copy over the binaries you built.
🌐
PyPI
pypi.org › project › static-ffmpeg
static-ffmpeg
JavaScript is disabled in your browser. Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
Hostman
hostman.com › tutorials › how to install the latest static build of ffmpeg on debian
Installing the Latest Static Build of FFmpeg on Debian
December 30, 2025 - A guide on installing the latest static build of FFmpeg on Debian. Learn how to download, extract, and configure FFmpeg for efficient media processing.
Price   $
Address   1999 Harrison St 1800 9079, 94612, Oakland
Top answer
1 of 2
5

In my CentOS 5.11 and FFmpeg 3.0, I have to use options

--pkg-config-flags="--static"
--extra-cflags="-I$HOME/ffmpeg/include -static"
--extra-ldflags="-L$HOME/ffmpeg/lib -static"

--enable-static tell a complier to create the "static libraries" (libav*.a). We can be combine FFmpeg API in the other standalone (static) application.

--disable-shared tell a complier not to create the "dynamically linked shared object libraries" (libav*.so). These type of libraries can be load and use FFmpeg API by the other application.

These 2 options doesn't complie FFmpeg as standalone static executable.

2 of 2
11

Thanks for stib's suggestion. I leave my answer here.

FFmepg build process take higher priority to use dynamic library even if static libraries are ready. Therefore, I first removed some external libraries support from build configuration and make sure all external libraries are only static (remove *.dylib from prefix /usr/local/lib). Then rebuild it with the following command:

./configure --pkg-config-flags="--static" --libdir=/usr/local/lib --extra-version=ntd_20150128 --disable-shared --enable-static --enable-gpl --enable-pthreads --enable-nonfree  --enable-libass --enable-libfdk-aac  --enable-libmp3lame  --enable-libx264 --enable-filters --enable-runtime-cpudetect

Remember to define --pkg-config-flags="--static", asking build process to use static library. Then, we will get a single executable FFmpeg binary!

P.S.: I removed the libass support from the configuration, because libass depends on Fontconfig lib which I only have dynamic library available. I'll put the libass support back once I figured out how to make a static library of fontconfig.

Thanks.