Install FFmpeg on Ubuntu | ubuntu get ffmpeg version

Table of Contents
FFmpeg is a cornerstone tool for multimedia processing, enabling tasks like video conversion, audio extraction, live streaming, and more. For Ubuntu users, knowing how to check ubuntu get FFmpeg version and install/update it is essential. This comprehensive guide walks you through every step, from basic commands to advanced installations, while addressing common issues and use cases.
Why FFmpeg on Ubuntu?
FFmpeg’s versatility makes it indispensable for:
- Developers: Building multimedia applications or scripts.
- Content Creators: Editing videos, converting formats, or compressing files.
- Sysadmins: Managing media servers or automating workflows.
- Enthusiasts: Experimenting with codecs, filters, or streaming.
Ubuntu’s robust package management and Linux environment make it a natural fit for FFmpeg. Let’s dive into checking your FFmpeg version and installing it.
Part 1: How to Check the FFmpeg Version on Ubuntu
Step 1: Open the Terminal
Access the terminal via:
- Shortcut:
Ctrl + Alt + T
- Search: Type “Terminal” in the Ubuntu app menu.
Step 2: Run the Version Command
ffmpeg -version
Expected Output (If Installed):
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 11.2.0 (Ubuntu 11.2.0-19ubuntu1) configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 ... libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 ... (additional library versions)
If FFmpeg Isn’t Installed:
command 'ffmpeg' not found. Install package 'ffmpeg' with: sudo apt install ffmpeg
Part 2: Installing FFmpeg on Ubuntu
Choose the method that fits your needs:
Method 1: Install via apt (Simple & Recommended)
- Update Package Lists:bashCopysudo apt update
- Install FFmpeg:bashCopysudo apt install ffmpeg
- Verify Installation:bashCopyffmpeg -version
Pros:
- Quick and beginner-friendly.
- Automatically handles dependencies.
Cons:
- May not provide the latest FFmpeg version.
Method 2: Install from Source (Advanced Users)
For the latest features or custom configurations:
- Install Build Dependencies:bashCopysudo apt update && sudo apt install -y \ build-essential git cmake \ libx264-dev libx265-dev libvpx-dev \ libmp3lame-dev libopus-dev libfdk-aac-dev \ libass-dev libtheora-dev libvorbis-dev libwebp-dev
- Clone the FFmpeg Repository:bashCopygit clone https://git.ffmpeg.org/ffmpeg.git cd ffmpeg
- Configure the Build:bashCopy./configure \ –enable-gpl \ –enable-libx264 \ –enable-libx265 \ –enable-libvpx \ –enable-libmp3lame \ –enable-libopus \ –enable-libfdk-aac
- Compile and Install:bashCopymake -j$(nproc) # Uses all CPU cores for faster compilation sudo make install
- Verify the Installation:bashCopyffmpeg -version
Pros:
- Access to the latest updates and experimental features.
- Customize codecs and optimizations.
Cons:
- Time-consuming and complex for beginners.
- Manual updates required.
Method 3: Use a PPA for Newer Versions
If the default apt
version is outdated, add the FFmpeg PPA:
- Add the Repository:bashCopysudo add-apt-repository ppa:savoury1/ffmpeg4 sudo apt update
- Install/Upgrade FFmpeg:bashCopysudo apt upgrade ffmpeg
Part 3: Troubleshooting Common FFmpeg Issues
1. “Command Not Found” After Installation
- Cause: FFmpeg isn’t in your system’s PATH.
- Fix:bashCopyexport PATH=”/usr/local/bin:$PATH” # For source installations
2. Missing Codecs or Libraries
- Install Ubuntu Restricted Extras:bashCopysudo apt install ubuntu-restricted-extras
3. Outdated apt Version
- Use the PPA method (above) or compile from source.
4. Conflicts with Snap Packages
- Remove conflicting Snap installations:bashCopysudo snap remove ffmpeg
Part 4: Essential FFmpeg Commands for Ubuntu
1. Basic Video Conversion
ffmpeg -i input.mp4 output.avi
2. Extract Audio from a Video
ffmpeg -i video.mp4 -vn -q:a 0 audio.mp3
3. Resize or Compress a Video
ffmpeg -i input.mp4 -vf "scale=1280:720" -crf 23 output.mp4
4. Stream to YouTube/Twitch
ffmpeg -i input.mp4 -c:v libx264 -preset fast -f flv "rtmp://youtube.com/stream-key"
5. Create a GIF from Video
ffmpeg -i input.mp4 -vf "fps=10,scale=640:-1" output.gif
Part 5: Advanced Use Cases
Batch Processing with Scripts
Automate converting multiple files:
for file in *.mkv; do ffmpeg -i "$file" "${file%.mkv}.mp4" done
Live Screen Recording
Record your Ubuntu desktop:
ffmpeg -f x11grab -s 1920x1080 -i :0.0 -f pulse -i default output.mp4
Hardware Acceleration
Use NVIDIA GPUs for faster encoding:
ffmpeg -i input.mp4 -c:v h264_nvenc -preset fast output.mp4
Part 6: Frequently Asked Questions (FAQ)
Q: How do I update FFmpeg on Ubuntu?
- apt Users:bashCopysudo apt update && sudo apt upgrade ffmpeg
- Source Users: Re-clone the repo and rebuild.
Q: Can I use FFmpeg with GUI tools?
Yes! Try frontends like HandBrake or QWinFF:
sudo apt install handbrake
Q: How to uninstall FFmpeg?
- apt Installation:bashCopysudo apt remove ffmpeg
- Source Installation:bashCopysudo make uninstall # From the FFmpeg source directory
Q: Why is FFmpeg so slow?
- Solutions:
- Enable hardware acceleration (e.g.,
h264_nvenc
). - Use faster presets (
-preset ultrafast
). - Reduce output resolution/bitrate.
- Enable hardware acceleration (e.g.,
Next Steps:
- Explore the FFmpeg Documentation.
- Join communities like FFmpeg Subreddit for tips.
- Experiment with filters (
-vf
), complex filters, and scripting.
Pro Tip: Use ffprobe
to inspect media file details:
ffprobe -i video.mp4
With this guide, you’re equipped to harness FFmpeg’s full power on Ubuntu 🎥🚀