Skip to content

Mixed Audio and Post-Decode Video DTS Still Re-Encodes #1061

Closed

Description

@ptr727

Problem

The timestamp repair ladder decides "post-decode only" from the demux packet analysis as a whole. A file can carry two independent timestamp defects:

  • a demux-visible non-monotonic DTS on an audio stream, which setts can repair losslessly;
  • a genuine repeated timestamp in the decoded video, which no demux analysis sees, because Matroska video carries no packet DTS.

For such a file the ladder runs as follows:

  1. Verify reports TimestampOnly.
  2. DtsInfo.NonMonotonicIsAudioOnly is true, so setts rewrites the audio. Re-verify still fails on the video, and the rewrite is discarded.
  3. The remux tier fails for the same reason.
  4. DtsInfo.IsPostDecodeOnly is false because the audio stream is flagged, so RepairAndReVerify continues to the ffmpeg re-encode.
  5. The re-encode passes re-verify only because the Matroska output drops the video frames whose timestamps collide.

That is the outcome the post-decode-only remux stop exists to prevent. The behavior matches develop before #1060, so it is not a regression. It needs both defects in one file.

Constructed reproduction

  • Video: H.264 with B-frames, so the demuxer exposes no video DTS, muxed with an mkvmerge v2 timestamps file that repeats one frame timestamp.
  • Audio: an AAC track muxed with one duplicated packet timestamp, so the demux analysis flags it.

Options

  • Treat the remainder as post-decode when every flagged demux stream is audio and setts did not make the file verify clean, and skip the re-encode. The cost is that a re-encode can no longer fix a residual audio decode problem that setts cannot.
  • Scope DtsInfo to the streams verify actually decodes, which are the default video and audio streams.
  • Leave it as is, and accept the dropped frames for this rare combination.

Activity

  1. added
    enhancement
    on Oct 29, 2026
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions