Linux is always been the collection of useful CLi tools and ffmpeg is one of the known video audio managing tool.
FFMPEG is a powerful command-line tool which help you to easily manage and convert your media files.
It can also easily be scripted or incorporated into full programs.
Here are some useful FFMPEG commands that will help you get the most from it.
1. View File Information
FFMPEG has access to all of the information about the files that you’re working with. You can display that information in the terminal without modifying the file or running a conversion.
ffmpeg -i video.mkv -hide_banner
2. Conversions Between Formats
Despite its power, FFMPEG is really simple to use. You can easily convert a file between formats with a single command.
ffmpeg -i input.mkv output.mp4
The same thing works with audio files.
ffmpeg -i input.mp3 output.ogg
3.Converting Video to Audio
If you have a video with a song that you’d like or possibly only need the audio portion of a video file, you can use FFMPEG to strip video from a file, leaving only the audio.
ffmpeg -i input.mkv -vn output.ogg
4. Convert Video to GIF
FFMPEG can convert a video file to a GIF. Combine this with the next section on creating clips to isolate the exact piece of the video that you want.
ffmpeg -i video.mkv animation.gif
You can create a clip buy giving time in seconds with ffmpeg
ffmpeg -i orig.mkv -ss 00:23:45 -t 00:03:87 -c clip.mkv
6. Scaling Video
you can resize the resolution with ffMPEG buy specifying the dimensions
ffmepg -i source.mkv -vf scale=1280:720 scaled.mkv
7. Add Subtitles to Video
If you want to add subttle to a video file .
ffmpeg -i source.mkv -i subs.srt -map 0 -map 1 -c copy -crf 23 video-with-subtitles.mkv
8. Rotate a Video
Sometime videos records with the smartphones you want to rotate to view properly you can rotate video with ffmpeg to.
ffmpeg -i video.mkv -vf transpose=1 for-mobile.mkv
9. Set Audio Bitrate
When you’re converting audio files, it’s often important to set the bitrate of the resulting file. The bitrate will help improve the quality of the audio. To specify the bitrate, use the
ffmpeg -i source.flac -ab 320k output.mp3
10. Add a Banner to Audio
You can add a banner to the audio file .
ffmpeg -loop 1 -i banner.jpg -i audio.mp3 -strict experimental -shortest audio-upload.mp4
11. Change the Default Volume of Audio Files
Sometimes the audio file volume is quit not high, so you can make it louder with ffmpeg
ffmepg -i quiet-song.mp3 -af "volume=2.0" louder-song.mp3
12. Record Audio
You can also use FFMPEG to record audio directly from an input source, like a microphone. It works very similarly to anything else, but you need to specify which audio backend (alsa or pulseaudio) you’re using. You also need to specify a device (the microphone) as the source instead of a file.
ffmpeg -f alsa -i /dev/dsp -ab 320k recording.flac
You can do alot with ffmpeg you just need to be good in cli ,Linux cli is full of useful tools .
If you have any problem or any error with ffmpeg you can ask in comment section.