fix: harden interlace detection, skip unreliable checks under quickscan, report seek-index reason (#749)#754
Merged
Conversation
…kscan; report seek-index reason Interlace detection (#749): - Use idet's more reliable MultiFrame pass only (drop the noisier SingleFrame OR). - Decide interlaced from the dominant field order (max of TFF/BFF) and only when it outnumbers progressive frames, instead of the previous >=5% ratio. Biases toward progressive so progressive content is not deinterlaced; the manual deinterlace command remains available for missed cases. - Skip idet entirely under --quickscan, the 180s sample is not representative. Quickscan accuracy (#749): - Skip bitrate verification under --quickscan, the 180s sample does not represent the whole file bitrate. Direct Play seek-index (#746): - Report the specific defect via a SeekIndexIssue flags enum (NoSegment, IncompleteSeekHead, CuesBeforeTracks, CuesNotFound, NoCuePoints, ParseError) and log it, replacing the vague "cannot be Direct Played" message. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Hardens media verification heuristics to reduce false-positive processing, especially under --quickscan, and improves Direct Play seek-index diagnostics by reporting the specific structural defect detected.
Changes:
- Report specific Matroska seek-index failure reasons via
SeekIndexIssueand log them during structural verification/remux decisions. - Under
--quickscan, skip expensive/unreliable checks (idet-based interlace analysis and bitrate verification) and rely on metadata flags only. - Make idet-based interlace detection more conservative (MultiFrame-only + dominant field order, requiring interlaced frames to outnumber progressive).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| PlexCleaner/ProcessFile.cs | Logs seek-index issue reason; skips idet + bitrate checks under quickscan. |
| PlexCleaner/MatroskaStructure.cs | Introduces SeekIndexIssue enum and returns a reason code instead of a boolean. |
| PlexCleaner/FfMpegIdetInfo.cs | Switches interlace decision logic to MultiFrame-only and a stricter threshold. |
| HISTORY.md | Documents quickscan behavior changes and more conservative interlace detection. |
Address review feedback: - SeekIndexIssue: drop [Flags], validation short-circuits to a single value so a plain enum is accurate. - Add pure-logic unit tests for the interlace decision (progressive, clean interlaced, real-world false-positive samples, undetermined-majority, and that the decision uses the MultiFrame pass). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…x comment - Interlace decision tests now use real full-scan idet values (interlaced MPEG-2 sample from the troublesome set, clean and noisy progressive samples from the library) plus clearly-synthetic boundary cases, with no media file names. - Correct the GetSeekIndexIssue comment: it returns the first defect found, not multiple. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the #747/#746 work, validated against the live library.
Interlace detection (#749)
False-positive deinterlacing of progressive films was observed (e.g. Top Gun Maverick, The Batman, Pacific Rim flagged at 5–16%). Root causes and fixes:
MultiFrame || SingleFrame).max(TFF, BFF)) and only when it outnumbers progressive frames, replacing the previous>=5%ratio. Genuinely interlaced content is consistently one field order at ~100%; a few percent of mixed-order frames is normal idet noise on progressive content.deinterlacecommand remains the fallback.Quickscan accuracy (#749)
Under
--quickscanonly the first 3 minutes are sampled, which is not representative:(
VerifyMediaStreamsand closed-caption detection are left as-is: under quickscan they under-cover but do not produce false positives.)Direct Play seek-index message (#746)
Replaced the vague
Matroska structure cannot be Direct Playedlog with a specificSeekIndexIssueflags enum (NoSegment,IncompleteSeekHead,CuesBeforeTracks,CuesNotFound,NoCuePoints,ParseError) that is logged, so the exact defect is visible.Validation
🤖 Generated with Claude Code