How to Install FFmpeg on Fedora Linux

FFmpeg lets you convert video files between formats, extract audio tracks, compress footage for web delivery, record screencasts, and stream live content to platforms like YouTube or Twitch. Whether you need to batch-convert vacation videos for social media, extract audio from webinars, compress 4K footage for archival, transcode a library of videos, add subtitles, or build automated media pipelines, FFmpeg handles it from the command line without requiring a graphical application. Additionally, FFmpeg supports hardware acceleration for faster processing and integrates with most Linux desktop environments.

Fedora offers two installation paths: the default repository provides ffmpeg-free with open codecs, while RPM Fusion delivers the full build with H.264, H.265, and AAC support. You will install FFmpeg with hardware acceleration configured, understand which codecs require which build, learn to convert videos between formats, extract audio tracks, compress files for web delivery, and troubleshoot common encoding issues.

Choose Your FFmpeg Installation Method

Fedora ships two distinct FFmpeg builds. The key difference lies in codec licensing: Fedora’s official package excludes patent-encumbered codecs to comply with distribution policies, while RPM Fusion includes the full codec suite. Understanding these differences helps you choose the right installation method for your workflow.

MethodPackageCodec SupportUpdate FrequencyBest For
Fedora Defaultffmpeg-freeOpen codecs only (VP9, AV1, Opus, FLAC)Synced with Fedora releasesUsers who work primarily with royalty-free formats
RPM FusionffmpegFull codec suite (H.264, H.265, AAC, MP3, plus open codecs)More frequent updatesUsers who need compatibility with common video formats

For most video conversion tasks involving MP4 files, YouTube downloads, or camera footage, the RPM Fusion version provides the codec support you need. In contrast, the Fedora default works well for projects using open formats like WebM or FLAC audio. Ultimately, your choice depends on the video formats you work with most frequently.

Method 1: Install FFmpeg via DNF

Update Fedora System Packages

Before installing new software, refresh your package cache and apply pending updates. This ensures FFmpeg installs against current library versions and avoids dependency conflicts.

sudo dnf upgrade --refresh

The --refresh flag forces DNF to download fresh metadata from all enabled repositories, ensuring you get the latest package versions and avoiding installation failures from stale cache data. The update typically takes 1-3 minutes depending on your connection speed and the number of pending updates.

Install the ffmpeg-free Package

Once your system is updated, proceed with the FFmpeg installation. Fedora’s default repository includes ffmpeg-free, a build compiled without patent-encumbered codecs. This version handles open formats like VP9, AV1, Opus, and FLAC out of the box.

sudo dnf install ffmpeg-free

If you plan to compile software that links against FFmpeg libraries (such as building OBS Studio from source or developing custom media tools), you will also need the development headers:

sudo dnf install ffmpeg-free-devel

Verifying FFmpeg Installation

After installing FFmpeg, verify the installation succeeded. Check the installed version by running the following command in the terminal:

ffmpeg -version

You should see output showing the version number and build configuration:

ffmpeg version 8.0 Copyright (c) 2000-2025 the FFmpeg developers
built with gcc 14 (GCC)
configuration: --enable-gpl --enable-version3 --enable-shared ...
libavutil      59. 39.100 / 59. 39.100
libavcodec     61. 19.100 / 61. 19.100
libavformat    61.  7.100 / 61.  7.100

This confirms the installation succeeded and the software is ready for use.

Method 2: Install FFmpeg via RPM Fusion

Enable RPM Fusion Repositories

RPM Fusion hosts packages that Fedora cannot distribute due to licensing restrictions, including the full FFmpeg build with H.264, H.265, and AAC support. If you have not already configured RPM Fusion on your system, add both the free and nonfree repositories:

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm

sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

These commands add the free and non-free repositories of RPM Fusion to your system, expanding the range of available software. The installation typically completes in under a minute.

Install Full FFmpeg from RPM Fusion

With RPM Fusion enabled, you can now install the complete FFmpeg package. This build includes proprietary codec support for H.264, H.265/HEVC, AAC, and MP3, making it suitable for most video conversion workflows:

sudo dnf install ffmpeg --allowerasing

To install the development package, similar to the previous method, use:

sudo dnf install ffmpeg-devel --allowerasing

The development package provides header files and pkg-config data required for compiling software that links against FFmpeg libraries. Skip this unless you are building video applications from source or developing FFmpeg-based tools.

The --allowerasing flag allows DNF to remove conflicting packages like ffmpeg-free and libavcodec-freeworld when installing the full FFmpeg build from RPM Fusion. Without this flag, package conflicts may block the installation.

Switch from ffmpeg-free to Full FFmpeg

Fedora’s ffmpeg-free handles basic tasks adequately, but you may encounter version mismatches with other multimedia packages. The RPM Fusion build is better supported and avoids library conflicts. Therefore, use the swap command to replace the Fedora version in a single operation:

sudo dnf swap ffmpeg-free ffmpeg --allowerasing

After switching, you do not need libavcodec-freeworld since that package only complements ffmpeg-free. Next, verify the installation to confirm the swap succeeded.

Verify FFmpeg RPM Fusion Installation

To confirm that you have installed the correct version of FFmpeg from RPM Fusion, run the following:

ffmpeg -version

The RPM Fusion build includes additional codecs and features not present in the free version:

ffmpeg version 8.0 Copyright (c) 2000-2025 the FFmpeg developers
built with gcc 14 (GCC)
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-libx264 --enable-libx265 --enable-libfdk-aac ...
libavutil      59. 39.100 / 59. 39.100
libavcodec     61. 19.100 / 61. 19.100

Look for flags like --enable-nonfree and --enable-libx264 to confirm you are running the RPM Fusion version with extended codec support. This confirms the RPM Fusion installation succeeded with full codec capabilities.

Install Additional Multimedia Codecs

After installing FFmpeg from RPM Fusion, install the GStreamer multimedia framework complements. GStreamer powers media playback in GNOME applications, Firefox, and other desktop programs. Without these codecs, browser videos and desktop media players will fail on proprietary formats even though FFmpeg works from the command line:

sudo dnf update @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin

The --setopt="install_weak_deps=False" flag installs only essential packages without optional recommendations, keeping your system lean. The --exclude flag prevents PackageKit from triggering codec search dialogs that duplicate what you are installing manually. As a result, your system will have codec support across all desktop applications.

Enable Hardware Accelerated Encoding

Once FFmpeg is installed, configure hardware acceleration to improve performance. Hardware acceleration offloads video encoding and decoding to your GPU, significantly improving FFmpeg performance for transcoding tasks. Install the appropriate driver for your hardware.

Intel (recent GPUs with Quick Sync)

sudo dnf install intel-media-driver

Intel (older GPUs)

sudo dnf install libva-intel-driver

AMD (mesa freeworld drivers)

sudo dnf swap mesa-va-drivers mesa-va-drivers-freeworld
sudo dnf swap mesa-vdpau-drivers mesa-vdpau-drivers-freeworld

NVIDIA (VAAPI wrapper for NVENC/NVDEC)

sudo dnf install libva-nvidia-driver

With hardware acceleration configured, FFmpeg can use GPU encoders like h264_vaapi, hevc_vaapi, or h264_nvenc for faster video processing. Hardware encoding typically runs 3-5x faster than software encoding, making it essential for real-time streaming or processing large video libraries. Consequently, most professional workflows rely on hardware acceleration for efficiency.

Verify Hardware Acceleration Support

After installing the drivers, check if your GPU is detected and which encoders are available:

ffmpeg -hide_banner -encoders | grep vaapi

For VAAPI (Intel/AMD), you should see encoders listed:

 V..... h264_vaapi           H.264/AVC (VAAPI) (codec h264)
 V..... hevc_vaapi           H.265/HEVC (VAAPI) (codec hevc)
 V..... mjpeg_vaapi          MJPEG (VAAPI) (codec mjpeg)
 V..... vp8_vaapi            VP8 (VAAPI) (codec vp8)
 V..... vp9_vaapi            VP9 (VAAPI) (codec vp9)

Alternatively, for NVIDIA NVENC, check for NVENC encoders:

ffmpeg -hide_banner -encoders | grep nvenc

Expected output for NVIDIA GPUs:

 V..... h264_nvenc           NVIDIA NVENC H.264 encoder (codec h264)
 V..... hevc_nvenc           NVIDIA NVENC hevc encoder (codec hevc)

If these commands return no results, verify your GPU drivers are installed correctly. For complete multimedia setup including DVD playback and firmware packages, see the RPM Fusion configuration guide.

Codec Compatibility Reference

Before converting files, verify which codecs your FFmpeg build supports. The table below shows which formats work with each installation method, helping you determine if you need the RPM Fusion build:

Codecffmpeg-freeRPM Fusion FFmpegCommon Use
H.264 (x264)Decode onlyEncode and decodeMP4 videos, YouTube, most cameras
H.265 (HEVC)Decode onlyEncode and decode4K video, iPhone recordings
VP9Encode and decodeEncode and decodeWebM video, YouTube
AV1Encode and decodeEncode and decodeNext-gen web video
AACDecode onlyEncode and decodeMost audio in MP4, streaming
MP3Decode onlyEncode and decodeMusic files, podcasts
OpusEncode and decodeEncode and decodeVoIP, low-latency audio
FLACEncode and decodeEncode and decodeLossless audio archival

If a conversion fails with “Unknown encoder” or “Encoder not found” errors, you likely need the RPM Fusion build for that codec. Therefore, check the table above to confirm codec availability before attempting conversions.

Basic FFmpeg Usage Examples

With FFmpeg installed, here are practical commands demonstrating common media tasks with progressive complexity. These examples start with simple format conversion and build toward more advanced techniques.

Convert Video to Different Format

Start with the simplest conversion method. Convert an MKV file to MP4 while preserving quality:

ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4

The -c:v copy and -c:a copy flags copy the existing video and audio streams without re-encoding, making this operation fast and lossless. However, stream copying only works when the codec is already compatible with the target container.

Convert Video with Re-encoding

When stream copying is not possible, re-encode the video. Convert AVI to MP4 with H.264 encoding for better compression:

ffmpeg -i input.avi -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 128k output.mp4

This transcodes both video and audio. The -preset medium balances encoding speed with compression efficiency. Use -preset fast for quicker encoding or -preset slow for better compression at the cost of encoding time. Presets primarily affect encoding speed, not output quality.

Extract Audio from Video

Sometimes you only need the audio track from a video file. Pull the audio track from a video file and save it as MP3:

ffmpeg -i video.mp4 -vn -acodec libmp3lame -q:a 2 audio.mp3

The -vn flag discards the video stream, and -q:a 2 sets high-quality variable bitrate encoding (roughly 190 kbps). For constant bitrate, replace -q:a 2 with -b:a 320k.

Convert Audio Formats

Beyond extracting audio, you can convert between audio formats. Convert MP3 to high-quality AAC for better compression at the same bitrate:

ffmpeg -i audio.mp3 -c:a aac -b:a 192k output.m4a

Alternatively, for lossless archival, convert to FLAC:

ffmpeg -i audio.mp3 -c:a flac output.flac

Compress Video for Web

Web hosting requires smaller file sizes. For web delivery, reduce file size while maintaining reasonable quality:

ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4

Lower CRF values produce higher quality (and larger files). Values between 18-28 work well for most use cases. Generally, CRF 18 is visually lossless while CRF 28 shows noticeable compression artifacts.

Hardware-Accelerated Encoding

After installing hardware acceleration drivers, use your GPU for faster encoding. This example uses VAAPI (Intel/AMD) to encode H.264:

ffmpeg -vaapi_device /dev/dri/renderD128 -i input.mp4 -vf 'format=nv12,hwupload' -c:v h264_vaapi -qp 23 -c:a copy output.mp4

On the other hand, for NVIDIA GPUs with the proprietary driver, use NVENC instead:

ffmpeg -i input.mp4 -c:v h264_nvenc -preset p4 -cq 23 -c:a copy output.mp4

Hardware encoding is significantly faster than software encoding, though quality at equivalent bitrates may be slightly lower.

Batch Process Multiple Files

When working with multiple files, automate conversions with a loop. Convert all MKV files in a directory to MP4:

for file in *.mkv; do
  ffmpeg -i "$file" -c:v libx264 -crf 23 -c:a aac "${file%.mkv}.mp4"
done

The loop processes each file sequentially. The "${file%.mkv}.mp4" syntax strips the .mkv extension and adds .mp4, preserving original filenames. Moreover, for large batches, consider using GNU Parallel or creating a dedicated conversion script.

The H.264 (libx264) and AAC codecs require the RPM Fusion version of FFmpeg. The ffmpeg-free package cannot encode to these formats.

Troubleshooting Common FFmpeg Issues

When commands fail or produce unexpected results, these solutions address the most frequent problems encountered when using FFmpeg on Fedora.

Encoder Not Found Error

If FFmpeg fails with an unknown encoder error, you likely need a codec that requires the RPM Fusion build:

Unknown encoder 'libx264'
Encoder libx264 not found

This means you are trying to encode H.264 video with the ffmpeg-free package, which only decodes H.264. To diagnose the issue, check which build you have installed:

ffmpeg -version | grep configuration

If the configuration line lacks --enable-nonfree or --enable-libx264, you need the RPM Fusion version. Switch using:

sudo dnf swap ffmpeg-free ffmpeg --allowerasing

Hardware Acceleration Not Working

After fixing encoder issues, you may encounter hardware acceleration problems. If hardware encoding commands fail with device or driver errors:

Cannot load libcuda.so.1
Device creation failed: -1
Failed to initialise VAAPI connection

This indicates missing or misconfigured GPU drivers. To troubleshoot, first verify your GPU is detected:

lspci | grep -E "VGA|3D"

Example output showing an NVIDIA GPU:

01:00.0 VGA compatible controller: NVIDIA Corporation GA104 [GeForce RTX 3060]

For NVIDIA, you must also ensure proprietary drivers are installed and loaded:

nvidia-smi

If this command fails, install NVIDIA drivers following the Fedora NVIDIA drivers guide. For Intel/AMD VAAPI issues, reinstall the VA-API drivers shown in the hardware acceleration section above.

Permission Denied Accessing Output File

If FFmpeg cannot write the output file:

output.mp4: Permission denied

Check the destination directory permissions:

ls -ld /path/to/output/directory

You should see write permissions for your user (indicated by w in the permission string). If the directory is write-protected, you have two options: either change the output location to your home directory or adjust permissions:

chmod u+w /path/to/output/directory

Package Conflicts During Installation

If DNF reports conflicts between ffmpeg-free and full FFmpeg:

Error: 
 Problem: package ffmpeg conflicts with ffmpeg-free
  - cannot install both

You need the --allowerasing flag to let DNF remove the conflicting package:

sudo dnf install ffmpeg --allowerasing

Alternatively, you can use the swap command which handles the replacement automatically:

sudo dnf swap ffmpeg-free ffmpeg --allowerasing

Conversion Produces Corrupted Output

If the output file plays incorrectly or is unreadable, enable verbose logging to identify the issue. Run the conversion with detailed output:

ffmpeg -v verbose -i input.mp4 -c:v libx264 -crf 23 output.mp4

Look for error messages about invalid stream formats, unsupported codecs, or timestamp issues in the output. Common causes include corrupt input files, incompatible pixel formats, or interrupted conversions. Test with a known-good input file first to isolate whether the problem is with your source media or FFmpeg configuration.

Managing FFmpeg on Fedora Linux

Remove FFmpeg

If you need to uninstall FFmpeg or switch between versions, use the appropriate command based on which build you installed.

Remove ffmpeg-free (Fedora Default)

If you installed from Fedora’s default repository:

sudo dnf remove ffmpeg-free ffmpeg-free-devel

Include ffmpeg-free-devel only if you installed development headers earlier.

Remove FFmpeg (RPM Fusion)

If you installed the full FFmpeg from RPM Fusion:

sudo dnf remove ffmpeg ffmpeg-devel

DNF will also remove any packages that depended on FFmpeg libraries. Review the removal list before confirming. After removal, verify FFmpeg is no longer installed to confirm complete removal:

which ffmpeg

If the command returns no output, removal succeeded. Any leftover configuration files in your home directory (such as ~/.ffmpeg presets) can be removed manually if needed.

Final Thoughts

You now have FFmpeg installed with full codec support and hardware acceleration configured. The ffmpeg-free package handles open formats, while the RPM Fusion build adds H.264, H.265, and AAC support for broader compatibility. To extend your multimedia workflow, pair FFmpeg with HandBrake for GUI-based video encoding. For playback verification, VLC handles virtually any codec and container format. For live streaming and recording, OBS Studio integrates with FFmpeg for hardware-accelerated encoding. Finally, if you encounter NVIDIA GPU issues, consult the NVIDIA drivers guide to ensure proper driver installation.

Useful Links

Here are some useful links related to using FFmpeg:

  • FFmpeg Official Website: Visit the official FFmpeg website for information about the multimedia framework, features, and download options.
  • FFmpeg Documentation: Access comprehensive documentation for detailed guides on using FFmpeg.
  • FFmpeg Forums: Join the FFmpeg forums to discuss issues, share solutions, and get support from the community.
  • FFmpeg Issue Tracker: Report bugs, track issues, and view bug reports related to FFmpeg on the issue tracker.
  • FFmpeg Developer Resources: Access resources for contributing to FFmpeg’s development, including coding guidelines and repository information.

Leave a Comment