How to Use FFmpeg Photosensibility Filter

This article provides a practical guide on how to use the photosensibility filter in FFmpeg to detect and mitigate potentially harmful flashing lights in video files. You will learn the basic syntax, key parameters, and command-line examples needed to make your video content safer for individuals with photosensitive epilepsy.

Understanding the Photosensibility Filter

The photosensibility filter in FFmpeg is designed to prevent photosensitive epileptic seizures by analyzing video frames for rapid luminance changes (flashing) and high-contrast patterns. When the filter detects these triggers, it automatically dampens the intensity of the flashes, smoothing out the transition between frames to make the video safer for viewers.

Basic Syntax

To apply the filter with its default settings, use the following basic command:

ffmpeg -i input.mp4 -vf "photosensibility" output.mp4

This command reads input.mp4, processes the video streams through the photosensibility filter using default safety thresholds, and exports the corrected video to output.mp4.

Adjusting Filter Parameters

You can fine-tune how the filter behaves by adjusting its parameters. The syntax for passing options is photosensibility=parameter1=value1:parameter2=value2.

The key parameters include:

Example: Strict Filtering for High-Risk Content

If you are processing a video with known intense strobing and want to apply maximum protection, you can lower the threshold and increase the frame window:

ffmpeg -i input.mp4 -vf "photosensibility=f=12:t=0.5:skip=1" output.mp4

Example: Fast Processing for Long Videos

For faster rendering of long videos where processing time is a constraint, you can instruct the filter to skip pixels:

ffmpeg -i input.mp4 -vf "photosensibility=f=9:t=1.0:skip=2" output.mp4

Verifying the Results

To verify how the filter is altering your video, compare the original file and the output file side-by-side using a media player. Areas of the video that previously contained rapid, jarring flashes of white or bright colors should now appear significantly dimmer and transition more smoothly, while the rest of the non-flashing footage remains visually unchanged.