Use FFmpeg Photosensibility to Reduce Flashing

This guide explains how to use FFmpeg’s built-in photosensibility video filter to detect and reduce rapid light changes and strobe effects that can trigger seizures in individuals with photosensitive epilepsy. You will learn the filter's syntax, key configuration parameters, and practical command examples to automatically process and sanitize hazardous video content.


Understanding the Filter

The photosensibility filter monitors luminance fluctuations across a sequence of consecutive frames. When rapid, high-contrast changes meet the criteria of potential seizure triggers, the filter dynamically smooths out the luminance spikes to neutralize the flashing effect while preserving overall video quality.

Filter Parameters

The filter accepts several arguments to fine-tune flash detection and mitigation:

  • frames (or f): Specifies the size of the frame buffer used to measure flashing frequency. Accepts values from 2 to 240 (default is 30).
  • threshold (or t): Sets the sensitivity threshold for flash detection. Lower values make the filter more aggressive in detecting flashes, while higher values make it more lenient. Accepts values from 0.1 to 10.0 (default is 1.0).
  • max_elements (or m): The maximum number of elements stored for the frame analysis window. Accepts values from 1 to 240 (default is 30).
  • bypass (or b): When set to 1 (true), the filter analyzes the frames and logs activity without altering the video pixels. The default is 0 (false), which actively alters the frames to reduce flashes.

Practical FFmpeg Commands

1. Basic Flash Reduction with Defaults

To process a video using standard, recommended protection settings:

ffmpeg -i input.mp4 -vf "photosensibility" -c:a copy output.mp4

This applies the default 30-frame window and a 1.0 sensitivity threshold, suppressing strobe effects while copying audio without re-encoding.

2. Increasing Filter Sensitivity

If a video contains subtle or high-frequency flickers that bypass the default configuration, lower the threshold and widen the frames window:

ffmpeg -i input.mp4 -vf "photosensibility=frames=60:threshold=0.6" -c:a copy output.mp4

3. Analyzing Content Without Modifying Frames

To check if a video triggers the photosensitivity filter without changing the output video, enable the bypass mode and inspect the terminal output:

ffmpeg -i input.mp4 -vf "photosensibility=bypass=1" -f null -

4. Combining with Transcoding Profiles

For web-ready delivery (H.264 video with AAC audio) while ensuring seizure safety:

ffmpeg -i input.mp4 -vf "photosensibility=frames=30:threshold=1.0" -c:v libx264 -crf 18 -preset slow -c:a aac -b:a 192k safe_output.mp4