Calculate Video SI and TI with FFmpeg siti Filter

This guide explains how to measure the Spatial Information (SI) and Temporal Information (TI) of a video using FFmpeg's native siti filter. By executing this filter, you can quantify the spatial complexity (detail and edge energy) and temporal dynamics (motion between frames) according to the ITU-T P.910 standard, providing crucial data for video encoding optimization, bitrate ladder design, and quality analysis.

Understanding SI and TI

  • Spatial Information (SI): Quantifies spatial detail within a frame. It is calculated by applying a Sobel filter to the luminance component of each frame and computing the standard deviation of the resulting edge magnitudes. High SI values indicate sharp, detailed scenes.
  • Temporal Information (TI): Quantifies motion or changes over time. It is derived by subtracting the luminance plane of consecutive frames and calculating the standard deviation of the difference. High TI values indicate rapid motion or scene changes.

Basic Command

To calculate SI and TI across an entire video file without re-encoding, apply the siti video filter (-vf) and pipe the output to the null sink (-f null -).

ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  • -vf siti=print_summary=1: Loads the filter and outputs average, minimum, and maximum SI and TI values at the end of processing.
  • -f null -: Discards the encoded video output, running the command as fast as your CPU can decode frames.

Exporting Metrics to JSON or CSV

The siti filter outputs data to stderr. You can format the per-frame logs and final summary into structured formats such as JSON or CSV using the print_format parameter, then redirect stderr to a file for analysis.

Exporting to JSON:

ffmpeg -i input.mp4 -vf "siti=print_summary=1:print_format=json" -f null - 2> siti_output.json

Exporting to CSV:

ffmpeg -i input.mp4 -vf "siti=print_summary=1:print_format=csv" -f null - 2> siti_output.csv

Available Filter Options

The siti filter accepts the following options:

  • print_summary (boolean): Set to 1 (true) or 0 (false). Enables or disables printing the overall summary (mean, min, max) for the entire stream. Default is 0.
  • print_format (string): Specifies the output syntax. Accepted values are text (default), json, and csv.

Practical Application of Results

Once computed, SI and TI values help categorize your content:

  • High SI, High TI: Highly complex scenes (e.g., fast-moving sports, handheld camera motion in dense foliage). These require higher bitrates to avoid compression artifacts.
  • High SI, Low TI: Detailed but static scenes (e.g., stationary landscape shots, talking heads with detailed backgrounds). These require efficient spatial intra-coding.
  • Low SI, High TI: Low-detail motion (e.g., cartoon animations, clean graphic motion). Temporal prediction handles these well even at lower bitrates.
  • Low SI, Low TI: Simple scenes (e.g., static graphics, low-detail talking heads). These can be encoded at very low bitrates with minimal quality loss.