ffprobe comes with FFmpeg, along with ffmpeg (conversion) and ffplay (playback). It reads technical details from video and audio files, such as the codec, resolution, frame rate and bitrate.

Before you post ffprobe output, cut it down to the fields needed to diagnose the problem: it can contain file names, account paths, GPS location, author and device tags, timestamps and comments (privacy checklist).

1. Basic ffprobe Command

The simplest form takes only a file name:

ffprobe input.mp4

It prints the basics: container format, codecs, resolution, duration and more. This text goes to standard error (stderr, where programs write their messages), not to standard output.

2. Key Options

-show_streams: Display stream information

ffprobe -show_streams input.mp4

It shows the details of every stream (video, audio, subtitles and so on), each in its own [STREAM] ... [/STREAM] block.

-show_format: Display container information

ffprobe -show_format input.mp4

It shows information about the whole file: format name, file size, duration, overall bitrate and so on.

-of json: Output in JSON format

ffprobe -v quiet -show_streams -show_format -of json input.mp4
  • -v quiet hides ffprobe’s own log, so only the JSON is printed
  • -of json prints JSON (short for -output_format json; the older -print_format still works but is deprecated)
  • With both -show_streams and -show_format, everything goes into one JSON document

3. JSON Output Example

Output of the command above, shortened:

{
  "streams": [
    {
      "index": 0,
      "codec_name": "h264",
      "codec_type": "video",
      "width": 1920,
      "height": 1080,
      "pix_fmt": "yuv420p",
      "r_frame_rate": "30/1",
      "duration": "120.000000",
      "bit_rate": "4499954"
    },
    {
      "index": 1,
      "codec_name": "aac",
      "codec_type": "audio",
      "sample_rate": "48000",
      "channels": 2,
      "duration": "120.000000",
      "bit_rate": "128259"
    }
  ],
  "format": {
    "filename": "input.mp4",
    "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
    "duration": "120.000000",
    "size": "69551765",
    "bit_rate": "4636784",
    "tags": {
      "encoder": "Lavf62.12.100"
    }
  }
}

4. Key Fields and How to Read Them

Field Location Meaning
codec_name streams Codec name (e.g., h264, aac, hevc)
codec_type streams Stream type (video / audio / subtitle)
width / height streams (video) Resolution (pixels)
r_frame_rate streams (video) Base frame rate, as guessed by FFmpeg (fraction notation, e.g., 30/1 = 30fps)
bit_rate streams / format Bitrate (bps)
duration streams / format Duration (seconds)
pix_fmt streams (video) Pixel format (e.g., yuv420p)
sample_rate streams (audio) Sample rate (Hz)
channels streams (audio) Number of audio channels

How to Read r_frame_rate

r_frame_rate is FFmpeg’s guess at the base frame rate, not an average. For video with a variable frame rate, the average in avg_frame_rate can be different. Both are written as fractions:

Value Meaning
30/1 30fps
60000/1001 ~59.94fps (NTSC)
25/1 25fps (PAL)
24000/1001 ~23.976fps (cinematic)

5. Combining with jq

jq is a command-line tool for reading JSON. Pipe ffprobe’s JSON into it to pull out single values.

Get only the resolution

ffprobe -v quiet -select_streams v:0 -show_streams -of json input.mp4 | jq ".streams[] | {width, height}"

Get only the duration

ffprobe -v quiet -show_format -of json input.mp4 | jq ".format.duration"

Get a list of codec names

ffprobe -v quiet -show_streams -of json input.mp4 | jq "[.streams[].codec_name]"

To install jq, use apt install jq on Linux, brew install jq on macOS, or winget install jqlang.jq on Windows.

6. Difference from ffmpeg -i

ffmpeg -i filename also shows stream information, but it is made for a different job.

Command Purpose Output Script-friendly
ffprobe Dedicated file analysis Standard output (JSON, etc.) Yes
ffmpeg -i Info check for conversion commands Standard error Difficult to parse

In scripts and automated jobs, use ffprobe. ffmpeg -i is fine for a quick check before converting. Its output goes to standard error.

Common Usage Summary

# Quick basic info check
ffprobe input.mp4

# Get all info in JSON format (for scripts)
ffprobe -v quiet -show_streams -show_format -of json input.mp4

# Check video streams only
ffprobe -v quiet -show_streams -select_streams v -of json input.mp4

# Check audio streams only
ffprobe -v quiet -show_streams -select_streams a -of json input.mp4

Frequently Asked Questions

How do I get the duration of a video as a number?

ffprobe -v quiet -of csv=p=0 -show_entries format=duration in.mp4 prints only the duration in seconds, as a decimal number. That is easy to use in a script.

What is the difference between the stream bit_rate and the format bit_rate?

bit_rate under a stream is that stream’s own rate. format=bit_rate is the average for the whole file: every stream, audio included, plus the container overhead. Use format=bit_rate to work out file sizes, and the video stream’s bit_rate to judge how much the video is compressed.

How can I list every stream of every file in a folder?

Use a loop, for example in bash: for f in *.mp4; do ffprobe -v quiet -of json -show_streams "$f" | jq ...; done. The JSON output is easy to process further.

Why is bit_rate sometimes “N/A”?

Some MKV and WebM files store no bitrate for each stream, so there is no per-stream value to show. The average for the whole file (file size in bits divided by the duration) is still in format=bit_rate.

Can ffprobe extract chapter markers?

Yes. ffprobe -v quiet -of json -show_chapters input.mp4 lists each chapter’s start and end times and its title. Many DVD and Blu-ray rips include chapters.