Skip to content

Guard ReEncode and DeInterlace Against Repeating on Every Run #1076

Closed

Description

@ptr727

Behavior

ProcessFile.ReEncode() warns "Reencoding already reencoded media" when ReEncoded is set, then re-encodes anyway. ProcessFile.DeInterlace() does the same with "Deinterlacing already deinterlaced media". When the output still matches the selection, the file is re-encoded on every run.

The output can still match in these cases:

  • the encoder output matches an entry in ReEncodeVideo or ReEncodeAudioFormats
  • the deinterlaced output keeps an interlaced metadata flag that any of the three tools reads

Reproduction shape

  1. Configure ReEncodeVideo with an entry that also matches the configured FfMpeg output codec.
  2. Process the same file twice. It is re-encoded both times.

Expected

A file whose flag is already set is not converted again for the same reason, or the step fails the file so the loop is visible.

Found while drawing the process command diagrams, ARCHITECTURE.md "Process Command Logic", suspect branch S9.

Activity

  1. added
    bug
    pre-existing
    on Oct 29, 2026
  2. ptr727 commented on Oct 31, 2026

    @ptr727
    OwnerAuthor

    Decision from the maintainer (2026-10-30): on the automatic process path only (conditional), skip ReEncode() or DeInterlace() when ReEncoded or DeInterlaced is already set, and log a warning naming the tracks that still match. The explicit reencode and deinterlace commands still force a conversion.

  3. ptr727 commented on Oct 31, 2026

    @ptr727
    OwnerAuthor

    Claim (backlog burndown round 3, fixed together with #1076 and #1078): branch feature/1076-1078-reencode-bitrate, files PlexCleaner/ProcessFile.cs, new PlexCleanerTests/ReEncodeBitrateStateTests.cs. HISTORY.md and the Suspect Branches prose in ARCHITECTURE.md are deferred to one final docs pull request. A diagram edit the CI diagram test requires goes in this pull request, with ARCHITECTURE.md held by one live group at a time.

  4. ptr727 commented on Oct 31, 2026

    @ptr727
    OwnerAuthor

    Claim update (orchestrator adjudication, 2026-10-31): branch feature/1076-1078-reencode-bitrate now also holds PlexCleanerTests/FakeTools.cs, add-only (a WriteSampleToolData helper and a defaulted state parameter on CopyUnverifiedSample). The other call sites are left to #1124.

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

    bugpre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions