You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(scanner): stop embedded fonts from inflating MKV bitrates - #4642
MKV releases with many large embedded fonts are stored with a bitrate up to about twice the real one, so Silo sends them to transcode for bandwidth on clients that could direct play them. Matroska has no bitrate field, so FFmpeg derives the file's bit rate from its size and duration, and that counts the attached fonts. Fonts are read once when the file opens and are never streamed. This change stops new scans from counting attachments and corrects the files already in the library once.
Silo uses the stored rate for every play-method decision (native API and jellycompat), so correcting it fixes both surfaces.
Approach
Scans: the scanner subtracts the size of attachment streams (ffprobe's extradata_size) over the file's duration before storing the container bitrate. Files without attachments keep the same rate.
Existing rows: rescans skip unchanged files, so a new scheduled task, "Correct Bitrate of Files with Embedded Fonts" (backfill_attachment_bitrate), corrects them. It re-reads the format and stream entries of present MKV files with ASS or SSA subtitles, the releases that embed fonts. It writes only the bitrate column, and only over the row exactly as it read it. It runs at startup and daily under an advisory lock, so one node reads media across a cluster.
Progress: progress lives in a one-row table, attachment_bitrate_backfill_state. A restart or a stop on stalled storage resumes from a cursor. Files the task could not read, such as those under an offline library root, go on a list that later runs read again, so they are not skipped for good. Only timeouts count toward the stalled-storage stop, as in the HDR10+ backfill. A stall lists the whole batch it stopped in and moves past it. The retry list keeps its own position, so a root whose reads keep hanging holds up neither the walk nor the files listed after it. Once the walk is finished and the list is empty, a run is a single query.
The HDR10+ backfill and this one now share the stored-mtime normalizer.
Focused Go tests for internal/scanner, internal/taskmanager/..., internal/mediaprobe and internal/backup: pass. The two new database tests also pass through make test-db-contracts against a disposable pgvector database. The only other entries the contracts run reports are database tests that skip because this machine has no pg_dump/pg_restore.
make lint-changed, make verify-migrations, make verify-local-paths, make verify-size-ratchet: pass.
The web typecheck (tsc -b) passes after the locale sync.
make test-web was not run, because this change touches no web code beyond the generated locales.
Evidence
No screen changes. What changes is the stored bitrate that the play-method decision reads. I checked it with a synthetic file, "H264 MoreFonts (2018)": 60 s of 1080p H.264 at about 4 Mbps plus AAC audio, an ASS track, and six 5 MB font attachments. The probe ran through the scanner's ProbeFile at main and at this branch:
same encode without attachments (ffprobe format bit_rate): 4171 kbps
main (975bbf41b): bitrate_kbps=8360 duration_s=60
branch (6e4b01220): bitrate_kbps=4169 duration_s=60
A client with a 6 Mbps limit transcodes this file on main and can direct play it on this branch.
The backfill's database tests cover these cases:
It corrects font-heavy rows.
It leaves non-candidates (SRT-only, MP4, missing) and rows changed on disk alone.
Nine fast read failures in a row (an offline root) neither stop the pass nor drop out of it, and those files are corrected once they can be read.
It resumes after a stall without re-reading finished batches.
A list of slow files that stalls while being read again keeps its unread entries and still lets the walk correct the files after the cursor.
Risks
Migration: one new table, attachment_bitrate_backfill_state, classified as server state for backups.
First run: the task reads the header of every present MKV with ASS or SSA subtitles once, four at a time, with the scan probe's 2-minute timeout per file. FFmpeg loads every attachment when it opens a Matroska file, so each read covers the file's whole font payload. On large anime libraries over network storage this adds read load for a while after the upgrade.
Hung storage: a run stops after 8 timeouts in a row, so a hung root with many candidates is passed one batch (200 files) per run, about one batch a day.
Catalog seed imports: rows a seed import inserts have no stored mtime, so the next scan reprobes them and stores the corrected rate. A seed import that overwrites existing rows from an export made before this change keeps the export's rate until the file changes.
Lasting read failures: a file that keeps failing to read (permission denied, a root that stays offline) stays on the list. Each daily run reads it again and the task message reports it, until it can be read or stops being a candidate.
Rolling upgrades: a node still on the old version that scans new files while upgraded nodes finish the task stores the old, inflated rate for those files. That needs new font-heavy imports during the upgrade window.
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
Tool(s): Claude Code; Codex CLI (review only)
Model(s): claude-opus-5-5 (implementation and review); gpt-6.2-sol, gpt-6.2-astra (Codex CLI review); Claude Fable 5.2 (review)
Involvement: Fully AI-generated, human verified
Adversarial review: four rounds of four independent reviewers (gpt-6.2-sol, gpt-6.2-astra, claude-opus-5-5, Claude Fable 5.2) covering correctness, repo standards and spec. Fixed: unreadable files were skipped for good, or an offline root blocked the pass; slow listed files blocked the walk; a root that keeps stalling blocked the walk and the retry list after it (also raised by Kody and CodeRabbit); retry progress was saved only at the end; the pending count was missing on early exits; the task text had no catalog entry. Dismissed, with reasons: restore of a pre-fix backup (the state table restores with the data), updated_at on the correction (same as the other backfills), and probe depth beyond the header (kept identical to a scan's probe so both store the same rate).
Note
Fix scanner to exclude embedded MKV attachments from stored bitrates
MKV files with attached fonts (e.g. ASS/SSA subtitle tracks) stored inflated bitrates because ffprobe's format bitrate includes attachment payload bytes. Adds a shared formatBitrateKbps helper in probe.go that subtracts attachment data, and adds a resumable backfill in attachment_bitrate_backfill.go that re-probes eligible MKV files and corrects their stored bitrate.
The backfill runs as a startup/daily task with a cluster advisory lock, a persisted cursor, retry handling for unreadable files, and a stop after repeated probe timeouts; progress is stored in a new attachment_bitrate_backfill_state table (migration)
Updates are guarded: a row is corrected only if its size, normalized mtime, and prior bitrate still match the values loaded for the pass
Adds DB contract tests for the backfill plus an ffmpeg/ffprobe integration test comparing files with and without an attached font
Behavioral Change: convertProbeData now subtracts attachment bytes from ProbeData.Bitrate; mediaprobe.Stream gains an ExtradataSize field
FFmpeg derives a Matroska file's bit_rate from its size and duration, so
attached fonts counted as streamed data. A fansub release carrying 90 MB
of fonts was stored at twice its real rate, which pushed it past client
bandwidth and server bitrate caps onto a transcode (a burn-in transcode
with ASS subtitles selected).
The probe now subtracts the attachment streams' bytes (reported as
extradata_size) over the format duration before storing the rate.
Rescans skip unchanged files, so MKV files scanned before attachments
were left out of the bitrate keep a rate up to twice their real one and
keep falling off direct play.
A one-off library task re-reads the header (format and stream entries,
no packets) of present MKV files with ASS or SSA subtitles, the releases
that embed fonts, and writes the attachment-free rate over the row
exactly as it was read. The stored probe keeps neither the format
bitrate nor attachment sizes, so it cannot be recomputed in the
database.
attachment_bitrate_backfill_state holds a resume cursor and marks the
pass done, so it runs once per deployment. It runs at startup and daily
under an advisory lock, so one node reads media; a run of failed or
timed-out reads stops the pass and rewinds the cursor to where the
failures began.
Files the pass could not read went past the cursor and the pass then
recorded itself finished, so a brief storage drop left them with the
inflated rate for good. Eight fast failures in a row, such as files under
an offline library root, stopped every run at the same place instead.
The state row now lists the files a run could not read, and each later
run reads them again before walking on, saving after each batch. Only
timeouts count toward the stalled-storage stop, as in the HDR10+
backfill. A stall while re-reading the list keeps the rest listed and
still lets the walk continue, so one slow root does not hold up the
others. The pass is done once the walk is finished and the list is
empty; the task message says how many files are left.
No actionable comments were generated in the recent review.
Walkthrough
The change adjusts bitrate conversion to account for Matroska attachment payloads and adds a persisted, retryable backfill for eligible MKV files. A scheduled task runs the pass, and tests cover candidate selection, update conditions, retries, storage stalls, and attachment bitrate calculations.
Stream now exposes FFprobe’s extradata_size. Bitrate conversion estimates and subtracts attachment bitrate when duration and stream data permit. Tests check bitrate conversion with and without attachments and with a missing format bitrate.
A singleton table stores the cursor, retry IDs, and completion state. The runner probes eligible MKV files and updates bitrate only when the candidate still matches the stored row. Unreadable and timed-out files remain pending for later runs. Tests cover selection, retries, storage stalls, and font-attached files. HDR10Plus and Matroska track backfills now use a shared stored-modification-time normalizer.
Task scheduling and application registration internal/taskmanager/tasks/backfill_attachment_bitrate.go, cmd/silo/main.go
The task runs at startup and every 24 hours, uses an optional cluster lock, and reports progress and results. The application registers it when a file repository is available.
sequenceDiagram
participant TaskManager
participant BackfillAttachmentBitrateTask
participant AttachmentBitrateBackfiller
participant PostgreSQL
participant FFprobe
TaskManager->>BackfillAttachmentBitrateTask: Execute scheduled task
BackfillAttachmentBitrateTask->>PostgreSQL: Acquire advisory lock
BackfillAttachmentBitrateTask->>AttachmentBitrateBackfiller: Run with progress callback
AttachmentBitrateBackfiller->>PostgreSQL: Load cursor, retry IDs, and candidates
AttachmentBitrateBackfiller->>FFprobe: Probe candidate file
FFprobe-->>AttachmentBitrateBackfiller: Return format and stream data
AttachmentBitrateBackfiller->>PostgreSQL: Conditionally update bitrate and save progress
AttachmentBitrateBackfiller-->>BackfillAttachmentBitrateTask: Return result and progress
BackfillAttachmentBitrateTask-->>TaskManager: Report task result
Loading
Suggested reviewers:quick104
Merge Risk: Low · up to baf06
This change stops embedded fonts in MKV files from inflating stored bitrates, and backfills existing files at startup and daily. A known low-impact inefficiency remains: while a storage root is hung, a few extra probes repeat each run. No blocking defects were found, so it is reasonable to merge with owner awareness of that cost.
Security architecture risk: Minimal · up to baf06
Existing files are corrected through guarded updates and resumable progress. The inspected change did not establish a material new security, recovery or ownership risk.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The scheduled pass can read eligible media across the shared catalog using the server's existing filesystem privileges and update their bitrate metadata. Its scope is not limited to the account manually starting it, but the inspected invocation route retains the existing administrative classification.
Security Findings and Attack Paths
inferred — File-controlled content gains an additional scheduled path into ffprobe, but the inspected path does not introduce request-supplied executable selection, shell construction or unrestricted database writes. No introduced exploitable boundary bypass was established by this review.
Trust Boundaries and Controls
observed — The task acquires a cluster advisory lock before invoking the worker and defers release. The shared lock implementation retains a dedicated connection and destroys it if unlocking cannot be confirmed, including when the caller's execution context has already been cancelled.
Resilience and Maintainability Implications
observed — Failure containment includes four probe workers, batches of 200, per-probe deadlines, cancellation checks and stopping after eight consecutive timeouts. Timed-out and unreadable files remain eligible for later retry; probe rejections are deliberately terminal for this repair pass.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(scanner): stop embedded fonts from inflating MKV bitrates" matches the main change. The PR subtracts attachment payload size from the stored container bitrate for MKV files with embedde…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description is specific to the changeset. It explains that MKV files with large embedded fonts store inflated bitrates because FFmpeg counts attachment bytes. It states that the scanner now subtra…
Full details: Title check
Explanation
The title "fix(scanner): stop embedded fonts from inflating MKV bitrates" matches the main change. The PR subtracts attachment payload size from the stored container bitrate for MKV files with embedded fonts, and adds a backfill to correct existing rows. The title is short, specific, and uses the conventional prefix. It does not mention the backfill task or the migration, but the summary of the main change is accurate.
Full details: Description check
Explanation
The description is specific to the changeset. It explains that MKV files with large embedded fonts store inflated bitrates because FFmpeg counts attachment bytes. It states that the scanner now subtracts attachment size from the stored bitrate. It describes the new backfill task, the attachment_bitrate_backfill_state migration, the retry and timeout behavior, the test coverage, and the risks. The description matches the code changes in probe.go, the backfill files, the migration, and the task manager files.
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: 7a85ba57-2271-4636-8513-ade827a77584
Commits
Reviewing files that changed from the base of the PR and between 19c75a4 and baf0680.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Data Integrity & Integration · Quick win
Pin a published catalog release before merge.
.silo-translations pins local-09c5150fe2b5. The sync script refuses to sync from a local-* pin, so the recorded version cannot be re-synced. AGENTS.md requires .silo-translations to name a published release, not local-<commit>, before the client pull request merges.
After the catalog change has a release, run scripts/sync-translations --version <release> and commit the regenerated locale files with .silo-translations. The release catalog must contain the new keys. scripts/sync-translations --version silently drops keys that the catalog lacks, so check the regenerated output for every new key before merge.
The reason will be displayed to describe this comment to others. Learn more.
Yes. silo-translations#111 carries these keys. Once it merges and publishes a release, this branch gets re-synced with --version <release> before merge, and I'll check the new keys are in the output. Leaving this open until then.
The reason will be displayed to describe this comment to others. Learn more.
🤖 Claude Code (claude-opus-5-5)
Settled by the merge of main in d7964be. silo-translations#111 merged, and main's .silo-translations already pins the published release 2026.11.22-d00fa90, which carries web.admin.tasks.task.backfill_attachment_bitrate.name and .description. The branch takes main's generated files and pin unchanged, so it no longer has a local-* pin or any locale diff of its own.
The reason will be displayed to describe this comment to others. Learn more.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
A stall left the walk's cursor and the retry list where they were, so a
root whose reads kept timing out was read first on every run and blocked
every file after it, in the walk and on the list.
A stall now lists the whole batch it stopped in and moves past it. The
retry list keeps its own position, retry_after_id, and wraps around from
there, so each run reaches files listed after the stalled ones.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
Main's catalog pin, 2026.11.22-d00fa90, already carries the task's two
keys from silo-translations#111, so the generated locale files take
main's copies.
… limit
FFmpeg loads every Matroska attachment when it opens the file, so the
backfill's "header read" of a font-heavy release reads the whole font
payload: 84 MB of an 85 MB test file. Its 30 s limit, a quarter of the
scan probe's, timed out on slow mounts where a scan reads the same file
fine, and eight such files in a row stopped the pass as stalled storage.
It now uses the scan probe's limit and the scan's timeout sentinel.
The listed files also get their own candidate statement. Shared with the
walk as "$4 IS NULL OR id = ANY($4)", the query moved to a generic plan
after a few walk batches, and that plan filtered every row after the
cursor to find a handful of listed IDs (302 ms over 400k rows, against
0.3 ms with the ID list as an index condition).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ite on the path
A retry pass dropped every listed file in the ID range it covered, not
only the ones it started from. When a run on another server takes the
lock after this one lost its session, a file that run lists while this
one is still pruning was dropped unread, and the pass could finish with
its inflated rate stored. Pruning now drops only files in the list the
run started from.
The bitrate write also requires the row's path to still be the one the
pass read: a relink keeps a row's ID, size, mtime and bitrate while
moving it to a new path, and a different file could sit at the old one.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🤖 Claude Code (claude-opus-5-5)
Review of 19c75a4, with main merged in. The scanner fix is right, and the backfill's shape holds up: a finished pass costs one single-row read. Four findings below, each verified and each fixed in a commit I'm pushing to this branch. Two cleanups ride along in the same commits: the backfill reuses the scanner's existing errProbeTimeout sentinel instead of declaring a second one, and the Matroska track backfill now uses the shared normalizedStoredModifiedAt too, so this PR's refactor covers both backfills.
I'll post a summary comment with the merge from main, the catalog pin, validation and scores once the fixes are pushed.
Reviewed head: baf0680 (19c75a4 with main merged in and three fix commits).
The scanner change is correct, and it fixes the stored rate for both the native API and jellycompat, because every play-method path reads media_files.bitrate. The backfill follows the pattern of the HDR10+ and Matroska track backfills, and a finished pass costs one single-row read. I considered adding these files to NeedsCriticalProbeRepair with a probe-date cutoff instead. That would run a full blocking reprobe, fonts included, before the first play of every older ASS MKV, so the dedicated pass is the better shape.
What changed on the branch
Merged main (d7964be). Only generated locale files conflicted. silo-translations#111 is merged, and main's pin, 2026.11.22-d00fa90, already has both task keys, so the branch takes main's locale files and no longer carries a local-* pin.
Header-read timeout (99620fe). FFmpeg loads every Matroska attachment when it opens the file, so the backfill's read covers the whole font payload: 84.2 MB of an 85.4 MB test file. The read now gets the scan probe's 2-minute limit instead of 30 s, and it reuses the scanner's errProbeTimeout.
Retry candidate query (99620fe). The listed files get their own statement. Under the generic plan Postgres switches to after a few walk batches, the shared statement filtered every row after the cursor to find a few listed IDs: 302 ms on 400k seeded rows, against 0.3 ms.
Retry prune and row guard (baf0680). Pruning drops only IDs from the list the run started from, so a file another server lists after this run loses its lock session stays listed. The bitrate write also checks file_path, so a relink can't take another file's rate.
Matroska track backfill (b9abdf3) now uses the shared normalizedStoredModifiedAt too.
Each finding has its own thread with the evidence.
Tests
TestConvertProbeDataExcludesAttachmentsFromBitrate fails on main and passes here. The backfill tests drive code this PR adds, so they can't fail on main, and they pass against a freshly migrated database along with the HDR10+ and Matroska track backfill tests. make lint-changed reports no issues. I checked the retry-prune fix with a temporary test that fails on 19c75a4 and passes on baf0680, and left it uncommitted.
ci / Go DB pins failed on 19c75a4 in TestBeforeMigrateBackupOnAnOldSchemaDB ("1 other clients are connected" during a restore). That test runs none of this PR's code, so I treat it as unrelated. It passed on the new head.
ci / Go vet and contracts fails on baf0680, as it has on main and on every other branch since about 06:00 UTC today. The route inventory check can't load packages from the runner's Go build cache (cache entry not found), and the same check passes locally on this tree. The cause is the vet job's Go build cache overflowing its tmpfs, and #5112 fixes it in the setup-go action. PRs run the actions from their own head, so this branch needs main merged once #5112 lands before vet can pass.
Other feedback
The CodeRabbit pin thread is settled by the merge. I replied there.
The author's replies to the other bot threads hold up: missing files are excluded, old-version writes after the pass are disclosed, subtitle_tracks is always an array, and a stalled batch is re-listed whole.
Not changed, for the maintainers: keeping the retry list in its own table would make the daily retry work scale with the list rather than its square while a large root is offline. I left the array because the cost stays small (about 16 MB of WAL a day at 20k listed files) and only lasts while a root is offline. Cover art that ffprobe reports as a picture stream still counts toward the rate, but a typical cover adds only a few kbps.
Pre-existing, not this PR's: with database.max_connections=1, a task holding the cluster advisory lock holds the only pool connection, and its next query waits forever. That applies to every task using advisoryClusterLock, and this PR adds one more. fix(taskmanager): hold cluster task locks on their own database session #5110 fixes it for all of them by giving the lock its own database session.
Remaining risks
The PR body's Risks section is updated. It now names the 2-minute read limit and covers catalog seed imports: rows a seed import inserts have no stored mtime, so the next scan reprobes them. Rows a seed overwrites from a pre-fix export keep that export's rate until the file changes.
Validated features
No passed case on the v1.0 board covers playback method selection, bitrate limits, scheduled tasks, or MKV scanning. The nearest, Distributed transcode nodes and Autoscan, share no code with this diff. Validation tasks: none holds.
User manual and other clients
The manual is unaffected: it already says a Maximum bitrate below a file's bitrate makes Silo convert it, and this change only makes the stored rate accurate. It doesn't list the backfill tasks. No client change is needed, and jellycompat reads the same column.
Fixed: the retry prune and the path guard (Sol), on top of the timeout and query fixes. Answered: a bandwidth cap applies to the media rate, not the bytes a full direct-play download sends (Sol); the retry-list table and the scan's own probe (Opus, see above); the seed import, which the next scan covers (Gemini). No second round, because nothing substantive remained.
Verdict
Fit: 8/10 · Readiness: 9/10 — conditional (assuming CI is green)
Fit: it fixes needless transcoding for a common kind of release at the boundary where the rate is computed, and it follows the existing backfill pattern. It holds at 8 because a one-off correction adds a scheduled task, a state table and about 500 lines of resumable-pass code. That cost is justified, since rescans skip unchanged files. Readiness: no substantive concern remains. The fix is shown by a test that fails on main, and the validation board check ran.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workingimpact: playbackCan't play, stalls, or wrong mediapriority: P2Limited scope, workaround exists, or polishsize/XXL1000–2999 added + deleted lines (all files); change volume, not priority.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: N/A
Validation tasks: none
Other clients: N/A (server-side playback decision; clients need no change)
Pairs with the other fixes from the same report (ASS subtitles on an MKV with many large embedded fonts): #4639, #4640, #4641, Silo-Server/silo-android#1010, Silo-Server/silo-android#1011, Silo-Server/silo-android#1012, Silo-Server/silo-android#1013, Silo-Server/silo-apple#1237, Silo-Server/AetherEngine#30. Catalog text: Silo-Server/silo-translations#111.
MKV releases with many large embedded fonts are stored with a bitrate up to about twice the real one, so Silo sends them to transcode for bandwidth on clients that could direct play them. Matroska has no bitrate field, so FFmpeg derives the file's bit rate from its size and duration, and that counts the attached fonts. Fonts are read once when the file opens and are never streamed. This change stops new scans from counting attachments and corrects the files already in the library once.
Silo uses the stored rate for every play-method decision (native API and jellycompat), so correcting it fixes both surfaces.
Approach
extradata_size) over the file's duration before storing the container bitrate. Files without attachments keep the same rate.backfill_attachment_bitrate), corrects them. It re-reads the format and stream entries of present MKV files with ASS or SSA subtitles, the releases that embed fonts. It writes only thebitratecolumn, and only over the row exactly as it read it. It runs at startup and daily under an advisory lock, so one node reads media across a cluster.attachment_bitrate_backfill_state. A restart or a stop on stalled storage resumes from a cursor. Files the task could not read, such as those under an offline library root, go on a list that later runs read again, so they are not skipped for good. Only timeouts count toward the stalled-storage stop, as in the HDR10+ backfill. A stall lists the whole batch it stopped in and moves past it. The retry list keeps its own position, so a root whose reads keep hanging holds up neither the walk nor the files listed after it. Once the walk is finished and the list is empty, a run is a single query.2026.11.22-d00fa90) already carries both keys, so this branch changes no generated locale files.Validation
internal/scanner,internal/taskmanager/...,internal/mediaprobeandinternal/backup: pass. The two new database tests also pass throughmake test-db-contractsagainst a disposable pgvector database. The only other entries the contracts run reports are database tests that skip because this machine has nopg_dump/pg_restore.make lint-changed,make verify-migrations,make verify-local-paths,make verify-size-ratchet: pass.tsc -b) passes after the locale sync.make test-webwas not run, because this change touches no web code beyond the generated locales.Evidence
No screen changes. What changes is the stored bitrate that the play-method decision reads. I checked it with a synthetic file, "H264 MoreFonts (2018)": 60 s of 1080p H.264 at about 4 Mbps plus AAC audio, an ASS track, and six 5 MB font attachments. The probe ran through the scanner's
ProbeFileatmainand at this branch:A client with a 6 Mbps limit transcodes this file on
mainand can direct play it on this branch.The backfill's database tests cover these cases:
Risks
attachment_bitrate_backfill_state, classified as server state for backups.Checklist
AI Disclosure
updated_aton the correction (same as the other backfills), and probe depth beyond the header (kept identical to a scan's probe so both store the same rate).Note
Fix scanner to exclude embedded MKV attachments from stored bitrates
MKV files with attached fonts (e.g. ASS/SSA subtitle tracks) stored inflated bitrates because ffprobe's format bitrate includes attachment payload bytes. Adds a shared
formatBitrateKbpshelper in probe.go that subtracts attachment data, and adds a resumable backfill in attachment_bitrate_backfill.go that re-probes eligible MKV files and corrects their stored bitrate.attachment_bitrate_backfill_statetable (migration)convertProbeDatanow subtracts attachment bytes fromProbeData.Bitrate;mediaprobe.Streamgains anExtradataSizefieldMacroscope summarized 19c75a4.