Configure FFmpeg Photosensibility Filter Threshold

This article provides a clear, step-by-step guide on how to configure the light flashing threshold using the FFmpeg photosensibility filter. You will learn the specific command-line parameters required to adjust the sensitivity of this filter, allowing you to effectively reduce or eliminate potentially harmful flashing lights and rapid luminance changes in your video files.

Understanding the Photosensibility Filter

The photosensibility filter in FFmpeg is designed to prevent photosensitive epileptic seizures by detecting and smoothing out sudden, high-contrast light flashes in video streams.

To control how aggressively the filter detects and dampens these flashes, you must configure its threshold parameter.

The Threshold Parameter (threshold or t)

The threshold factor determines the sensitivity of the filter.

How to Apply the Filter in FFmpeg

To set the light flashing threshold, use the -vf (video filter) flag followed by photosensibility and your desired threshold value.

Basic Syntax

ffmpeg -i input.mp4 -vf "photosensibility=threshold=0.5" output.mp4

Shortcut Syntax

You can use the short alias t instead of threshold:

ffmpeg -i input.mp4 -vf "photosensibility=t=0.5" output.mp4

Advanced Configuration: Combining Parameters

The photosensibility filter also relies on a frame buffer window to calculate luminance changes. By default, this is set to 30 frames. You can configure both the frame window (frames or f) and the threshold (threshold or t) together, separating them with a colon.

For example, to search for flashes over a window of 45 frames with a strict threshold of 0.6, use the following command:

ffmpeg -i input.mp4 -vf "photosensibility=frames=45:threshold=0.6" output.mp4

Using shortcuts, the same command is written as:

ffmpeg -i input.mp4 -vf "photosensibility=f=45:t=0.6" output.mp4