What is FFmpeg?
FFmpeg is a free program that works with sound and video files. It can change a video from one format to another, cut clips, shrink file size and grab pictures from a video. Many websites use it behind the scenes to prepare videos for visitors. APT is the Debian tool that installs software for you, like an app store you control with typed commands.
Steps
- Connect to your server with SSH as root, or as a user that can use
sudo. - Update the list of available software:
sudo apt update
This refreshes the package list.
- Install FFmpeg:
sudo apt install ffmpeg -y
This downloads and installs FFmpeg and what it needs. The -y answers "yes" for you.
- Check the install:
ffmpeg -version
This prints the version number and the options it was built with.
Try a few commands
Go to a folder that has a video called input.mov.
- Convert it to MP4:
ffmpeg -i input.mov output.mp4
This reads input.mov and makes output.mp4.
- Take out only the sound as MP3:
ffmpeg -i input.mov -vn audio.mp3
The -vn option means "no video".
- Make a picture from the video at 5 seconds:
ffmpeg -i input.mov -ss 00:00:05 -frames:v 1 shot.jpg
This saves one frame as a picture.
- Make the video smaller:
ffmpeg -i input.mov -vcodec libx264 -crf 28 small.mp4
A higher crf number gives a smaller file with lower quality.
Update or remove
To update FFmpeg, run:
sudo apt update && sudo apt upgrade ffmpeg
To remove it, run:
sudo apt remove ffmpeg
Troubleshooting
- Unable to locate package ffmpeg: run
sudo apt updateagain and check your sources list. - The version is older than you need: the Debian package is stable but not the newest. Check your needs before you use extra sources.
- Video conversion uses a lot of CPU, so heavy jobs can slow your server.
If you need help with your server, open a support ticket.
Quick recap
- FFmpeg converts and edits audio and video.
- Install it with
sudo apt install ffmpeg. - Check with
ffmpeg -version. - Use
ffmpeg -i input outputto convert.