credit-detect
Detect credit sequences in video files by frame-feature analysis
A Python tool that finds where closing credits start and end in a video file by scoring each frame for low entropy, histogram peaks, and on-screen text, reverse-engineered from Plex Media Server's own credit-detection pipeline.
credit-detect is a Python tool that scans video files and identifies where the closing credits begin and end. It works by analyzing each frame for visual signals associated with credit sequences: low image entropy (the picture is mostly uniform or plain), strong histogram peaks, and the presence of text on screen. These three features are combined and scored to produce a time range marking the credit segment.
The detection logic is described as a reverse-engineered version of the credit detection algorithm inside Plex Media Server, a popular home media application. The author traced through Plex's binary and reproduced its five-stage pipeline: candidate frame filtering, clustering consecutive candidates into runs, scoring each segment, merging nearby candidates, and applying duration and score thresholds to decide what qualifies as credits.
The tool runs in two modes. In direct video mode, it accepts a video file, extracts frames using ffmpeg, and uses a neural network model to count text regions per frame. In CSV mode, it accepts a pre-extracted feature file with nine columns (frame index, timestamp, entropy, histogram peak ratio, and text detection values), which avoids the need for ffmpeg or the model entirely.
The neural network model (a file called model_v1.pb) is not included in the project, because it is extracted from Plex's own scanner and its licensing is unclear. The README explains three options: extract it yourself from a Plex installation using a tool called binwalk, train a compatible replacement on a text-detection dataset, or skip the model and use CSV mode instead. The architecture is a standard EAST-style text detector, so any model trained on the same task works as a drop-in replacement.
The project is licensed under AGPL-3.0 and requires Python 3.10 or newer.
Where it fits
- Automatically detect credit start and end timestamps in a movie file so a media player can offer a skip-credits button.
- Batch-process a local video library to tag credit positions for every file and store them in a database.
- Run credit detection without ffmpeg by supplying a pre-extracted CSV of per-frame features, skipping the neural network entirely.
- Integrate credit detection into a custom Plex-alternative media server to add automatic skip-credits functionality.