Skip to content

DVD / MPEG-PS open always reads the full probe budget (50 MB / 60 s), and still misses late subtitle streams #651

Closed

Description

@superuser404notfound

Found while measuring #647.

What happens

Every open of a DVD title reads the full playback probe budget of DemuxerOpenProfile.playback (probesize 50 MB, max_analyze_duration 60 s) before the first frame. On a remote ISO that time is spent on the network, whether or not the source was warmed.

The cause is in libavformat. mpegps_read_header sets AVFMTCTX_NOHEADER (libavformat/mpeg.c), and nothing clears it again. mpegts does clear it once every program has its PMT. With the flag set, avformat_find_stream_info skips its "All info found" exit (libavformat/demux.c, the !(ic->ctx_flags & AVFMTCTX_NOHEADER) check), so it reads until probesize or max_analyze_duration runs out. This happens even after every stream has been resolved.

Measured

aetherctl play on a dvdauthor-built DVD ISO (49 MB, 60 s title), served by a logging range origin at 20 Mbit/s with 100 ms per response. The first frame appears at 29.6 s. About 28.5 s of that is one sequential sweep from the start of the VOB to the end of the image. Playback then starts again from the start of the VOB. A longer title stops at 50 MB or 60 s of content, whichever comes first.

The budget does not even buy what it is for

The long window exists so that late streams get discovered. On a DVD those are the subpicture streams, whose first packet arrives when the first subtitle is shown. A DVD whose VTS IFO declares two subpicture streams (en with its first packet at 20 s, de at 100 s) opens with only en listed. The 60 s window found the one and missed the other, and a commercial disc whose dialogue starts after the logos loses them all.

Direction

The VTS IFO already declares every audio and subpicture stream of the title set (DVDIFOParser, #527). mpegps looks streams up by AVStream.id before it creates one. So the declared subpicture streams can be created before find_stream_info, and the demuxer then routes their packets into those streams. Discovery then no longer depends on how much gets read. Once that holds, an IFO-described title can open with a small probe budget. Discs without a readable VTS IFO, and plain .mpg / .vob URLs, keep today's behaviour.

Activity

  1. added
    bug
    on Sep 26, 2026
  2. superuser404notfound commented on Sep 26, 2026

    @superuser404notfound
    OwnerAuthor

    Fixed on main in #652 (merge 22043b86). The fix ships in the next release.

    • The subpicture streams declared in a title's VTS IFO are now created before find_stream_info. mpegps routes packets to an existing stream by id.
    • libavformat attaches its dvdsub parser only to streams the demuxer created itself. The engine therefore joins each subpicture's PES fragments itself, using the same rule as dvdsub_parser.c.
    • A title with a readable IFO now probes 8 MB / 5 s instead of 50 MB / 60 s. Discs without a readable VTS IFO, and plain .mpg / .vob URLs, keep the old budget.

    On the test disc (20 Mbit/s, 100 ms per response), the first frame now appears at 6.5 s instead of 29.6 s, and at 0.5 s with a prewarm (#647). The de subtitle, whose first packet is at 100 s, is listed as a track from the open. Its 8 KB unit, split across several packets, decodes.

  3. superuser404notfound commented on Sep 26, 2026

    @superuser404notfound
    OwnerAuthor

    Released in 7.18.0 (da2b4504).

  4. superuser404notfound commented on Sep 26, 2026

    @superuser404notfound
    OwnerAuthor

    Verified with disc images on 7.18.0 using aetherctl. The ISOs were built with dvdauthor and hdiutil makehybrid, and each was tested local and over HTTP:

    • A DVD without subtitles, served by a 20 Mbit/s origin with 100 ms per response: the first frame appears at 6.5 s instead of 29.6 s, and at 0.54 s with a prewarm.
    • A DVD whose IFO declares en (first packet at 20 s) and de (first packet at 100 s, an 8 KB unit spread over several packets): both tracks are listed from the open, and --subs de publishes the cue at 100.53 s.
    • A DVD with one large multi-packet subtitle: it decodes the same cue as 7.17.1.

    Closing. If a commercial DVD rip shows a missing or undecodable subtitle track, please reopen.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions