-
Notifications
You must be signed in to change notification settings - Fork 16
[Feature] FFmpeg quick sampling: multi-window decoding to detect localized corruption #150
Description
Is your feature request related to a problem? Please describe.
The current FFmpeg quick check only decodes the first N seconds of a media file (for example -t 120 from the beginning)
This could creates blind spots: localized corruption occurring later in the file (or near the end) is never detected
Increasing the decoded duration (or running a full scan) is not viable due to CPU and time constraints
Describe the solution you'd like
Add a ffmpeg-quick-windows parameter that replaces a single contiguous decode with multiple short decoding windows spread across the media duration
Instead of decoding N seconds from the start, it could:
- Decode a small number of short windows
- Automatically spread them across the file (early / middle / late)
- Keep the total decoded time low
Example behavior and configuration:
- 5 windows × 5 seconds at 0%, 25%, 50%, 70%, 90%
# keep existing seconds parameter
ffmpeg-quick-seconds: 5
# number of decode samples (default: 1 - current behavior)
ffmpeg-quick-windows: 5Any error or timeout in one of the windows would mark the file as corrupted or suspect
Describe alternatives you've considered
- Increasing the
ffmpeg-quick-secondsvalue: improves coverage, but with a very poor cost-to-efficiency ratio - Running a full FFmpeg decode on all files: reliable but not possible for large libraries
- Relying on ffprobe only: fast but does not detect all decoding-time or playback issues
Additional context
This feature is intended to improve corruption detection in very large media libraries without significantly increasing CPU usage
Implementation concerns / edge cases:
- Libraries with very different media duration will get inconsistent coverage if the number of windows is fixed; scaling the window count automatically based on duration (or providing sensible presets for “short/medium/long” content) would improve consistency
- It may be possible to determine the number of windows automatically based on the media duration, so that enabling a single flag like
ffmpeg-quick-sampling: truewould be sufficient for most users (with optional advanced overrides maybe?) - This feature likely requires
ffprobe(or equivalent) to retrieve the media duration in order to compute sampling offsets; if duration is unavailable or invalid, the implementation could fall back to the current behavior (single window from the start) - Short files where multiple windows would overlap or exceed total duration: the sampler should clamp offsets and avoid re-scanning already covered ranges