FFprobe commands for video info, streams and JSON

ffprobe is the inspection tool that ships with FFmpeg. It reads a file's container and stream headers and prints them without decoding the picture. -show_format -show_streams -of json prints everything as JSON, -show_entries picks the fields you name and -of csv=p=0 prints a bare value. Every command below ran on the same 60-second clip, and each result is what it printed.

Video info, read in your browser

Need it from code? Use Rendobar's ffprobe API

Everything Read only

You want the whole report, or you do not know yet which fields you need.

ffprobe -v error -show_format -show_streams -of json in.mp4

139 lines of JSON: a streams array, 37 keys for the video stream and 26 for the audio, then format with duration 60.000000, size 17637003, bit_rate 2351600 and the container tags.

Sections
streams, format
Video stream
37 keys
Run time
64 ms
Chosen fields Read only

You know the fields your code reads. It prints those and nothing else.

ffprobe -v error -show_entries format=duration,size,bit_rate:stream=codec_type,codec_name,width,height,r_frame_rate,nb_frames,sample_rate,channels -of json in.mp4

659 bytes of JSON: h264 1280x546 at 24/1 with 1440 frames, aac at 48000 Hz in 2 channels, duration 60.000000, size 17637003, bit rate 2351600.

Streams
h264 1280x546, aac 48 kHz
Frames
1440 at 24/1
Run time
74 ms

Run it

Run it on Rendobar

Send the same command from your code. The job reads the input from its URL and returns the report as JSON.

job.ts
import { createClient } from "@rendobar/sdk";
const rb = createClient({ apiKey: process.env.RENDOBAR_API_KEY });
const job = await rb.jobs.run({
type: "ffprobe",
params: {
command: "ffprobe -v error -show_format -show_streams -of json https://cdn.rendobar.com/examples/get-video-info/in.mp4",
},
});
console.log(job.output.data);

Install with npm i @rendobar/sdk. jobs.run() submits and waits, so it returns the finished job in one call.

terminal
curl https://api.rendobar.com/jobs \
-H "Authorization: Bearer $RENDOBAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "ffprobe",
"params": {
"command": "ffprobe -v error -show_format -show_streams -of json https://cdn.rendobar.com/examples/get-video-info/in.mp4"
}
}'

Returns immediately with a job id. Poll GET /jobs/{id} or register a webhook rather than blocking on the request.

Every variant

Pick the command for your case

Each one ran on the same input. The line under it is what came out. Run times are the best of three runs with FFmpeg 8.0 on one desktop machine, so read them as relative.

  1. Get the duration in seconds

    Read only
    ffprobe -v error -show_entries format=duration -of csv=p=0 in.mp4

    Prints 60.000000 and nothing else, ready for a script. The video stream keeps its own duration, and container vs stream duration in ffprobe shows when the two disagree.

    86 ms run

  2. Get the resolution as WIDTHxHEIGHT

    Read only
    ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 in.mp4

    Prints 1280x546. s=x sets the separator, p=0 drops the section name.

    74 ms run

  3. Get the frame rate

    Read only
    ffprobe -v error -select_streams v:0 -show_entries stream=r_frame_rate,avg_frame_rate -of csv=p=0 in.mp4

    Prints 24/1,24/1. Both are fractions, so a 29.97 fps file prints 30000/1001. Divide in your code.

    72 ms run

  4. Get the frame count from the header

    Read only
    ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -of csv=p=0 in.mp4

    Prints 1440, read from the MP4 index without touching the video data.

    79 ms run

  5. Count frames by reading packets

    Read only
    ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 in.mp4

    Prints 1440. Reads every packet but decodes none, and works on MKV where nb_frames is empty.

    79 ms run

  6. Count frames by decoding every one

    Read only
    ffprobe -v error -select_streams v:0 -count_frames -show_entries stream=nb_read_frames -of csv=p=0 in.mp4

    Prints 1440, the same number, after decoding the whole stream. The slowest row on this page.

    2.1 s run

  7. List the codec of every stream

    Read only
    ffprobe -v error -show_entries stream=codec_name,codec_type -of csv=p=0 in.mp4

    Prints h264,video and aac,audio, one line per stream.

    70 ms run

  8. Show only the audio streams

    Read only
    ffprobe -v error -select_streams a -show_entries stream=index,codec_name,sample_rate,channels,channel_layout -of csv=p=0 in.mp4

    Prints 1,aac,48000,2,stereo: stream 1, AAC at 48000 Hz in two channels. a matches every audio stream, one line each, and a:0 the first only.

    61 ms run

  9. Get the profile, pixel format and bit depth

    Read only
    ffprobe -v error -select_streams v:0 -show_entries stream=profile,pix_fmt,bits_per_raw_sample -of csv=p=0 in.mp4

    Prints High,yuv420p,8: H.264 High profile, 4:2:0 chroma, 8 bits per sample.

    60 ms run

  10. Get the bitrate of the file and of each stream

    Read only
    ffprobe -v error -show_entries format=bit_rate:stream=codec_type,bit_rate -of csv=p=0 in.mp4

    Prints video,2215287, audio,130562, then 2351600 for the whole file. All in bits per second.

    70 ms run

  11. Get the duration as hours:minutes:seconds

    Read only
    ffprobe -v error -sexagesimal -show_entries format=duration -of csv=p=0 in.mp4

    Prints 0:01:00.000000.

    68 ms run

  12. Print fields as key=value lines

    Read only
    ffprobe -v error -select_streams v:0 -show_entries stream=codec_name,width,height -of default=nw=1 in.mp4

    Prints codec_name=h264, width=1280 and height=546 on three lines. nw=1 drops the [STREAM] wrapper, so a shell loop can split each line at the =.

    58 ms run

  13. Get the rotation of a phone video

    Read only
    ffprobe -v error -select_streams v:0 -show_entries stream=width,height:stream_side_data=rotation -of json phone.mp4

    Returns width 1280, height 720 and a side_data_list entry with rotation 90. Players show it 720x1280.

    77 ms run

Gotchas

Where it goes wrong

Why does plain ffprobe print nothing to my script?

With no -show_ flag and no -show_entries, ffprobe writes its summary to stderr and leaves stdout empty:

ffprobe in.mp4

0 bytes on stdout. The banner, Duration: 00:01:00.00, start: 0.000000, bitrate: 2351 kb/s and one line per stream all went to stderr, which a script reading stdout never sees.

Ask for a section and pick a writer, as every command on this page does, and the report lands on stdout. -v error then keeps stderr empty unless something is wrong.

Why does the JSON have empty programs and stream_groups arrays?

ffprobe 8.0 adds both arrays, empty, when the command uses -show_entries. The chosen-fields command above printed them. The full report from -show_format -show_streams printed only streams and format. Read the keys you asked for and ignore the rest.

Most numbers arrive as strings. duration, size, bit_rate and nb_frames are quoted ("60.000000"), while width, height, channels and nb_streams are plain integers. Parse each field to the type you need.

Picking an ffprobe output format runs json, csv, flat and default on one file, including what csv does with a comma inside a value.

Why does ffprobe return empty JSON and no error?

-v quiet hides the error along with the banner. On a text file renamed to fake.mp4:

ffprobe -v quiet -show_format -show_streams -of json fake.mp4

An empty object, {}, and exit code 1. Nothing says why.

ffprobe -v error -show_format -show_streams -of json fake.mp4

The same empty object and exit code 1, and stderr says moov atom not found and Invalid data found when processing input.

To get the reason inside the JSON, add -show_error:

ffprobe -v quiet -show_error -of json fake.mp4

An error object with code -1094995529 and string Invalid data found when processing input.

Check the exit code before you parse anything, and use -v error in scripts so a bad file explains itself. Validating uploads with ffprobe turns these checks into one job that rejects a renamed file.

Which frame count should I trust?

On an MP4 all three agree. nb_frames, -count_packets and -count_frames each printed 1440 for the test clip. They differ in what they read and in where they work.

  • nb_frames comes from the container's index. Nothing is read beyond the header.
  • -count_packets reads every packet in the stream and counts them. No decoding.
  • -count_frames decodes every frame. Use it only when you need the number of frames a decoder actually produces.

Matroska has no per-stream frame count in its header, so the fast way comes back empty:

ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames,duration -of csv=p=0 in.mkv

N/A,N/A. The same streams in MP4 gave 1440 and 60.000000.

ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 in.mkv

1440. Counting packets works on any container, so use it when you cannot know the format in advance.

Why is the stream duration N/A in an MKV?

Matroska stores durations per file and as a DURATION tag per stream, not in the stream header ffprobe reads. Ask the format instead:

ffprobe -v error -show_entries format=duration -of csv=p=0 in.mkv

60.021000. The MP4 of the same streams says 60.000000. Matroska counts the end of the last audio frame.

The per-stream value is a tag: -show_entries stream_tags=DURATION printed 00:01:00.021000000, as text.

On MP4s with sound the container and the video stream disagree too. Container vs stream duration in ffprobe measures that gap and says which number to cut against.

Why does ffprobe say my portrait video is landscape?

width and height describe the picture as stored. Phones store most portrait video sideways and add a rotation for players to apply. FFmpeg 8.0 reports it in side data, not as the old rotate tag:

ffprobe -v error -select_streams v:0 -show_entries stream=width,height:stream_side_data=rotation -of json phone.mp4

width 1280, height 720, rotation 90. Swap width and height when the rotation is 90 or -90.

You do not need to rotate anything yourself when you process the file. FFmpeg applies the rotation as it decodes: a frame extracted from phone.mp4 came out 720x1280.

Why are the values printed in a different order than I asked?

-show_entries picks which fields to print, not their order. ffprobe prints them in its own order:

ffprobe -v error -select_streams v:0 -show_entries stream=height,width -of csv=p=0 in.mp4

1280,546. Width first, though the command asked for height first.

With -of csv, read fields by position in ffprobe's order, or switch to -of json or -of default=nw=1 and read them by name. The format section also prints after all the streams, whatever order you wrote it in.

Related: Check a video for errors, Trim a video, Rotate a video, Change frame rate, Strip metadata.

FAQ

Frequently asked questions

What is ffprobe used for?

It tells you what a media file holds before you process it: the container, and each stream's codec, resolution, frame rate, duration, bitrate, language and rotation. Scripts call it to reject files that are not real video, to pick encoder settings and to find the timestamps to cut at. It changes nothing in the file.

Is ffprobe included with FFmpeg?

Yes. ffprobe is built from the same source as ffmpeg and ships beside it, so a machine with FFmpeg has both. ffprobe -version printed ffprobe version 8.0 on the machine that ran this page. A Rendobar ffprobe job needs no install on your side: it runs the same command on our machines.

Can ffprobe read a video from a URL?

Yes. ffprobe opens http and https URLs and reads only the parts it needs. The duration command printed 60.000000 for this page's in.mp4 straight from its CDN address. A Rendobar ffprobe job takes the URL inside the command and probes it over the network the same way, and downloads the file first only when that fails, for example on a server that rejects range requests.

What does a Rendobar ffprobe job return?

The sections your command asked for, as JSON in output.data. A command that leaves flags out gets -v error, JSON output and -show_format -show_streams -show_chapters added, so a bare URL returns the full report. With format and streams present the job adds a summary. For the 5-second sample clip it read h264 at 1280x720, 24 fps, rotation 0, not HDR, with AAC stereo at 48000 Hz. A csv or flat writer returns ffprobe's text as stdout instead.

Your command. Our infrastructure.

Bring your own commands. Run them on scalable CPU and GPU infrastructure, and pay only for compute time.