Lesson 100: ffmpeg Command
In this lesson, you'll learn how to use the ffmpeg command to convert, process, and analyze audio and video files in Linux.
ffmpeg is one of the best multimedia frameworks that contains various tools for different tasks.
For example, ffplay is a portable media player that can be used to play audio/video files, ffmpeg can convert between different file formats, ffserver can be used to stream live broadcasts, and ffprobe can analyze multimedia streams.
This framework is really powerful due to the diversity of available tools that provide the best technical solution for the user.
According to the description of FFmpeg on the official website, the reason for having such a great multimedia framework is the combination of the best free software options available.
The FFmpeg framework offers high security, and the reason for this is the seriousness of the developers when they review the code; it is always done with security in mind.
According to the official website, FFmpeg can do the following:
- Decode multimedia files
- Encode multimedia files
- Transcode multimedia files
- Mux multimedia files
- Demux multimedia files
- Stream multimedia files
- Filter multimedia files
- Play multimedia files
Let's see some handy commands that will give you a better idea about the capabilities of this powerful tool.
However, if you don't have FFmpeg installed in your system, refer to our FFmpeg installation blog for that purpose.
ffmpeg Command Syntax
$ ffmpeg [OPTIONS] -i INPUT OUTPUT
ffmpeg Command Options
| Option | Description |
|---|---|
-i FILE |
Specify the input file |
-hide_banner |
Suppress FFmpeg version/build info from output |
-vn |
Disable video recording (used when extracting audio) |
-ar RATE |
Set the audio sampling rate in Hz |
-ac CHANNELS |
Set the number of audio channels |
-ab BITRATE |
Set the audio bitrate |
-f FORMAT |
Specify the output format |
-vf FILTER |
Apply a video filter |
-target TYPE |
Set output type for VCD/DVD/DV formats |
-loop 1 |
Loop the input (used when adding image to audio) |
-c:v CODEC |
Set the video codec |
-c:a CODEC |
Set the audio codec |
-crf VALUE |
Set video quality level (lower = better) |
-map |
Specify which streams to include in output |
1. Get Video File Information
To get information about a file (say video.mp4), run the following command. Remember, you have to specify an output file, but in this case, we only want to get some information about the input file.