AWS Logo
Menu
How to install FFmpeg on Amazon Linux

How to install FFmpeg on Amazon Linux

FFmpeg is a powerful open-source software suite for handling multimedia data. It's widely used for various tasks such as transcoding, streaming, and audio/video manipulation. For example to prepare an audio and video dataset to fine-tune multimodal models on Amazon SageMaker AI. This guide will walk you through the process of installing FFmpeg on Amazon Linux.

Malte Reimann
Amazon Employee
Published Feb 3, 2025
FFmpeg is not present in the standard yum repositories for Amazon Linux. It's crucial to install FFmpeg correctly to maintain security and comply with licensing requirements. This guide will walk you through two installation approaches: a quick development setup using Conda and a production-grade build optimized for enterprise environments. The goal is to install FFmpeg in the free codec LGPLv2.1 dynamic-link configuration to ensure compatibility with commercial use.

Prerequisites

  • An Amazon Linux 2 or Amazon Linux 2023 instance
  • Sudo access on the instance

Quick Start with Conda

For data scientists and researchers working in isolated development environments, FFmpeg is readily available through Conda:
We specify to match a version that contains lgpl to install the package that is compatible with LGPLv2.1 instead of the default package that is licensed under a GPL-2.0 license.
The Conda packaged licensed under GPL-2.0 has significant implications requiring the release of source code of linked applications which creates licensing obligations for commercial products and might conflict with policies for dependencies in your enterprise.

Why LGPLv2.1 Configuration?

When installing FFmpeg for AI/ML workflows, especially in commercial environments, the license configuration is crucial:
  • Commercial Compatibility: LGPLv2.1 allows linking FFmpeg with proprietary software, making it suitable for commercial AI/ML applications
  • Flexible Usage: You can use FFmpeg in your AI pipelines without having to release your entire application's source code
  • Legal Compliance: Ensures compatibility with various software licenses, reducing legal risks in enterprise environments
Important: This guide specifically avoids GPL components to maintain maximum flexibility for commercial and proprietary AI/ML applications. This is no legal advice.

Enterprise-Grade Installation

For production environments teams often require clear license compliance and security hardening to reduce the attack surface.
Let's build a hardened, LGPLv2.1-compliant version of FFmpeg suitable for enterprise use.

Step-by-Step Installation Guide

Install required dependencies:
Create a directory for FFmpeg source files:
Download and extract FFmpeg source:
Configure FFmpeg build:
This configuration:
  • disables GPL features (--enable-gpl is not used)
  • disables version 3 licenses (--enable-version3 is not used)
  • disables non-free components (--enable-nonfree is not used)
  • disables static builds (--disable-static)
  • enables shared libraries (--enable-shared)
  • adds security hardening flags
Note: FFmpeg has many components and codecs. As a result compilation in the next step will take a while. You can reduce the build time by only installing the specific codecs that you need for your use case.
Add the following flags to the command above and replace libx264 and h264 with the name of the encoder and decoder you need:
--disable-everything
--enable-small
--enable-encoder=libx264
--enable-decoder=h264
Next, compile and install FFmpeg:
As a final step you will need to update your PATH, for example system-wide or for a specific user. To update the PATH system-wide add the following system-wide configuration:
Reload the systemd configuration: sudo systemctl daemon-reexec.
Reboot the system for the configuration to take effect: sudo reboot.

Comparing Installations

AspectConda InstallationEnterprise Build
Installation TimeMinutes~30 minutes
LicenseGPL-2.0 or LGPLv2.1LGPLv2.1
Security HardeningBasicEnhanced
Codec SupportComprehensiveMinimal
DependenciesManyFew
Suitable forDevelopmentProduction

Uninstall

To remove the installation:

What's Next?

In this guide you’ve installed FFmpeg on Amazon Linux 2 or Amazon Linux 2023. Here are some next step to further enhance your FFmpeg deployment:
- Create reproducible builds with Docker. Like this personal repository giusedroid/ffmpeg-lgpl-amazonlinux2 from an AWS employee does.
- Set up CI/CD pipelines
- Implement systematic security scanning
- Automate license compliance checks
Which of these topics would help your team's workflow? Let me know in the comments!
Big thanks to Wojtek Gawroński for providing feedback on this post.
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments