Screen video for flashing content

Run an accessibility check for flashing content and review a static report of potential flash risks.

Use this accessibility check to flag potential flashing risks in uploaded video before publishing it. Editframe Factory splits the recording into overlapping windows and sends them to your analysis workers. The report gives reviewers time ranges and estimated frame regions they can inspect without playing the footage.

Pipeline steps

Inspect the result

The Factory example shows a report from a synthetic SDR fixture. The source stays private so the report can be inspected without exposure to its flashing sequences.

Review recommended

1:06 synthetic fixture, 7 scan windows

Download report JSON
  • General flash

    0:09.567–0:10.533

    Peak flashes in one second
    6
    Estimated affected frame area
    19%
  • Red flash

    0:33.167–0:34.133

    Peak flashes in one second
    6
    Estimated affected frame area
    8%
Scan coverage
  1. Window 1 · 0:00.000–0:10.000
  2. Window 2 · 0:08.000–0:20.000 · 2.000s overlap
  3. Window 3 · 0:18.000–0:30.000 · 2.000s overlap
  4. Window 4 · 0:28.000–0:40.000 · 2.000s overlap
  5. Window 5 · 0:38.000–0:50.000 · 2.000s overlap
  6. Window 6 · 0:48.000–1:00.000 · 2.000s overlap
  7. Window 7 · 0:58.000–1:06.000 · 2.000s overlap

The review workflow was inspired by Steve Frenzel’s Testing flashing content for accessibility issues. The scan uses the relative luminance and saturated red thresholds described in WCAG 2.2 Success Criterion 2.3.1.

The pipeline

Scan segments

This definition targets 10-second windows with 2 seconds of leading overlap. Factory aligns the windows to fragment boundaries, which can lengthen both the window and its overlap. The worker uses the actual start, end and overlap from each request. The overlap supplies earlier frame changes for a rolling one-second count. Each window reports findings whose final qualifying transition falls in its own time range after the overlap.

json
{
  "scan": {
    "type": "endpoint",
    "granularity": { "mode": "segment", "window_ms": 10000, "overlap_ms": 2000 },
    "with": { "endpoint_id": "00000000-0000-4000-8000-000000000000", "max_concurrency": 8 }
  }
}

The runner replaces the example endpoint ID with your registered endpoint ID. The step can dispatch up to eight window requests at a time, subject to available Factory dispatch capacity and worker instances. The endpoint limit caps requests across runs. For a library of recordings, use a pipeline group and set its run limit separately.

The worker uses the upload’s signed index and track URLs to read the fragments it needs from the first video track. FFmpeg decodes the frames in presentation order. The scanner groups nearby pixels into tiles and counts qualifying pairs of opposing luminance or saturated red changes. A tile contributes to a finding when more than three complete pairs occur within a rolling second.

After the run finishes, the compiler reads every accepted window output. It verifies that the reported windows cover the recording and writes one JSON report with source-relative times, peak flash counts and estimated affected area.

Run it

Use Node.js for the runner and Docker on a server where you can expose the worker through HTTPS. Use a Pipelines-enabled organization and a seekable SDR MP4 uploaded to Editframe. The worker supports up to 2,073,600 pixels per frame (1920 × 1080) with BT.709 or sRGB color. Each fragment-aligned window can cover up to 30 seconds, 96 MiB of encoded media and 2,400 decoded frames.

  1. Set EDITFRAME_TOKEN to the organization's API key. Set EDITFRAME_HOST if your Editframe origin differs from https://editframe.com. Set FLASH_ENDPOINT_URL to the public HTTPS URL at which your server will receive Factory requests, including the /scan path. Register the endpoint from the repository root.

    bash
    elements/scripts/editframe pipelines endpoints create "$FLASH_ENDPOINT_URL" --timeout-ms 90000 --max-concurrency 8 --json
  2. Copy the returned id to EDITFRAME_FLASH_ENDPOINT_ID in the runner’s environment. Set EDITFRAME_ENDPOINT_SECRET to the returned signing_secret on the worker host. Set EDITFRAME_MEDIA_ORIGIN there if the media origin differs from https://editframe.com. Forward the HTTPS endpoint to port 8080 on the worker host. Build and start the worker from the repository root.

    bash
    docker build -t flash-detection-worker elements/examples/flash-detection
    docker run --rm -p 127.0.0.1:8080:8080 \
      -e EDITFRAME_ENDPOINT_SECRET -e EDITFRAME_MEDIA_ORIGIN \
      -e FLASH_WORKER_CONCURRENCY=8 flash-detection-worker

    Set FLASH_WORKER_CONCURRENCY from 1 to 8 based on the memory and CPU available to each worker. The registered endpoint limit covers the service as a whole, including when a load balancer routes requests to multiple workers.

  3. Set VIDEO_MP4 to the path of your SDR MP4. Upload it and copy the returned file.id into FILE_ID.

    bash
    elements/scripts/editframe pipelines upload "$VIDEO_MP4" --json
  4. Run the example. It creates or reuses a pipeline version, starts the scan, and writes the compiled report to standard output.

    bash
    node elements/examples/flash-detection/run.mjs "$FILE_ID" > flash-detection-report.json

To compare the same input with serial execution, add --concurrency 1. If the run recorded worker timing and read sizes, the JSON includes peak Factory windows in progress, elapsed worker time from first pickup to last completion, and bytes read.

Reproduce the fixture

These commands require FFmpeg locally. The first creates a private test video containing flashing patterns for automated scans. The second creates a control with no flashes. Upload and scan each file to compare their reports.

bash
node elements/examples/flash-detection/fixture.mjs flash-fixture.mp4
node elements/examples/flash-detection/fixture.mjs --control flash-control.mp4

Read the report

  • review means the scan found one or more ranges to inspect. Each finding contains the flash type, times in milliseconds, peak count, and estimated affected frame area.
  • no-flags means the scanner covered the input and found no ranges matching its rules.
  • incomplete means the scan failed or some coverage was missing. The runner writes any partial evidence and exits with an error. Review coverage or retry the failed run before using the result.

Use the scan as a screening step. Tile averaging can lose fine patterns and small regions. The frame-area estimate describes the encoded image. A WCAG conformance assessment also considers the video at its largest playback size, viewing area, looping and any other flashing content on the page. Use the flagged times to revise or remove the effect and scan the revised asset.