Export FFprobe Results to JSON Format

This guide provides a straightforward tutorial on how to use FFprobe, the media analysis tool included with FFmpeg, to extract video and audio metadata and export the results directly into JSON format. Generating JSON output is highly useful for developers and system administrators who need to parse media information programmatically in scripts and applications.

To export FFprobe results in JSON, you use the -print_format option (which can be abbreviated as -of) followed by json.

Here is the standard command to output the metadata of a media file in JSON format to your terminal:

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

Command Breakdown

Saving the Output to a JSON File

To save the JSON output directly to a file rather than printing it to your terminal screen, redirect the output using the > operator in your terminal:

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

Formatting the JSON Output

By default, FFprobe prints the JSON in a compact format. If you want the JSON to be “pretty-printed” with indentation and newlines for easier manual reading, add :compact=0 to the print format option:

ffprobe -v quiet -print_format json=compact=0 -show_format -show_streams input.mp4