Installing and Configuring FFmpeg on Debian/AlmaLinux
FFmpeg is a powerful open-source framework for handling multimedia files, including recording, converting, and streaming audio and video. Here’s how to install and configure FFmpeg on Debian and AlmaLinux systems.
Installing FFmpeg on Debian
-
Update Package Lists
First, update the package lists to ensure you get the latest versions available:
bashsudo apt update
-
Install FFmpeg
Install FFmpeg using the following command:
bashsudo apt install ffmpeg
-
Verify Installation
After installation, you can verify that FFmpeg is correctly installed by checking its version:
bashffmpeg -version
Installing FFmpeg on AlmaLinux
-
Update Package Lists
Update your package lists to make sure you have the latest information:
bashsudo dnf update
-
Install EPEL Repository
Install the EPEL (Extra Packages for Enterprise Linux) repository, which provides additional packages:
bashsudo dnf install epel-release
-
Install RPM Fusion Repository
Install the RPM Fusion repository to access additional software packages:
bashsudo dnf install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
-
Install FFmpeg
Install FFmpeg and its development libraries:
bashsudo dnf install ffmpeg ffmpeg-devel
-
Verify Installation
Check the installation by running:
bashffmpeg -version
Configuring FFmpeg
Once installed, FFmpeg can be used for various multimedia tasks. Here are some basic commands to get you started:
-
Convert a Video File
Convert an MP4 video to AVI format:
bashffmpeg -i input.mp4 output.avi
-
Extract Audio from Video
Extract audio from an MP4 file and save it as an MP3:
bashffmpeg -i input.mp4 -q:a 0 -map a output.mp3
-
Resize a Video
Resize a video to 1280x720 resolution:
bashffmpeg -i input.mp4 -vf scale=1280:720 output.mp4
-
Create a GIF from a Video
Create a GIF from an MP4 video:
bashffmpeg -i input.mp4 -vf "fps=10,scale=320:-1:flags=lanczos" -gifflags +transdiff -y output.gif
-
Stream Video with FFmpeg
Stream a video to a server using RTMP:
bashffmpeg -re -i input.mp4 -c:v libx264 -preset veryfast -maxrate 3000k -bufsize 6000k -vf "scale=1280:720" -g 50 -c:a aac -b:a 128k -ar 44100 -f flv rtmp://your-streaming-server/live/streamkey
These commands will help you start working with FFmpeg. For more advanced scenarios and configurations, refer to the official FFmpeg documentation.