Export SI and TI Values Per Frame with FFmpeg

This article provides a straightforward, step-by-step guide on how to calculate and export Spatial Information (SI) and Temporal Information (TI) values for every frame of a video using FFmpeg. By leveraging FFmpeg's built-in siti filter and ffprobe, you can extract these quality metrics directly into a structured text or CSV file for further analysis.

Step 1: Use the SITI Filter with FFprobe

FFmpeg includes a dedicated siti video filter that calculates Spatial Information (SI) and Temporal Information (TI) based on the ITU-T P.910 standard. To extract these values frame-by-frame and save them to a text file, you should use ffprobe combined with the lavfi (Libavfilter) input virtual device.

Run the following command in your terminal:

ffprobe -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_values.txt

Command Breakdown

  • -f lavfi: Directs ffprobe to use the Libavfilter virtual input.
  • -i "movie=input.mp4,siti": Specifies your input video file (input.mp4) and applies the siti filter to it. Replace input.mp4 with the path to your video.
  • -show_entries frame=pkt_pts_time:frame_tags=lavfi.siti.si,lavfi.siti.ti: Instructs ffprobe to extract the presentation timestamp (pkt_pts_time), the Spatial Information value (lavfi.siti.si), and the Temporal Information value (lavfi.siti.ti) for each frame.
  • -of csv=p=0: Formats the output as a clean, comma-separated list of values without printing the default headers.
  • > siti_values.txt: Redirects the terminal output into a text file named siti_values.txt.

Output Structure

The resulting siti_values.txt file will contain one line per frame, structured as follows:

0.000000,74.125341,0.000000
0.040000,74.155120,4.124512
0.080000,74.010245,3.987514

In this output:

  • The first column represents the frame timestamp in seconds.
  • The second column represents the Spatial Information (SI) value.
  • The third column represents the Temporal Information (TI) value (which is 0 for the very first frame).

Exporting to JSON Format

If you plan to parse this data using Python, R, or another programming language, you may prefer exporting the data in JSON format. You can do this by changing the output writer parameter:

ffprobe -f lavfi -i "movie=input.mp4,siti" -show_entries frame=pkt_pts_time:frame_tags=lavfi.siti.si,lavfi.siti.ti -of json > siti_values.json