Skip to content

Video-stream non-monotonic-DTS false positive still routes to full RepairFailed (gap not covered by #827 / PR #833 / PR #840) #939

Description

@Dzhuneyt

Is this a new issue that can be reproduced using the latest version?

  • This is a new issue that can be reproduced.

Which operating systems reproduce the issue?

  • Windows
  • Docker
  • Other

Version information.

OS Version: E.g. Windows 11 Pro 22H2.
Docker Version: Run docker --version.
Docker Image: E.g. latest, develop.
PlexCleaner getversioninfo: Run PlexCleaner getversioninfo.

Steps to reproduce?

Summary

Issue #827 (closed, resolved in 3.21 via PR #833/#840) fixed the non-monotonic-DTS false positive for audio-stream DTS via a lossless setts bitstream rewrite. That issue's own investigation found the false positive is caused by ffmpeg reconstructing DTS from PTS during any -f null verify decode (Matroska stores no real per-frame video DTS), which can legitimately look non-monotonic for ordinary content — not actual corruption.

For video-stream DTS, the fix was deliberately not extended (per PR #840: rewriting video timestamps with setts would reorder B-frames and isn't safe), so those files still fall through to the full remux → re-encode → HandBrake-fallback cascade, and since the post-repair re-verify hits the exact same false positive, RepairAndReVerify() never returns Clean and the repair is always discarded (RepairFailed, VerifyFailed), no matter how many times it's retried.

In our case this makes the re-encode tier's success rate on affected files effectively 0% — every file that reaches it is guaranteed to fail, after burning anywhere from tens of minutes to multiple days of CPU (observed: an 11+ hour repair on a 1080p WEB-DL file, and a ~4 day repair on a 12.6GB 4K HDR file, both discarded at the end).

Scope of reproduction

Confirmed via a 202-file sweep of our library (mixed sources/encodes — DVDRip XviD, WEB-DL x264/x265, BluRay), running PlexCleaner's own quickscan verify command standalone: 42 files (~21%) hit this, including:

  • A freshly-downloaded 4K Dolby Vision/HDR10+ WEB-DL release, never previously touched by any tool.
  • Multiple different DVDRip XviD TV releases from different release groups.
  • Multiple different WEB-DL x264/x265 releases from different release groups.
  • Two independently redownloaded copies of the same title from different release groups, both hitting it on first-ever verify.

This rules out "one bad download" or "one bad release group" as the cause — it's a broad false positive independent of source.

Additional finding: not B-frame-reordering-tunable

The original hypothesis (from #827 and DtsInfo.cs's own comment) is that this is caused by B-frame reordering during decode. We tested whether forcing zero B-frames during the re-encode (-bf 0) avoids the false positive at the source, on a file already confirmed to trigger it:

  • Encoded a 60s clip with -bf 0 (confirmed via x265's own log: bframes: 0).
  • Re-ran the exact verify command (ffmpeg -f null -) against that output.
  • The warning still fired (419 times), even though the output has zero B-frames.
  • Inspecting the stored container timestamps (ffprobe ... packet=pts,dts) on that same output showed them strictly increasing and completely normal (video track time_base=1/1000).

So the false positive is not solely a B-frame-reordering artifact — it reproduces even on B-frame-free output. This looks more consistent with a rounding/precision collision: at 23.976fps (24000/1001), ~41.708ms frame intervals don't divide evenly into whatever internal time_base the -f null muxer path negotiates, so two consecutive reconstructed timestamps occasionally round to the same integer and register as "non-monotonic" (equal, not decreasing). If that's correct, this isn't something an encoder setting can dodge — it may affect most/all 23.976fps content that goes through this verify path, not just B-frame-heavy content.

Ask

Given the video-DTS case can't reliably distinguish false positive from real corruption (per #827's own findings — most affected files play back perfectly), and per-title FileIgnoreList/disabling AutoRepair are the only current workarounds (both just suppress repair attempts rather than fix classification), would you consider one of:

  1. Reviving the original "Fix A" idea from Verify fails on non-monotonic DTS muxer warnings; re-encode repair never regenerates the timeline #827 (treat a DTS-only failure as non-fatal) specifically for the video-stream case, perhaps gated behind an opt-in flag given the risk tradeoff PR Scope setts to audio DTS and verify A/V sync in the repair gate #840 called out.
  2. Or, if there's a way to make the verify check itself more robust for this container/framerate combination (e.g. a different internal time_base, or an explicit tolerance for single-frame-duration collisions) — happy to help test any candidate change against our corpus of confirmed-affected files.

Happy to share the specific reproduction commands/files if useful.

Commandline.

/PlexCleaner/PlexCleaner --logfile /media/PlexCleaner/PlexCleaner-synology.log --logwarning process --quickscan --parallel --settingsfile /media/PlexCleaner/PlexCleaner.json --mediafiles "/media/TV Shows" --mediafiles "/media/Movies"

Relevant log output.

[null @ 0x55d2c06d4b80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 3 >= 3

...


VerifyFailed: SetLanguage, ReMuxed, RepairFailed, VerifyFailed, ClearedTags, SetFlags, ClearedDefaultFlags : "/media/Movies/CENSORED 1080p WEB-DL HEVC x265 5.1 BONE.mkv"

Settings file.

{
  "$schema": "https://raw.githubusercontent.com/ptr727/PlexCleaner/main/PlexCleaner.schema.json",
  "SchemaVersion": 4,
  "ToolsOptions": {
    "UseSystem": true,
    "RootPath": "",
    "RootRelative": false,
    "AutoUpdate": false
  },
  "ProcessOptions": {
    "FileIgnoreMasks": [
      "*.partial~",
      "*.nfo",
      "*.jpg",
      "*.srt",
      "*.smi",
      "*.ssa",
      "*.ass",
      "*.vtt"
    ],
    "KeepOriginalLanguage": true,
    "RemoveClosedCaptions": true,
    "SetIetfLanguageTags": true,
    "SetTrackFlags": true,
    "ReMuxExtensions": [
      ".avi",
      ".m2ts",
      ".ts",
      ".vob",
      ".mp4",
      ".m4v",
      ".asf",
      ".wmv"
    ],
    "ReEncodeVideo": [
      { "Format": "mpeg2video" },
      { "Format": "vc1" },
      { "Format": "wmv3" },
      { "Format": "msrle" },
      { "Format": "rawvideo" },
      { "Format": "indeo5" },
      { "Format": "h264", "Profile": "Constrained Baseline@30" },
      { "Format": "mpeg4", "Codec": "dx50" },
      { "Format": "msmpeg4v2", "Codec": "mp42" },
      { "Format": "msmpeg4v3", "Codec": "div3" }
    ],
    "ReEncodeAudioFormats": [
      "flac",
      "mp2",
      "vorbis",
      "wmapro",
      "opus",
      "wmav2",
      "adpcm_ms",
      "pcm_u8",
      "pcm_s16le",
      "dts",
      "eac3",
      "e-ac-3"
    ],
    "KeepLanguages": ["en", "bg", "bul", "tr"],
    "PreferredAudioFormats": [
      "truehd atmos",
      "truehd",
      "dts-hd master audio",
      "dts-hd high resolution audio",
      "dts",
      "e-ac-3",
      "ac-3"
    ],
    "DeleteEmptyFolders": true,
    "DeleteUnwantedExtensions": false,
    "ReMux": true,
    "DeInterlace": true,
    "ReEncode": true,
    "SetUnknownLanguage": true,
    "DefaultLanguage": "en",
    "RemoveUnwantedLanguageTracks": true,
    "RemoveDuplicateTracks": false,
    "RemoveTags": true,
    "UseSidecarFiles": true,
    "SidecarUpdateOnToolChange": true,
    "Verify": true,
    "RestoreFileTimestamp": true,
    "FileIgnoreList": []
  },
  "ConvertOptions": {
    "FfMpegOptions": {
      "Video": "libx265 -vtag hvc1 -crf 20 -preset medium",
      "Audio": "aac -af aformat=channel_layouts=7.1|5.1|stereo",
      "Global": "-analyzeduration 10000000 -probesize 100000000"
    },
    "HandBrakeOptions": {
      "Video": "x265 --quality 22 --encoder-preset medium",
      "Audio": "copy --audio-fallback aac"
    }
  },
  "VerifyOptions": {
    "AutoRepair": true,
    "DeleteInvalidFiles": false,
    "RegisterInvalidFiles": false,
    "MaximumBitrate": 100000000
  },
  "MonitorOptions": {
    "MonitorWaitTime": 60,
    "FileRetryWaitTime": 5,
    "FileRetryCount": 2
  }
}

Log file.

No response

Media file information.

MediaInfo : Video : Format: "MPEG-4 Visual", Codec: "V_MS/VFW/FOURCC / XVID", Language: "en", Ietf: "", Title: "", Flags: None, State: None, Errors: False, Tags: False, Profile: "Advanced Simple@5", Interlaced: False, HDR: "", CC: False, CoverArt: False, Id: 0, Number: 1, Uid: 10213689511535444494, Container: "Matroska"
MediaInfo : Audio : Format: "MPEG Audio", Codec: "A_MPEG/L3", Language: "en", Ietf: "", Title: "", Flags: None, State: None, Errors: False, Tags: False, Id: 1, Number: 2, Uid: 611197293070314248, Container: "Matroska"
MkvMerge : Video : Format: "MPEG-4p2", Codec: "V_MS/VFW/FOURCC", Language: "eng", Ietf: "en", Title: "", Flags: None, State: None, Errors: False, Tags: False, Profile: "", Interlaced: False, HDR: "", CC: False, CoverArt: False, Id: 0, Number: 1, Uid: 10213689511535444494, Container: "Matroska"
MkvMerge : Audio : Format: "MP3", Codec: "A_MPEG/L3", Language: "eng", Ietf: "en", Title: "", Flags: None, State: None, Errors: False, Tags: False, Id: 1, Number: 2, Uid: 611197293070314248, Container: "Matroska"
FfProbe : Video : Format: "mpeg4", Codec: "XVID", Language: "eng", Ietf: "", Title: "", Flags: None, State: None, Errors: False, Tags: False, Profile: "Advanced Simple Profile@5", Interlaced: False, HDR: "", CC: False, CoverArt: False, Id: 0, Number: 0, Uid: 0, Container: "matroska,webm"
FfProbe : Audio : Format: "mp3", Codec: "MP3 (MPEG audio layer 3)", Language: "eng", Ietf: "", Title: "", Flags: None, State: None, Errors: False, Tags: False, Id: 1, Number: 1, Uid: 0, Container: "matroska,webm"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions