Home  »  ArticlesGuidesHow ToLibrariesSoftwareTechnologyTools   »   How to Install FFmpeg on Ubuntu 24.04 Noble Numbat

How to Install FFmpeg on Ubuntu 24.04 Noble Numbat

FFmpeg is a powerful and versatile multimedia framework that can decode, encode, transcode, mux, demux, stream, filter, and play almost anything that humans and machines have created. Whether you’re a developer, a multimedia enthusiast, or just someone who needs to manipulate audio and video files, FFmpeg is an indispensable tool. This comprehensive guide will walk you through the process of installing FFmpeg on Ubuntu 24.04 Noble Numbat.

What is FFmpeg?

FFmpeg is an open-source project that provides a suite of libraries and programs to handle multimedia data. It includes libavcodec, a leading audio/video codec library, and libavformat, an audio/video container mux and demux library. FFmpeg can be used from the command line to perform various tasks such as format conversion, video scaling, and audio resampling.

Prerequisites

Before you begin the installation, make sure your system is up-to-date and you have administrative privileges. Open your terminal and execute the following commands:

$ sudo apt update
$ sudo apt upgrade

Step-by-Step Installation Guide

Step 1: Install FFmpeg from the Official Ubuntu Repositories

The easiest way to install FFmpeg on Ubuntu 24.04 is to use the official Ubuntu repositories. This method ensures you get a stable and well-tested version of FFmpeg. Run the following command to install FFmpeg:

$ sudo apt install ffmpeg

Step 2: Verify the Installation

After the installation is complete, you can verify that FFmpeg is installed correctly by checking its version. Run the following command:

$ ffmpeg -version

You should see output similar to the following, indicating the installed version of FFmpeg and its configuration:

ffmpeg version 4.4.1-3ubuntu1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10 (Ubuntu 10.3.0-1ubuntu1)

Step 3: Basic Usage of FFmpeg

FFmpeg can perform a wide variety of multimedia tasks. Here are some common use cases and examples to get you started.

Convert a Video File to a Different Format

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

$ ffmpeg -i input.mp4 output.avi

This command converts input.mp4 to output.avi.

Extract Audio from a Video File

To extract the audio from a video file, use the following command:

$ ffmpeg -i input.mp4 -q:a 0 -map a output.mp3

This command extracts the audio from input.mp4 and saves it as output.mp3.

Resize a Video

To resize a video, use the following command:

$ ffmpeg -i input.mp4 -vf scale=1280:720 output.mp4

This command resizes input.mp4 to 1280×720 resolution and saves it as output.mp4.

Compress a Video

To compress a video, use the following command:

$ ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4

This command compresses input.mp4 using the H.265 codec with a constant rate factor (CRF) of 28 and saves it as output.mp4.

Advanced Installation (Optional)

If you need the latest version of FFmpeg or want to customize the installation, you can build FFmpeg from source. This method is more complex but allows for greater flexibility.

Step 1: Install Dependencies

First, install the necessary dependencies for building FFmpeg from source:

$ sudo apt install autoconf automake build-essential cmake git libass-dev libfreetype6-dev \
libgnutls28-dev libmp3lame-dev libopus-dev libtool libvorbis-dev libvpx-dev \
pkg-config texinfo wget yasm zlib1g-dev

Step 2: Download the FFmpeg Source Code

Next, download the FFmpeg source code from the official repository:

$ cd ~
$ git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
$ cd ffmpeg

Step 3: Configure and Build FFmpeg

Configure the build with the necessary options:

$ code./configure --enable-gpl --enable-libass --enable-libfreetype --enable-libmp3lame \
--enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265

Build and install FFmpeg:

$ make
$ sudo make install

Step 4: Verify the Installation

Check the installed version of FFmpeg to verify the build:

$ ffmpeg -version

Conclusion

Installing FFmpeg on Ubuntu 24.04 Noble Numbat is a straightforward process that provides you with a powerful tool for handling multimedia files. Whether you choose to install FFmpeg from the official Ubuntu repositories for ease of use or build it from source for maximum flexibility, this guide has covered all the steps necessary to get you up and running.

With FFmpeg installed, you can convert, compress, resize, and manipulate audio and video files with ease. Its robust set of features makes it an essential tool for developers, multimedia enthusiasts, and anyone working with multimedia data.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.