Export Per-Frame SI and TI Values Using FFmpeg

This article explains how to calculate and export per-frame Spatial Information (SI) and Temporal Information (TI) metrics to a text file using FFmpeg. Video engineers and researchers frequently rely on these values (defined by ITU-T P.910) to quantify the spatial complexity and motion dynamics of video streams. Below are the exact commands and filter chains required to generate this data efficiently without re-encoding the video.

Using the siti and metadata Filters

FFmpeg includes a dedicated siti filter that calculates both spatial and temporal indices for every processed frame. To direct these values to a plain text file, chain the siti filter with the metadata filter.

Run the following command:

ffmpeg -i input.mp4 -vf "siti,metadata=mode=print:file=siti_metrics.txt" -f null -

Command Breakdown

  • -i input.mp4: Specifies your source video file.
  • -vf "siti,metadata=mode=print:file=siti_metrics.txt":
    • siti: Computes the SI (Sobel filter standard deviation) and TI (frame difference standard deviation) for each frame and writes them to frame-level metadata keys (lavfi.siti.si and lavfi.siti.ti).
    • metadata=mode=print:file=siti_metrics.txt: Captures the frame metadata generated by the siti filter and flushes it line-by-line into siti_metrics.txt.
  • -f null -: Uses the null muxer to discard video rendering, drastically speeding up processing by only performing the necessary decoding and filtering operations.

Understanding the Output Format

The output file (siti_metrics.txt) will contain formatted entries for each frame that look like this:

frame:0    pts:0       pts_time:0
lavfi.siti.si=45.123456
frame:1    pts:1000    pts_time:0.04
lavfi.siti.si=45.234567
lavfi.siti.ti=12.345678

(Note: Frame 0 does not have a TI value because Temporal Information requires a preceding frame for delta calculation.)


Alternative: Exporting directly to a CSV File with FFprobe

If you need the per-frame SI and TI values cleanly formatted into a CSV for graphing or analysis in tools like Python or Excel, you can use ffprobe with the lavfi virtual device:

ffprobe -v error -f lavfi -i "movie=input.mp4,siti" \
  -show_entries frame=pkt_pts_time:frame_tags=lavfi.siti.si,lavfi.siti.ti \
  -of csv=p=0 > siti_metrics.csv

Resulting Output

The command outputs comma-separated lines consisting of the presentation timestamp, SI, and TI:

0.000000,45.123456
0.040000,45.234567,12.345678
0.080000,45.312984,11.897451