Overview of the Three Tools
FFmpeg comes with three command-line tools (official About page).
| Tool | Primary role | Primary use |
|---|---|---|
ffmpeg |
Conversion, encoding, filtering, and streaming | File conversion, video processing |
ffprobe |
Analysis and display of media stream information | Checking file info, scripting integration |
ffplay |
Media playback using SDL | Verification and development testing |
ffmpeg — The Main Tool for Conversion and Processing
ffmpeg has the most features of the three. The official documentation calls it “a universal media converter”. It reads many kinds of input, including live capture and recording devices. It can filter them and convert them into many output formats.
Basic Syntax
ffmpeg [global options] {[input options] -i input_url} ... {[output options] output_url} ...
The syntax is explained in FFmpeg Command Basic Syntax.
Representative Usage Examples
Change the container without re-encoding (stream copy):
ffmpeg -i input.mkv -c copy output.mp4
Change the codec (transcode):
ffmpeg -i input.avi -c:v libx264 -c:a aac output.mp4
Apply a filter (resize):
ffmpeg -i input.mp4 -vf scale=1280:720 output.mp4
ffprobe — Tool for Analyzing File Information
ffprobe reads the stream and container information of a media file. The official documentation describes it like this:
ffprobe gathers information from multimedia streams and prints it in human- and machine-readable fashion.
Basic Syntax
ffprobe [options] input_url
Key Options
| Option | Description |
|---|---|
-show_streams |
Display detailed information for each media stream |
-show_format |
Display container format information |
-of json |
Output in JSON format (for scripting) |
-select_streams v:0 |
Select a specific stream only (e.g., first video stream) |
-v quiet |
Suppress verbose logs and output only data |
Usage Examples
Check basic file information (the most common approach):
ffmpeg -i with no output file shows much the same information as ffprobe, without converting anything:
ffmpeg -i input.mp4 -hide_banner
Get stream information in JSON format (for scripting):
ffprobe -v quiet -show_streams -of json input.mp4
Display only the video stream:
ffprobe -v quiet -show_streams -select_streams v input.mp4
Display only container information:
ffprobe -v quiet -show_format -of json input.mp4
Sample ffprobe Output
Shortened output of -show_streams -of json:
{
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_type": "video",
"width": 1920,
"height": 1080,
"r_frame_rate": "30/1"
},
{
"index": 1,
"codec_name": "aac",
"codec_type": "audio",
"sample_rate": "48000",
"channels": 2
}
]
}
ffplay — Media Player for Testing
ffplay is a simple player built on SDL, a library that opens windows and plays sound. The official documentation says:
FFplay is a very simple and portable media player using the FFmpeg libraries and the SDL library. It is mostly used as a testbed for the various FFmpeg APIs.
Basic Syntax
ffplay [options] [input_url]
Main Keyboard Shortcuts
| Key | Action |
|---|---|
q / ESC |
Quit |
f |
Toggle fullscreen |
p / Space |
Pause / Resume |
m |
Toggle mute |
9 / 0 |
Decrease / Increase volume |
← / → |
Seek 10 seconds |
↓ / ↑ |
Seek 1 minute |
s |
Step one frame forward |
Primary Use Cases
- Check a file right after encoding
- Preview what a filter does
- Test receiving a live stream
By default
ffplayopens a window, so it does not run as-is on a machine without a display, such as a server or a CI machine.-nodispturns off only the video window. ffplay still plays the sound, so the machine needs working audio output.
Guidelines for Choosing the Right Tool
Want to check file information
→ ffprobe -show_streams input.mp4
or ffmpeg -i input.mp4 -hide_banner
Want to convert or encode a file
→ ffmpeg -i input.mp4 output.mkv
Want to play back the conversion result on the spot
→ ffplay output.mp4
A Common Workflow
- Inspect: check the source file with
ffmpeg -i input.mp4 -hide_banner - Convert: convert it to the format you need with
ffmpeg - Verify: play the result with
ffplay output.mp4
Note on Displaying Information with ffmpeg
ffmpeg -i input.mp4 shows the file information. With no output file, it then exits with an error (exit code 1). If you only want the information, ignore that error (-hide_banner makes the output shorter), or use ffprobe.
Frequently Asked Questions
When should I use ffprobe instead of ffmpeg?
Use ffprobe when you only need to read a file, for example to get its metadata as JSON for a script. ffprobe only reads, so it cannot re-encode anything by accident.
What does ffplay add over a regular media player?
ffplay decodes and filters with the same libraries as ffmpeg, and it follows the same timestamps. That makes it a quick way to check a filter chain before you export.
How do I get JSON metadata?
Run ffprobe -v quiet -of json -show_format -show_streams input.mp4. Add -show_chapters for chapters and -show_packets for packet details.
Can I script ffplay for automated playback?
Yes. -autoexit -nodisp -loglevel error plays the sound without a window and exits when the file ends. This needs working audio output, and a file with no audio plays nothing. To extract exact frames without playback, use ffmpeg instead.
Why does ffprobe show N/A for the duration?
Some files carry no duration, for example an MKV written to a pipe or a raw H.264 stream (.h264). ffprobe shows N/A for them. Copying a piped MKV into a new file, for example with ffmpeg -i input.mkv -c copy output.mkv, records the duration. A raw H.264 stream has no per-frame timestamps, so a stream copy can fail or leave the frames out of order. In that case, re-encode it with the original frame rate, for example ffmpeg -framerate 30 -i input.h264 -c:v libx264 output.mp4.