Extract Video Metadata in INI Format with FFmpeg
Extracting video metadata into a structured, easily readable format
is a common task in media processing and automation. This article
provides a straightforward guide on how to use ffprobe, the
stream analyzer included with the FFmpeg suite, to extract comprehensive
video metadata and output it directly in the INI configuration format.
You will learn the exact command-line syntax to retrieve this data and
how to save it to a file.
To extract metadata in INI format, you must use the
ffprobe command-line tool. While ffmpeg is
used for transcribing and editing, ffprobe is specifically
designed for gathering media information.
Run the following command in your terminal:
ffprobe -v error -show_format -show_streams -of ini input.mp4Understanding the Command Arguments
ffprobe: Invokes the media analyzer tool.-v error: Minimizes terminal clutter by hiding the default build information and configuration logs, displaying only critical errors.-show_format: Instructs the tool to output container-level metadata, such as file duration, size, bit rate, and format tags.-show_streams: Instructs the tool to output detailed information about each stream inside the file, including video resolution, frame rate, audio codecs, and pixel formats.-of ini: Sets the output formatting writer to INI. This can also be written as-print_format ini.input.mp4: Replace this with the path to your target video file.
Saving the Metadata to a File
To export this metadata directly into a .ini file rather
than printing it to the terminal screen, redirect the output using the
standard command-line redirection operator (>):
ffprobe -v error -show_format -show_streams -of ini input.mp4 > metadata.iniThis command generates a structured metadata.ini file in
your current working directory, categorized by sections like
[format] and [streams.stream.0], which can be
easily parsed by configuration readers in Python, Node.js, or other
programming languages.