Skip to content

fix(downloads): read prepare progress from frames while a subtitle waits - #4054

Merged
Quick104 merged 4 commits into
Silo-Server:mainfrom
rangoDJ:fix/prepare-progress-sparse-subtitles-3495
Nov 13, 2026
Merged

Quick104 merged 4 commits into
Silo-Server:mainfrom
rangoDJ:fix/prepare-progress-sparse-subtitles-3495

Conversation

@rangoDJ

@rangoDJ rangoDJ commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #3495
Related issue: N/A
Validation tasks: none

Other clients: Apple N/A (shows the API's progress reading, which keeps its shape); Android N/A (same); Roku N/A (same)

While a download is being prepared, its progress can sit at 0 s for minutes, jump far ahead, and stall again, with the speed falling on every poll. The encode runs normally the whole time. It happens when the source has a sparse text subtitle, such as a forced track with a few cues, which is common in films. Admins see it in the preparations list, and clients show it as download preparation progress.

FFmpeg's out_time, and the speed it derives from it, wait for every output stream. A prepared download maps every text subtitle, so a track with no cue yet holds both at its last cue, or at 0 before its first, while the video and audio are already written. With FFmpeg 8.1.3-Jellyfin, a 150-second source whose forced track has one cue at 140 s reported 0 s until that cue, then 137 s.

This PR has no dependencies and can merge in any order.

Credit: @Joloxx9 reported #3495, worked out the root cause, and wrote the first fix in #3496, which this PR replaces.

Approach

  • The source video's frame rate now goes into the prepare options, both on the API server and in the request a transcode node receives. A prepared file keeps the source's frame rate, since its encode applies no frame-rate filter.
  • The progress reader also reads FFmpeg's frame and fps. When the frames encoded at the source's rate are further than out_time, the reading uses them, capped at the duration, and the speed becomes fps over the frame rate. Otherwise FFmpeg's own reading stands.
  • Audio-only files, remuxes that copy the video, files whose probe has no frame rate, and nodes that don't receive the rate keep reading out_time. A copied stream keeps the source's own timing, which the probed average rate can misstate: on a variable-rate MKV whose stored rate understates the real average, the frames read 100% with about a quarter of the remux left.
  • The frame rate changes no bytes, so the execution fingerprint leaves it out. An older node that drops the field still returns the matching fingerprint. docs/architecture/worker-http-protocol.md describes the field and the reading.

Validation

  • gofmt, go vet, and the changed-package lint are clean.
  • go test passes for internal/playback, internal/downloadprepare, internal/downloads, and internal/transcodenode, and the new tests pass with -race.
  • The new tests cover the reader with FFmpeg's stalled readings (including the duration cap and the audio-only case), a real FFmpeg prepare of a source with a sparse forced track, and the frame rate reaching a node without changing the fingerprint. With the frame reading turned off, the reader test and the FFmpeg test fail; the FFmpeg test failed 3 of 3 runs without the change and passed 3 of 3 with it.
  • TestPrepareFileReadsFramesOnlyWhenEncodingVideo drives PrepareFile with a scripted FFmpeg, so it doesn't depend on the FFmpeg version. Its remux case failed on 6c6cdd8, before the remux change, reading 62.5 s from frames instead of FFmpeg's 30 s.
  • The FFmpeg test only tells fixed from unfixed code on FFmpeg 8.x. With FFmpeg 9.0.1, out_time runs ahead of the video for this source, and the test passes on main too.
  • A variable-rate MKV (60 s at 15 fps, then 60 s at 30 fps; stored rate 15) with jellyfin-ffmpeg 8.1.3: the MP4 encode came out at a constant rate, and frames over the rate matched out_time. The remux kept the source timing, and frames over the rate reached 118 s while out_time was at 89 s, which is why remuxes now read out_time.
  • Not run: a prepare on a transcode node, a hardware encoder, and the full make test-go.

Evidence

No visible layout change: the progress fields keep their shape, and their values now follow the encode. The evidence is the readings and test results.

Steps: on WSL2 (Ubuntu, go1.26.4 linux/amd64) with FFmpeg 8.1.3-Jellyfin, at 7146c2971 on main ac54052c1, the new FFmpeg test prepares a 150-second 24 fps H.264/AAC source with a dense subtitle track and a forced track whose only cue is at 140 s, the way a prepared download maps them (mov_text, H.264 -preset medium). Each line is one reading the progress sink received, about every half second. "Before" is the same run with the frame reading turned off, which is how main reads progress.

Before (main's reading) After (this PR)
encoded_seconds=0.0 speed=0.00 ×16 encoded_seconds=6.9 speed=0.00
encoded_seconds=137.0 speed=16.10 encoded_seconds=14.6 speed=14.58
encoded_seconds=150.0 speed=15.90 encoded_seconds=20.8 speed=13.85
encoded_seconds=27.2 speed=13.60
… one reading every 6–9 s of content …
encoded_seconds=139.4 speed=15.28
encoded_seconds=149.0 speed=15.48
encoded_seconds=150.0 speed=15.57
$ go test -count=1 -race -run 'TestPrepareProgressWriter|TestFileFrameRate|TestPrepareFileProgressRisesBeforeASparseSubtitleCue|TestPrepareFileReportsProgress' ./internal/playback/
ok  	github.com/Silo-Server/silo-server/internal/playback	13.530s

$ go test -count=1 ./internal/playback/ ./internal/downloadprepare/ ./internal/downloads/ ./internal/transcodenode/
ok  	github.com/Silo-Server/silo-server/internal/playback	122.108s
ok  	github.com/Silo-Server/silo-server/internal/downloadprepare	0.338s
ok  	github.com/Silo-Server/silo-server/internal/downloads	8.806s
ok  	github.com/Silo-Server/silo-server/internal/transcodenode	4.465s

Risks

  • A source whose stored frame rate is wrong would report the wrong progress, and it could run ahead of the encode until FFmpeg's own time catches up. The reading is capped at the duration, and a frame rate of 0 or one that isn't a number keeps FFmpeg's reading.
  • The new FFmpeg test adds about 12 s to internal/playback, and it skips under -short or without ffmpeg on the path. The Linux CI job doesn't install FFmpeg, so it most likely skips there.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or how I checked a change nobody sees.

AI Disclosure

  • Harness: Claude Code (Claude desktop app, Code tab)
  • Tool(s): Claude Code; GitHub CLI
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: a maintainer-run review (T3 Code, claude-opus-5-5, with a cross-provider round on gpt-6.1-sol) found the remux case; its fix is commit 1de097c on this branch.

🤖 Generated with Claude Code

Note

Fix download-prepare progress to read frames while a subtitle delays output time

  • When a sparse subtitle stream holds back FFmpeg output time, prepared-download progress now uses the encoded frame count divided by the source frame rate. The frame-derived value is used only when it exceeds output time, is capped at the known duration, and speed is reported as FFmpeg fps divided by the source frame rate. See prepare_progress.go.
  • Adds SourceFrameRate to playback.TranscodeOpts and the downloadprepare.Request transport struct, populated from the first video track's frame rate. It is excluded from the execution fingerprint, and older nodes ignore it. See transport.go and transcode.go.
  • Audio-only preparations and copied-video remuxes (TargetCodecVideo = codecCopyV3) keep using output time for progress.
  • Documents the new field in the worker HTTP protocol and OpenAPI schema: worker-http-protocol.md, openapi.json.
  • Behavioral Change: progress readings during video encodes can now advance further than before; prepareProgressWriter consumers see frame-derived speed values in source-frame-rate units.

Macroscope summarized 1de097c.

FFmpeg's out_time, and the speed it derives from it, wait for every
output stream. A prepared download maps every text subtitle, so a sparse
one, such as a forced track with a few cues, held the reading at 0 until
its first cue and then at each later one, while the encode ran on. The
admin preparations list showed 0 s for minutes, a jump, and a falling
speed.

The source video's frame rate now travels with the prepare options, to a
node too. The progress reader takes the frames encoded at that rate when
that is further than out_time, capped at the duration, and the speed
from FFmpeg's frames per second. Audio-only files, and nodes that don't
receive the rate, keep reading out_time. The rate changes no bytes, so
the execution fingerprint leaves it out.

Closes Silo-Server#3495

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Nov 13, 2026
@silo-kody

silo-kody Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Download preparation now passes the source frame rate through worker transcode options. When FFmpeg’s reported out_time lags, progress reporting can derive encoded time from frame count and frame rate.

Changes: Download preparation progress

Layer / File(s) Summary
Carry source frame rate to workers
internal/playback/transcode.go, internal/downloads/artifacts.go, internal/downloadprepare/transport.go, internal/downloadprepare/transport_test.go, contracts/api/v2/openapi.json, docs/architecture/worker-http-protocol.md
Transcode options and worker requests carry the source frame rate. The execution fingerprint excludes it, and tests verify transport and fingerprint behavior. The OpenAPI schema and protocol documentation describe the field.
Calculate progress from FFmpeg frames
internal/playback/prepare_progress.go, internal/playback/prepare_file.go, internal/playback/prepare_progress_test.go, docs/architecture/worker-http-protocol.md
The progress writer parses frame and FPS readings. When frame-derived time exceeds out_time, it updates encoded time and may update speed. Tests cover frame-rate fallbacks and progress during a sparse-subtitle encode. The protocol documentation describes the progress fields.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant ArtifactManager
  participant NewRequest
  participant Request
  participant TranscodeOpts
  participant PrepareFile
  participant prepareProgressWriter
  ArtifactManager->>NewRequest: Pass transcode options with source frame rate
  NewRequest->>Request: Copy source frame rate
  Request->>TranscodeOpts: Restore source frame rate
  PrepareFile->>prepareProgressWriter: Pass source frame rate and duration
  prepareProgressWriter->>prepareProgressWriter: Derive encoded time from frames when it exceeds out_time
Loading

Suggested reviewers: rhainland

Merge Risk: Minimal · up to 6c6cd

This change makes download preparation progress advance during encodes when a sparse subtitle stalls FFmpeg's time reading. Existing behavior is kept when no usable frame rate is available. No merge-blocking risk was identified.

Security architecture risk: Minimal · up to 6c6cd

The added frame-rate value affects progress reporting only. The reviewed changes preserve authentication, artifact identity, and completion controls; no material security risk was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Influence from the newly propagated media metadata is confined to preparation progress and speed reporting in the traced production flow. It does not select an input path, change encoding arguments, grant privileges, or alter artifact identity.

Trust Boundaries and Controls

  • observed — The existing prepare and progress routes remain behind node-signature verification. Preparation still checks artifact identifiers and invokes input-path approval before executing FFmpeg. These controls predate the PR and are unchanged by the new reporting field.

Resilience and Maintainability Implications

  • observed — Reported completion does not authorize artifact publication. The existing path waits for process success, synchronizes and renames the partial output, validates the prepared result, and applies an owner-fenced readiness transition. Failures, cancellation, lease loss, retry, and rejected commits retain their existing cleanup or recovery branches independently of progress values.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix (reading download-prepare progress from frame counts) and the trigger (a subtitle waiting on a cue). Both match the changeset: the progress writer now derives encoded time from…
Linked Issues check Passed Issue #3495 requires download-preparation encoded_seconds to rise with the encode, and speed to reflect the encode rate, when a sparse embedded text subtitle holds FFmpeg's out_time.

The review…
Out of Scope Changes check Passed Each changed area supports the progress objective of #3495:
- internal/playback/prepare_progress.go and prepare_file.go: frame-based progress reading and the FileFrameRate helper.
- `internal/pl…
Description check Passed The description is specific and related to the changeset. It explains the problem (prepared-download progress stalling when a sparse text subtitle holds back FFmpeg's out_time), the approach (passing …
Full details: Title check

Explanation

The title names the fix (reading download-prepare progress from frame counts) and the trigger (a subtitle waiting on a cue). Both match the changeset: the progress writer now derives encoded time from frame/fps when FFmpeg's out_time lags, and the sparse subtitle case is the motivating scenario in the PR and linked issue #3495. The title is specific and concise, though it omits the source frame-rate plumbing through the transport request.

Full details: Linked Issues check

Explanation

Issue #3495 requires download-preparation encoded_seconds to rise with the encode, and speed to reflect the encode rate, when a sparse embedded text subtitle holds FFmpeg's out_time.

The reviewed head implements this in internal/playback/prepare_progress.go, which was read at head:

  • The writer parses FFmpeg's frame and fps values.
  • byFrames computes encoded time as frames / frameRate, caps it at the duration, and uses it only when it is ahead of out_time.
  • When it is used and fps &gt; 0, speed becomes fps / frameRate. Otherwise FFmpeg's reading stands.
  • FileFrameRate returns zero for nil, audio-only, or video-free files, and for invalid rates. In those cases the reader keeps out_time.

The frame rate reaches the prepare path through internal/downloads/artifacts.go, internal/playback/prepare_file.go, internal/playback/transcode.go, and internal/downloadprepare/transport.go. These paths come from the whole-PR summary and the previous assessment. The incremental diff since the previous reviewed head could not be read, so these paths were not re-read at head.

The reader test and the FFmpeg-backed sparse-subtitle test are described in the PR as failing without the frame reading and passing with it. Those results come from the PR author. They were not re-run.

Uncertainty: the issue reproduction used QSV hardware encoding on a node. The PR does not run a prepare on a transcode node, so the node path is verified by transport and reader tests only.

Full details: Out of Scope Changes check

Explanation

Each changed area supports the progress objective of #3495:

  • internal/playback/prepare_progress.go and prepare_file.go: frame-based progress reading and the FileFrameRate helper.
  • internal/playback/transcode.go: the SourceFrameRate option. The FastStart field change is formatting only.
  • internal/downloads/artifacts.go: passes the frame rate into prepare options.
  • internal/downloadprepare/transport.go and its test: transport of the field, and exclusion from ExecutionFingerprint. The PR states that the frame rate changes no output bytes.
  • contracts/api/v2/openapi.json and docs/architecture/worker-http-protocol.md: document the new optional field and the progress reading.
  • Tests in prepare_progress_test.go and transport_test.go: cover the new behavior.

No unrelated refactoring or feature work appears in the summary. The incremental changes since the previous reviewed head could not be read, so this verdict relies on the whole-PR summary and the previously reviewed diff.

Full details: Description check

Explanation

The description is specific and related to the changeset. It explains the problem (prepared-download progress stalling when a sparse text subtitle holds back FFmpeg's out_time), the approach (passing the source frame rate through prepare options and the transcode-node request, and deriving progress from frame and fps counts), the fingerprint exclusion, the validation performed, and the risks. This matches the files changed: transport.go, transcode.go, prepare_progress.go, prepare_file.go, artifacts.go, the OpenAPI schema, and the protocol docs.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4e37d807-d53a-4154-be28-4f22a3409f60
Commits

Reviewing files that changed from the base of the PR and between 6236c74 and 6c6cdd8.

Files selected for processing: 2

  • internal/playback/prepare_progress.go
  • internal/playback/prepare_progress_test.go
Files skipped from review as they are similar to previous changes: 1

  • internal/playback/prepare_progress.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread internal/playback/prepare_progress.go Resolved
@silo-triage silo-triage Bot added bug Something isn't working impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish labels Nov 13, 2026
rangoDJ and others added 2 commits November 12, 2026 22:31
The node prepare request is part of the generated document, so its new
source_frame_rate field goes there too (make apiv2-openapi).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The frame reading divides frames by the file's average frame rate, so on
variable-rate video it is the share of frames encoded, not of time. A
file with 90% of its frames in the first half reads 90% at the half.
The new case pins that down, and that the reading stays below the
duration until the last frame and gives way to out_time once out_time
is further. The byFrames comment now says so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 4 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Preserve optional store capabilities through production wrappers
  • Detach mandatory cleanup from request cancellation and bound its lifetime
  • Preserve durable media identity and share identity-evidence precedence
  • Bound decoder throughput trades and share direct-play eligibility

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of 6c6cdd8. One finding, inline. The summary comment has the verification and the comparison with #3496.

🤖 T3 Code (claude-opus-5-5)

Comment thread internal/playback/prepare_file.go Resolved
@Quick104

Quick104 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Review summary (head 1de097c)

This fixes #3495. The maintainers chose it over #3496, which takes the same approach and is now closed as its duplicate. The remux finding from my first review (6c6cdd8) is fixed on this branch in 1de097c.

Addressed

  • Remux progress: a copied video stream keeps the source's own timing, which the probed average rate can misstate. On a variable-rate MKV whose stored rate understates the real average, the frame reading hit 100% with about a quarter of the remux left. PrepareFile now passes no frame rate when the video is copied, so a remux reads out_time alone. TestPrepareFileReadsFramesOnlyWhenEncodingVideo drives PrepareFile with a scripted FFmpeg, so it doesn't depend on the FFmpeg version. Its remux case failed on 6c6cdd8 and passes on 1de097c. docs/architecture/worker-http-protocol.md says the same.
  • The FFmpeg test now says in its comment that only FFmpeg 8.x tells fixed from unfixed code with it.
  • The PR body credits the author of fix(downloads): measure preparation progress by encoded video frames #3496 for the report, the root-cause analysis and the first fix.

Verification

  • Reproduced on main with jellyfin-ffmpeg 8.1.3 (the version the Dockerfile pins), through the real PrepareFile, using this PR's sparse-subtitle fixture without the frame rate: 11 readings at encoded_seconds=0.0, then 150. On this branch, with the frame rate, readings rose steadily from 12.8 s to 150 s at about 27x. Raw -progress output shows the mechanism: frame= went from 302 to 3036 while out_time_us stayed at 0.
  • Variable frame rate with 8.1.3: the MP4 encode came out at a constant rate, and frames over the rate matched out_time to within 0.1 s. Only the remux ran ahead, and that path now reads out_time.
  • On 1de097c: the focused tests for internal/playback, internal/downloadprepare, internal/downloads and internal/transcodenode pass, and make lint-changed reports 0 issues. One internal/playback test that needs a macOS font file fails on that host on main too.
  • Mixed versions: an older node ignores source_frame_rate (the request decoder accepts unknown fields), and the fingerprint clears it, so results match whichever side is older. The openapi.json change matches the generator's output.
  • The evidence page still matches: it shows the encode path, which 1de097c doesn't change.

Left for the maintainers

  • Nothing blocking. Not run by anyone: a prepare on a transcode node or a hardware encoder. The FFmpeg test most likely skips in Linux CI, which doesn't install FFmpeg.

Validated features: none reached. No passed 1.0 case asserts preparation progress values; the downloads cases check the finished file. I read the Validation-labelled issues directly because the board isn't readable from this account. Validation tasks: none is right.

User manual: unaffected. The download storage page doesn't describe preparation progress.

Other clients: N/A is right. The apps and the web admin render progress and remaining_seconds, whose shape doesn't change, and jellycompat has no prepare progress.

Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)
Fit: a bounded fix to a core download flow. It adds one optional field to the internal node protocol, which older nodes ignore. Readiness: the reported case is fixed and shown with the FFmpeg Silo ships, against main. The remux regression is fixed, with a test that failed before the fix.

Code review ran at high effort, with three finders and a validation check. A cross-provider round (Codex, gpt-6.1-sol) covered 6c6cdd8 and raised the remux case. 1de097c applies the one-line repair from that finding, so no second round ran.

🤖 T3 Code (claude-opus-5-5)

A copied video stream keeps the source's own timing, and the probed
average frame rate can misstate it. On a variable-rate MKV whose stored
rate understates the real average, frames over that rate read past the
duration with about a quarter of the remux left, so clients showed 100%
and no time remaining. Only an encode, which FFmpeg writes at a constant
rate, now reads progress from frames.

Note on the FFmpeg test that only FFmpeg 8.x tells fixed from unfixed
code with it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Comment on lines +410 to +411
if runOpts.AudioOnly || runOpts.TargetCodecVideo == codecCopyV3 {
frameRate = 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

Sparse subtitles stall progress again for video-copy remuxes

FFmpeg 8 can hold out_time at zero until the first subtitle cue, even while the remux is processing. Preserve an independent video progress signal when runOpts.TargetCodecVideo is codecCopyV3.

Prompt for LLM
File internal/playback/prepare_file.go, lines 410-411:

Sparse subtitles stall progress again for video-copy remuxes

Remuxes with copied video and a sparse subtitle now rely solely on `out_time`, which FFmpeg 8 can hold at zero until the first subtitle cue even while the job is processing. Preserve an independent video progress signal for copy-video jobs rather than disabling the fallback for every remux.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a known trade-off, made on purpose in 1de097c. For copied video the frame reading isn't a reliable signal: the copied stream keeps the source's own timing, and the stored rate is ffprobe's avg_frame_rate, which for an MKV can understate the real average. In Quick104's run (60 s at 15 fps, then 60 s at 30 fps, stored as 15/1), frame / 15 reached the duration with a quarter of the remux left, so clients showed 100% and remaining_seconds 0. Unlike the sparse-subtitle stall, that was a regression against main for remuxes without a subtitle.

So a remux reads out_time alone, as on main. With a sparse subtitle it can still sit at 0 until the cue. Remuxes are the fast path, so that stall is short, and a reading that stays low is safer than one that says done early. -progress has no per-stream timestamp to use instead. Its total_size is the output's size in bytes, which tracks progress only when every stream is copied, so it isn't added here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That trade-off makes sense. My suggestion overlooked that frame count divided by the probed average rate can make a variable-frame-rate remux appear complete too early.

I withdraw the suggestion to use that fallback for copied video. Keeping out_time preserves existing behavior, even though sparse subtitles can still cause progress to stall. A reliable independent signal could be considered separately if one becomes available.

@Quick104
Quick104 merged commit cbb392e into Silo-Server:main Nov 13, 2026
24 of 25 checks passed
@rangoDJ
rangoDJ deleted the fix/prepare-progress-sparse-subtitles-3495 branch November 15, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish size/L 200–499 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Download preparation progress stays at 0 s, then jumps and stalls, when the source has a sparse subtitle track

2 participants