Skip to content

[bug] Generating seek previews reads most of each Matroska file #2476

Closed

Description

@Quick104

What happened

Generating seek previews (trickplay) reads most of each Matroska file to produce a few hundred small thumbnails. On a 107-minute 4K HEVC remux of 43 GB, main read 32 GB to make 645 thumbnails (measured in #2464). On hosts whose library sits on spinning disks, the preview queue keeps a disk busy for every file it processes and slows playback from that disk.

It happens on every Matroska file with keyframes more than a second or two apart, which is most of them.

Steps to reproduce

Reproduced with internal/mediasample and real ffmpeg 6.1, not on a deployment yet:

  1. Encode a 10-minute 720p clip in Matroska with H.264 video (keyframes about 10 s apart) and two 640 kb/s AC-3 audio tracks: 546 MB.
  2. Run a Sheets request over it at trickplay's default sample times, one every 10 s at the middle of each interval (60 samples).
  3. Read rchar and syscr from /proc/<pid>/io for each ffmpeg process the run starts.

The list run's ffmpeg reads 326 MB in 10,212 read calls, 60% of the file, to decode 60 keyframes.

Expected behavior

A seek-preview run reads each sample's keyframe and a short stretch after it, not everything between one keyframe and the sample time. Each thumbnail needs one keyframe, a few hundred kilobytes in a 4K file.

Silo version / commit

main at b0a417c.

Deployment

Local dev build. Not deployment-specific: every server and transcode node that generates seek previews does this.

Area

Performance. Seek previews (trickplay), internal/mediasample.

Clients affected

Other/not client-specific. No client changes; the cost is disk reads on the server or transcode node.

Relevant logs

No logs available; the run succeeds. The numbers above come from /proc/<pid>/io.

Technical notes

  • A Sheets list names the file once per sample, with inpoint at the sample time and -skip_frame nokey. The concat demuxer seeks to the keyframe before each inpoint and then reads every packet of every stream (video and all audio tracks) from that keyframe up to the inpoint, which the decoder then skips. With keyframes several seconds apart and samples 5 to 10 s apart, that covers most of the file.
  • Starting each Matroska entry at its keyframe instead, so the demuxer reads the keyframe and the entry's short span, cut bytes read by 37% to 59% on five real files in perf(trickplay): start Matroska list entries at their keyframes #2464 (closed), with the same cells published. That pull request also found the constraints a fix has to meet: MP4 entries that start exactly at a keyframe's time often seek past it; the HEVC decoder drops a keyframe sent twice in a row; and repeat detection in sheet_repair.go depends on the source times the list's entries produce.

AI harness

Claude Code (CLI), in T3 Code

AI tool(s)

Claude Code

AI model(s)

claude-opus-5-5

AI involvement

Fully AI-generated, human verified

Independent or adversarial review

n/a

Confirmations

  • I searched open and recently closed issues and pull requests, and this is not already reported
  • I reproduced this myself on a real deployment
  • Any logs provided are raw apart from marked redactions and are not AI-summarized; if none were available, I said so above

Activity

  1. added
    bug
    on Oct 14, 2026
  2. self-assigned this
    on Oct 14, 2026
  3. Quick104 commented on Oct 14, 2026

    @Quick104
    ContributorAuthor

    🤖 AI agent claim. Claude Code (claude-opus-5-5) is working on a fix for this issue on behalf of @Quick104, who is assigned.

    A pull request will link here when the fix is ready. If the work stops without a fix, the assignment and this comment are removed.

    Planning to work on this, or have context to add? Reply here and mention @Quick104.

  4. added
    priority: P2
    on Oct 14, 2026
  5. added a commit that references this issue on Oct 14, 2026
    8cad25c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugpriority: P2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions