Extract SMPTE 377M Metadata from MXF using FFmpeg

This article provides a straightforward guide on how to extract clean SMPTE 377M structural metadata from a Material Exchange Format (MXF) container using FFmpeg and FFprobe. You will learn the exact command-line arguments needed to output this metadata in both human-readable formats like JSON and raw binary formats for deep packet analysis.

Extracting Metadata to JSON using FFprobe

The most efficient way to extract clean, structured SMPTE 377M header metadata from an MXF file is by using ffprobe. This tool parses the KLV (Key-Length-Value) triplets defined by the SMPTE 377M standard and outputs them in a structured format.

Run the following command to export the metadata to a clean JSON file:

ffprobe -v quiet -show_format -show_streams -show_data -print_format json input.mxf > metadata.json

Command Breakdown:

Extracting Raw Metadata Streams with FFmpeg

If the MXF container houses SMPTE 377M structural metadata or ancillary data (such as SMPTE 436M/RDD 18) within a dedicated data stream, you can extract the raw, uncompressed binary block using ffmpeg.

First, identify the stream index of the timed metadata or data track:

ffprobe input.mxf

Look for a stream labeled Data: or Metadata:. Once you have the stream index (for example, 0:d:0 or 0:2), use the following command to copy the stream without re-encoding:

ffmpeg -i input.mxf -map 0:d -c copy -f rawvideo metadata_block.bin

Command Breakdown:

Exporting to FFmpeg Metadata Format

If you need a flat text file containing key-value pairs of the MXF header metadata, you can use FFmpeg’s native metadata muxer:

ffmpeg -i input.mxf -f ffmetadata metadata.txt

This generates a lightweight text file (metadata.txt) containing the clean, parsed SMPTE 377M global tags, which is ideal for quick scripting and database ingestion.