Probe and generate JSON report

Problem

Probe and generate a “clean” JSON report, without the FFmpeg headers.

Solution

ffprobe                 \
    -show_format        \
    -show_streams       \
    -print_format json  \
    -loglevel quiet     \
    input_file

General command

ffprobe                         \
    -show_format                \
    -show_streams               \
    -print_format print_format  \
    -loglevel log_level         \
    input_file

Command syntax

ffprobe
starts the command
-show_format
shows the technical metadata of the container
-show_streams
shows the technical metadata of the streams, including the codexes
-print_format print_format
set the output printing format to json
-loglevel log_level
set the amount of additional information included into the report
input_file
path, name and extension of the input file

Discussion

The JavaScript Object Notation (JSON) format has two advantages: it can easily be parsed and processed by machines, and it is human-readable as well. Other possible output printing formats include:

  • xml
  • flat

The -print_format parameter has the alias -of (output format).

The -loglevel parameter has the alias -v (verbosity). It supports the following values:

  • quiet
  • panic
  • fatal
  • error
  • warning
  • info
  • verbose
  • debug
  • trace

which allows to choose the amount of additional information to be included in the report.


2024-11-29