How to Install FFmpeg Ubuntu [2 Best Methods]

Written by

Reviewed by

Last updated: June 5, 2024

Expert verified

SVG Image

TL;DR

To install FFmpeg Ubuntu, follow these steps:

  1. Update and upgrade your Ubuntu system: sudo apt update, sudo apt upgrade.
  2. Download FFmpeg source code, extract it, navigate to the extracted directory.
  3. Build and install FFmpeg: ./configure, make, sudo make install.
  4. Verify the installed version of FFmpeg: ffmpeg -version

Read the guide below for a step-by-step guide to install FFmpeg Ubuntu, how to use it, benefits of installing it, and common errors with possible solutions.

Converting or editing video and audio files on your computer can be challenging, but I have a powerful solution for you: FFmpeg. This versatile tool can handle almost any multimedia task you throw at it. In this post, I’ll walk you through what FFmpeg is, why it’s so useful, and how to install FFmpeg on Ubuntu system. You’ll learn different installation methods and get some practical tips on using FFmpeg for your projects. Let’s explore and make your multimedia tasks easier and more efficient with FFmpeg!

What is FFmpeg?

FFmpeg is a powerful software tool used to handle multimedia files and streams. It can convert, edit, and stream audio and video files in various formats. With FFmpeg, you can easily change the format of a video, extract audio from a video, resize videos, and much more. It’s widely used because it’s free, open-source, and supports a huge range of formats.

How to Install FFmpeg Ubuntu

To install FFmpeg on Ubuntu, first open your terminal and update your package list with sudo apt update. Then, install FFmpeg using the command sudo apt install ffmpeg. After the installation completes, verify it by running ffmpeg -version to check the installed version. This process ensures that FFmpeg is correctly installed and ready for use on your Ubuntu system.

Here is the detailed step-by-step guide for each method to FFmpeg install Ubuntu.

1. Installing FFmpeg Using Apt Package

  1. Open a Terminal by pressing Ctrl+Alt+T.
opening terminal 10
  1. Type the following command to update your package list:
sudo apt update

This command updates the list of available packages on your Ubuntu system.

updating system package list 3
  1. Once the package list is updated, run the following command to upgrade your installed packages:
sudo apt upgrade

If prompted, enter your password and confirm the upgrade process. This command ensures that your system’s installed packages are up to date with the latest security patches, bug fixes, and improvements.

upgrading system packages 1
  1. Download the FFmpeg source code from the official website. Visit the FFmpeg website (https://ffmpeg.org/download.html) and choose the latest stable release or a specific version you prefer.
downloading ffmpeg source file 1
  1. Extract the downloaded source code archive to a directory of your choice.
extracting downloaded file
  1. Navigate to the extracted directory using the Terminal.
navigating to directory 3
  1. Run the following commands in sequence to build and install FFmpeg on Ubuntu:
./configure

The command will configure the build options.

configuring ffmpeg installation
  1. Now run the following command:
make

The command will compile FFmpeg make file.

building ffmpeg installation
  1. In the end run the following command to Ubuntu FFmpeg install:
sudo make install
installing ffmpeg
  1. To check the installed version of FFmpeg, enter the following command:
ffmpeg -version

The Terminal will display detailed information about the FFmpeg version and its configured options.

checking ffmpeg version

2. Installing FFmpeg via Snap Package

Snap packages provide an easy way to install and manage software on Ubuntu, ensuring automatic updates and sandboxed applications. This method is perfect for users who prefer minimal manual intervention and simplified maintenance. Follow these steps for FFmpeg Ubuntu install using snap package:

  1. Before installing Snap, make sure your system is up-to-date to ensure you have the latest package information:
sudo apt update
updating system package list 3
  1. Install the Snap package management system if it’s not already installed on your system:
sudo apt install snapd

This command installs Snapd, which is required to manage Snap packages.

installing snapd on ubuntu
  1. Use Snap to install FFmpeg by running the following command:
sudo snap install ffmpeg

This command installs FFmpeg as a Snap package, ensuring it is sandboxed and automatically updated.

installing ffmpeg using snap
  1. Verify the installation to confirm that FFmpeg is correctly installed:
snap run ffmpeg -version

This command displays the installed version of FFmpeg to verify the installation was successful.

verifying the installtion of ffmpeg

How to Use FFmpeg

FFmpeg is a powerful multimedia framework that allows you to manipulate and process audio and video files. I will walk you through the basics of using FFmpeg and provide you with some commonly used commands. By the end, you’ll have a solid foundation for utilizing FFmpeg’s capabilities in your multimedia projects.

1. Converting a Video Format

To convert a video file from one format to another, use the following command:

ffmpeg -i input.mp4 output.avi

Replace input.mp4 with the name of your input file and output.avi with the desired name of the output file. FFmpeg will automatically detect the input format based on the file extension, so you don’t need to specify it explicitly.

converting video format using ffmpeg

2. Resizing a Video

To resize a video to a specific width and height, use the following command:

ffmpeg -i input.mp4 -vf "scale=640:480" output.mp4

In this example, the video will be resized to a width of 640 pixels and a height of 480 pixels. Adjust the values as needed.

resizing height and width of video

3. Trimming a Video

To trim a video and extract a specific portion, specify the start and end times using the -ss (start time) and -to (end time) options. Here’s an example:

ffmpeg -i input.mp4 -ss 00:00:10 -to 00:00:30 -c copy output.mp4

This command extracts a 20-second segment from the input video, starting at 10 seconds and ending at 30 seconds. The -c copy option ensures that the video and audio streams are copied without re-encoding, preserving the original quality.

trimming video using ffmpeg

Benefits of Installing FFmpeg On Ubuntu

FFmpeg is a versatile multimedia framework that offers numerous benefits for audio and video processing tasks. Installing FFmpeg on your system opens up a world of possibilities and empowers you to accomplish various multimedia-related goals. Here are four key benefits of installing FFmpeg:

  • 🎛️ Wide Format Support: One of the significant advantages of FFmpeg is its extensive format support. Whether it’s audio or video, FFmpeg can handle a vast array of formats, ensuring compatibility with almost any multimedia file you encounter. From popular formats like MP3, MP4, and AVI to more niche formats, FFmpeg has got you covered.
  •  🚀 Powerful Functionality: FFmpeg provides a wealth of powerful functionality for multimedia processing. It offers a comprehensive set of tools and libraries that enable you to perform complex tasks with ease. Whether you need to encode or decode videos, extract audio from videos, apply filters and effects, or perform video editing operations, FFmpeg provides the necessary functionality to accomplish these tasks efficiently.
  •  🧩 Customizability: Another key benefit of installing FFmpeg is the level of customizability it offers. With FFmpeg, you have granular control over various parameters and options for audio and video processing. You can fine-tune encoding settings, adjust quality parameters, apply specific filters, and more.
  •  👥 Open-Source and Community-Driven: FFmpeg is an open-source project with a vibrant and dedicated community of developers and users. This community-driven nature ensures continuous development, bug fixes, and improvements to the framework. By installing FFmpeg, you become part of this active community, gaining access to support, resources, and valuable insights from experienced users worldwide.

Ubuntu Install FFmpeg: Wrapping Up

In this article, I’ve walked you through various methods to install and configure FFmpeg on Ubuntu, from using APT to building from Snap packages. Each method suits different needs, ensuring you can smoothly FFmpeg Linux install.

For more learning, I recommend exploring:

  • How to use the help command in Linux, which can assist you with additional FFmpeg commands and options
  • Exploring how to convert string to number in Bash, which can be useful for scripting with FFmpeg commands.
  • Learn how to check system logs on Linux to troubleshoot any issues with FFmpeg.

Frequently Asked Questions

Can I update FFmpeg to a newer version once it’s installed?

Yes, FFmpeg can be updated to a newer version. The process for updating FFmpeg depends on the initial installation method. If you installed FFmpeg using a package manager like apt, you can update it by running the package manager’s update command. This will fetch the latest version available in the repository and install it on your system. However, if you manually compiled FFmpeg from source, updating requires repeating the compilation process with the new source code. It involves downloading the latest version, configuring the build, compiling, and then installing the updated version of FFmpeg.

Are there GUI (Graphical User Interface) options available for FFmpeg?

While FFmpeg itself is a command-line tool, there are several GUI applications and interfaces built on top of FFmpeg. These GUI options provide a user-friendly graphical environment for executing FFmpeg commands. They offer a visual interface with menus, buttons, and input fields to simplify the process for users who prefer working with a graphical interface rather than the command line. These GUI applications allow users to select the desired FFmpeg functionality, input/output files, and adjust settings through intuitive controls, making it easier to perform tasks such as video conversion, audio extraction, and video editing.

Can FFmpeg handle video files with non-standard codecs?

Absolutely! FFmpeg is known for its wide-ranging codec support. It is designed to handle a vast array of video codecs, including both popular and less common ones. This comprehensive codec support enables FFmpeg to work seamlessly with various video file formats and codecs, making it a reliable tool for multimedia processing. Whether you encounter video files encoded with standard or non-standard codecs, FFmpeg can efficiently decode, encode, and manipulate them. Its flexibility in handling non-standard codecs ensures that you can process and work with a diverse range of video content, enabling you to meet your specific needs.

Ojash

Author

Ojash is a skilled Linux expert and tech writer with over a decade of experience. He has extensive knowledge of Linux's file system, command-line interface, and software installations. Ojash is also an expert in shell scripting and automation, with experience in Bash, Python, and Perl. He has published numerous articles on Linux in various online publications, making him a valuable resource for both seasoned Linux users and beginners. Ojash is also an active member of the Linux community and participates in Linux forums.

Akshat

Reviewer

Akshat is a software engineer, product designer and the co-founder of Scrutify. He's an experienced Linux professional and the senior editor of this blog. He is also an open-source contributor to many projects on Github and has written several technical guides on Linux. Apart from that, he’s also actively sharing his ideas and tutorials on Medium and Attirer. As the editor of this blog, Akshat brings his wealth of knowledge and experience to provide readers with valuable insights and advice on a wide range of Linux-related topics.

Share this article
Shareable URL
Prev Post

How to Reboot Linux Server [6 Effective Methods]

Next Post

How to Use the Netcat Command in Linux [6 Best Uses]

Leave a Reply

Your email address will not be published. Required fields are marked *

Read next