The human-readable output of `ffmpeg -i` is great for eyes and bad for scripts. ffprobe has a JSON output mode that exposes the same data as a structured document, so a Python, Node, or shell script can read stream count, codec names, duration, and bitrates without parsing free-form text.

The command

ffprobe -v quiet -print_format json -show_format -show_streams input.mp4

What it does

ffprobe runs the same demuxer as ffmpeg but prints a structured report instead of decoding. With `-show_format` you get the container-level fields (duration, bitrate, format name); with `-show_streams` you get one record per video, audio, and subtitle stream (codec, resolution, sample rate, channel layout). The JSON is stable across FFmpeg versions, so a script written today will still parse against next year's build.

Requirements

Any FFmpeg installation. The JSON is produced by the libavformat demuxer, so the input must be in a format FFmpeg was built with — practically everything in mainstream use. No codec or hardware requirement, since the report is built from the container header.

Things to avoid

  • Parsing the human-readable output instead. The text format is not a stable API; the JSON one is.
  • Forgetting `-v quiet` and getting a wall of stderr in front of your JSON.
  • Calling `ffprobe` on a remote URL without `-timeout`; a slow server will hang the call indefinitely.
  • Assuming every JSON key is guaranteed; `-show_entries format=duration:stream=codec_name` is the supported way to restrict output to the fields you need.