Skip to content

fix: harden interlace detection, skip unreliable checks under quickscan, report seek-index reason (#749)#754

Merged
ptr727 merged 3 commits into
developfrom
followup/deint-quickscan-seekindex-reason
Jun 22, 2026
Merged

fix: harden interlace detection, skip unreliable checks under quickscan, report seek-index reason (#749)#754
ptr727 merged 3 commits into
developfrom
followup/deint-quickscan-seekindex-reason

Conversation

@ptr727

@ptr727 ptr727 commented Jun 22, 2026

Copy link
Copy Markdown
Owner

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:

  • Use idet's MultiFrame pass only (dropped the noisier MultiFrame || SingleFrame).
  • Decide from the dominant field order (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.
  • Biased toward not deinterlacing (prefer a false negative); the manual deinterlace command remains the fallback.

Quickscan accuracy (#749)

Under --quickscan only the first 3 minutes are sampled, which is not representative:

  • Skip idet under quickscan (rely on container interlace flags only).
  • Skip bitrate verification under quickscan (a 180s sample misrepresents peak/average bitrate).

(VerifyMediaStreams and 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 Played log with a specific SeekIndexIssue flags enum (NoSegment, IncompleteSeekHead, CuesBeforeTracks, CuesNotFound, NoCuePoints, ParseError) that is logged, so the exact defect is visible.

Validation

  • Local-library run reproduced the deinterlace false positives (15 progressive films); with this change the same idet stats resolve to not-interlaced, while genuine interlaced (consistent single field order) still detects.
  • 124 unit tests pass; build clean.

🤖 Generated with Claude Code

…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>
Copilot AI review requested due to automatic review settings June 22, 2026 14:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SeekIndexIssue and 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.

Comment thread PlexCleaner/MatroskaStructure.cs Outdated
Comment thread PlexCleaner/FfMpegIdetInfo.cs
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread PlexCleaner/MatroskaStructure.cs Outdated
…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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@ptr727 ptr727 merged commit 4ca27ad into develop Jun 22, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants