Repository navigation
Conversation
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 Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
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 — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
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
Verification
Left for the maintainers
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. 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 Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green) 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 — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
| if runOpts.AudioOnly || runOpts.TargetCodecVideo == codecCopyV3 { | ||
| frameRate = 0 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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
frameandfps. When the frames encoded at the source's rate are further thanout_time, the reading uses them, capped at the duration, and the speed becomesfpsover the frame rate. Otherwise FFmpeg's own reading stands.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.docs/architecture/worker-http-protocol.mddescribes the field and the reading.Validation
gofmt,go vet, and the changed-package lint are clean.go testpasses forinternal/playback,internal/downloadprepare,internal/downloads, andinternal/transcodenode, and the new tests pass with-race.TestPrepareFileReadsFramesOnlyWhenEncodingVideodrivesPrepareFilewith 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.out_timeruns ahead of the video for this source, and the test passes onmaintoo.out_time. The remux kept the source timing, and frames over the rate reached 118 s whileout_timewas at 89 s, which is why remuxes now readout_time.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, at7146c2971onmainac54052c1, 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 howmainreads progress.main's reading)encoded_seconds=0.0 speed=0.00×16encoded_seconds=6.9 speed=0.00encoded_seconds=137.0 speed=16.10encoded_seconds=14.6 speed=14.58encoded_seconds=150.0 speed=15.90encoded_seconds=20.8 speed=13.85encoded_seconds=27.2 speed=13.60encoded_seconds=139.4 speed=15.28encoded_seconds=149.0 speed=15.48encoded_seconds=150.0 speed=15.57Risks
internal/playback, and it skips under-shortor withoutffmpegon the path. The Linux CI job doesn't install FFmpeg, so it most likely skips there.Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Fix download-prepare progress to read frames while a subtitle delays output time
SourceFrameRatetoplayback.TranscodeOptsand thedownloadprepare.Requesttransport 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.TargetCodecVideo=codecCopyV3) keep using output time for progress.prepareProgressWriterconsumers see frame-derived speed values in source-frame-rate units.Macroscope summarized 1de097c.