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(downloads): keep audio-only media off the video transcode - #3488
Closes#3486
Related issue: N/A
Validation tasks: none (#1168 and #1254 cover downloads and audiobooks but have no passed cases yet)
Downloading an audiobook fails whenever the client sends its capabilities. An Original request is planned as a 20 Mbps H.264 transcode, and ffmpeg can't produce it. With cover art, the encode maps the cover as the video stream and the MP4 muxer refuses H.264 for it (Could not find tag for codec h264 in stream #0). Without cover art there is no video stream to map at all (Stream map '' matches no streams). Either way the preparation fails all three attempts, and every bitrate preset fails the same way. Without caps the same file downloads fine. This hits audiobooks and podcasts (both beta) on any client that sends caps.
The cause is playback.Resolve, which only downloads use. It checks the file's video codec against the client's video codecs. An audio-only file has no video codec, so the check never matches and the decision falls through to a full transcode.
Approach
Resolve now treats audio-only media (MediaFile.IsAudioOnly, which also covers older rows that recorded the cover as an MJPEG video track) as having no video to decide on, and skips the resolution ceiling for it, as the v3 source descriptor already does for streaming. An audiobook downloads as the original when the device plays its audio and container, and as a remux with the audio converted to AAC when it doesn't. Converting an audiobook's audio is its transcode, so with transcoding off a book whose audio the device can't decode is served as it is, which is what happened before this change. A book that only needs a new container still remuxes, as a video file does, but only when the remux copies its audio: MP4 can't hold FLAC, so a FLAC book is served as it is rather than encoded.
Bitrate presets are video bitrate classes, so on audio-only media a preset serves the source the same way. The row keeps the requested quality with effective_qualityoriginal, as it already does when a video source fits a preset.
The remux has to work whatever the book's cover is: missing, or in a format MP4 can't hold (a GIF cover fails with Could not find tag for codec gif), and scans no longer record the cover's format. So the prepare options carry a new AudioOnly flag, set from the file and sent in the prepare request a remote node receives, and an audio-only prepared file maps no video at all, in both layouts. Clients show the server's artwork, as they do when streaming it. Streaming never sets it. Video files keep a required video map and an unchanged execution fingerprint. The served-quality check also stops comparing an older row's recorded cover resolution with the video quality ceiling, which would otherwise refuse a book (or its direct file) that serves no video. docs/downloads-api.md describes the audio-only rules.
jellycompat's /Items/{id}/Download only serves originals through ServeDirect and never reaches this resolver, so it needs no change. This is server-side download planning, so the Apple and Android clients need no follow-up.
Validation
Resolve table rows:
audio-only AAC/MP4 with the issue's caps plays direct;
a legacy MJPEG-cover row with unsupported audio remuxes with an audio transcode;
with transcoding off, audio-only media needing audio conversion, or FLAC that MP4 can't hold, falls to direct, and one needing only a new container with copyable audio remuxes.
Download resolver rows: a 5 Mbps preset on an audiobook serves the source, and an audiobook whose older probe stored a 2160p cover passes a 1080p ceiling.
Prepare argument test: an audio-only remux maps no video in either layout, while a video file keeps 0:v:0.
Prepare request test: AudioOnly survives the trip to a node and changes the execution fingerprint.
The resolver and preset rows fail on main.
go test ./internal/downloads/ ./internal/downloadprepare/: pass.
go test ./internal/playback/: everything this touches passes. 30 hardware-probe tests (the VideoToolbox, NVENC, QSV and VA-API probe fakes) fail on my Mac. The ones I reran on main fail there the same way, so CI's Linux run is the one to trust for them.
I ran real servers built from main (6aa6791e) and from this branch (88af1c2f; the later commits change only the transcode-off rule, the contract file and docs), each on a fresh database, and followed the issue's steps. The library held a synthetic two-second audiobook, an M4B with AAC stereo and an MJPEG attached_pic cover, a FLAC with no picture, or an MP3 with a GIF attached_pic cover. Downloads were enabled and the requests used the issue's caps (h264 / aac / mp4, m4b / 1080p).
Request
main
This branch
M4B with cover, original
transcode at 20mbps (H.264 1080p); failed 3 of 3 with the muxer error
original; file 200 audio/mp4, identical to the source
M4B with cover, 5mbps
transcode (H.264 1080p); failed
original, quality5mbps kept; file identical to the source
FLAC, no cover, original
transcode at 20mbps; failed 3 of 3, Stream map '' matches no streams
remux, ready; file is AAC stereo, 2.0 s, no video stream
MP3 with GIF cover, original
transcode at 20mbps; failed 3 of 3 with the muxer error
remux, ready; file is AAC stereo, 2.0 s, no video stream
Response excerpts, trimmed to the changed fields (GET /api/v2/downloads row, then GET /api/v2/admin/downloads/preparations), for the M4B original request:
main (6aa6791e):
{"quality": "original", "effective_quality": "20mbps", "delivery_format": "transcode", "target_bitrate_kbps": 141, "status": "failed"}
{"state": "failed", "format": "transcode", "output": {"container": "mp4", "video_codec": "h264", "audio_codec": "aac", "resolution": "1080p"}, "attempts": 3, "max_attempts": 3,
"error": "exit status 234 (stderr: [mp4 @ …] Could not find tag for codec h264 in stream #0, codec not currently supported in container"}
This branch (88af1c2f):
{"quality": "original", "effective_quality": "original", "delivery_format": "original", "target_bitrate_kbps": 0, "status": "queued"}
GET /api/v2/downloads/{id}/file: 200, Content-Type audio/mp4, 35275 bytes, SHA-256 identical to the source
{"quality": "original", "effective_quality": "original", "delivery_format": "remux", "target_bitrate_kbps": 0, "status": "ready"}
GET /api/v2/downloads/{id}/file: 200, 49439 bytes; ffprobe: one aac stream, 2 channels, 44100 Hz, duration 2.000000, no video
Risks
Only downloads call playback.Resolve, and the new rules apply only when IsAudioOnly is true, which needs an audiobook or podcast base type with audio and no non-image video track. Video downloads are unchanged.
An audio-only artifact's execution fingerprint now includes audio_only, so a remote node older than this change can't return a matching result for one and the job retries elsewhere. Those prepares failed before anyway.
A coverless remux is served as video/mp4, like every prepared MP4. I left the content type alone.
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 says there is none.
AI Disclosure
Harness: Claude Code
Tool(s): Claude Code, GitHub CLI
Model(s): claude-opus-5-5
Involvement: AI-assisted. AI-assisted with Claude Opus. I directed the task and designed the work.
Adversarial review: a separate Claude Code agent (claude-opus-5-5) reviewed the diff read-only. It traced every caller of playback.Resolve, the preset and bulk paths, the policy gates and the IsAudioOnly classification, and checked the prepare arguments against real ffmpeg. It found that a coverless audiobook's remux still failed on the required video map, and that with transcoding off such a download would now be refused instead of served. Both are fixed here, and the coverless case is in the evidence. Its low-severity note about stale cover resolutions on older rows, which CodeRabbit also raised, is fixed too.
Note
Keep audio-only media off the video transcode path in downloads and playback
Audio-only files requested at a bitrate preset now deliver through the source-delivery path instead of a video transcode, and original requests use a shared sourceMethod helper (see policy.go)
Adds AudioOnly to playback.TranscodeOpts and downloadprepare.Request, so prepared downloads omit the embedded cover-art video stream from ffmpeg stream mapping (transcode.go, transport.go)
playback.Resolve treats audio-only media as video-compatible, and when transcoding is disabled falls back to direct delivery for unsupported audio or an audio-encoding remux; container-only remux remains allowed (resolver.go)
Quality checks now use servedQuality (empty video quality for audio-only files), so a recorded cover-art resolution like 2160p no longer fails an original download under a 1080p ceiling
Documents audio-only delivery behavior in downloads-api.md and adds an optional audio_only flag to the OpenAPI schema
Risk: downloadprepare.Request.audio_only is part of the executor contract; older nodes will produce a different execution fingerprint for requests carrying it. Also check appendPreparedVideoMap in bitmap-burn-in branches, which keep the original video mapping
A download of an audiobook or podcast with cover art, from a client that
sends capabilities, was planned as an H.264 transcode. playback.Resolve
compared the file's empty video codec against the client's video codecs,
found no match, and chose a full transcode. The encode then mapped the
cover as the video stream and the MP4 muxer refused H.264 for it, so the
preparation failed on every attempt. A bitrate preset failed the same way,
because the video ladder had no video track to fit.
Resolve now treats audio-only media as having no video to decide on, as the
v3 source descriptor already does for streaming, and skips the resolution
ceiling for it. A bitrate preset on audio-only media serves the source,
remuxed when the device cannot take it as it is.
ClosesSilo-Server#3486
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Audio-only media now bypasses video-specific playback checks. Audio-only downloads retain source quality and select a delivery method based on client capabilities. Download preparation carries an audio-only flag and can omit video mapping.
Audio-only media bypasses video codec and resolution checks. Tests cover direct play, audio remux, and direct play when transcoding is disabled, including FLAC conversion cases.
Audio-only media with bitrate presets uses source quality and the source delivery method. Original-quality requests use sourceMethod. Quality checks use served quality. Tests and API guidance describe requested and effective quality.
Download preparation sets and transports AudioOnly. Prepared-track arguments omit video mapping for audio-only media and retain it for other media. The OpenAPI schema adds the optional audio_only property. Tests cover transport, fingerprint, and mapping behavior.
sequenceDiagram
participant Client
participant DownloadPolicy
participant PlaybackResolver
participant DownloadPreparation
Client->>DownloadPolicy: Request audio-only download with capabilities
DownloadPolicy->>PlaybackResolver: Resolve source delivery method
PlaybackResolver-->>DownloadPolicy: Return play, remux, or transcode method
DownloadPolicy->>DownloadPreparation: Pass AudioOnly and delivery options
DownloadPreparation-->>Client: Prepare audio without video mapping
Loading
Possibly related issues
Silo-Server/silo-server#2861: This PR handles legacy audio-only records with misleading video metadata during playback resolution, but does not change catalog classification or re-probing.
Silo-Server/silo-server#3175: This PR changes audio-only resolution when audio or container conversion is needed, but does not add byte-range support for converted output.
Possibly related PRs
Silo-Server/silo-server#3328: PR #3328 routes Audiobookshelf downloads through the downloads service, whose audio-only quality and preparation paths change here.
Suggested labels:documentation, api-v2
Suggested reviewers:quick104
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly and concisely identifies the main change: preventing audio-only downloads from entering the video transcode pipeline.
Description check
The description directly explains the audio-only download problem, implementation changes, validation, evidence, and risks. It is fully related to the changeset.
Linked Issues check
[#3486] The change prevents an Original AAC audiobook with MP4/M4B and client capabilities from entering the H.264 video transcode path. playback.Resolve accepts the audio-only source path, and down…
Out of Scope Changes check
The changes stay within the audio-only download fix for [#3486]. Resolver policy, legacy cover handling, transcoding-disabled behavior, transport propagation, preparation mapping, tests, API schema, a…
Docstring Coverage
Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Full details: Linked Issues check
Explanation
[#3486] The change prevents an Original AAC audiobook with MP4/M4B and client capabilities from entering the H.264 video transcode path. playback.Resolve accepts the audio-only source path, and download preparation sets AudioOnly so it omits video mapping, including attached cover art. Tests cover resolution, stale cover metadata, preparation mapping, and transport. The reported validation shows a byte-identical source download with HTTP 200.
Full details: Out of Scope Changes check
Explanation
The changes stay within the audio-only download fix for [#3486]. Resolver policy, legacy cover handling, transcoding-disabled behavior, transport propagation, preparation mapping, tests, API schema, and documentation support the required download behavior. Video mapping remains unchanged for video files. No unrelated product or client changes are included.
Full details: Docstring Coverage
Explanation
Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 11 functions across 11 files. (1 skipped: 1 unsupported.)
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Audio-only downloads change from a failed transcode to a successful source download, and bitrate presets now resolve to the source (internal/playback/resolver.go, internal/downloads/policy.go). The Evidence table summarizes these outcomes but does not include before-and-after API response excerpts for the same request. Please add trimmed excerpts showing the changed download resolution and result; the table already identifies the test media and commits. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
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: ac5da324-0f22-48b5-82b8-adb52f01d237
Commits
Reviewing files that changed from the base of the PR and between 6aa6791 and 7c5dba4.
Files selected for processing: 5
docs/downloads-api.md
internal/downloads/policy.go
internal/downloads/policy_test.go
internal/playback/resolver.go
internal/playback/resolver_test.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.
An audiobook or podcast without cover art has no video stream, but the
prepared-file remux always mapped 0:v:0, so ffmpeg refused it whenever the
download needed its audio converted or its container changed.
The prepared-track plan now carries AudioOnly, set from the file, and maps
video as optional for it. Video files still require their video stream, and
their plans and execution fingerprints are unchanged.
An audiobook whose scan recorded no audio track inventory prepares through
the legacy stream layout, which still mapped 0:v:0, so a coverless file kept
failing. AudioOnly now lives on the prepare options and the node request
rather than the track plan, and both layouts map video as optional for it.
With transcoding off, audio-only media that needs its audio or container
converted is served as it is again, as it was before it skipped the video
decision, instead of being queued for a remux.
The new no-cover-art remux path (internal/downloadprepare/transport.go, internal/playback/prepare_tracks.go, internal/playback/transcode.go) changes a failed download into an audio-only MP4, but the Evidence section says this case is not covered and its comparison uses only attached-cover media. Please add before-and-after API/result evidence for a no-cover audio file that requires conversion or remuxing, and update the linked evidence page and description to include it. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.
An older probe recorded an audiobook's cover as a video track and stored its
resolution, so a 2160p cover met the account's or policy's video quality
ceiling and refused the download, or the direct file, of a book that serves
no video. The served-quality check now sees no video quality for audio-only
media.
…ding off
A container-only remux copies the audio, so it is no transcode. With
transcoding off, only audio-only media whose audio the client cannot decode
is now served as it is; a source that only needs a new container remuxes, as
a video file already does.
silo-triageBot
added
size/L
200–499 added + deleted lines (all files); change volume, not priority.
and removed
size/M
50–199 added + deleted lines (all files); change volume, not priority.
labels
Nov 4, 2026
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 settingsReview 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
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
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: 89fd1dd5-8bab-48c8-b367-53429a3d01d2
Commits
Reviewing files that changed from the base of the PR and between 7c5dba4 and 71f3b7a.
Files selected for processing: 9
docs/downloads-api.md
internal/downloadprepare/transport.go
internal/downloadprepare/transport_test.go
internal/downloads/artifacts.go
internal/playback/prepare_tracks.go
internal/playback/prepare_tracks_test.go
internal/playback/resolver.go
internal/playback/resolver_test.go
internal/playback/transcode.go
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
A remux copied an audiobook's cover into the MP4, which refuses some cover
formats (a GIF or BMP cover fails with "Could not find tag for codec gif"),
so those prepares still failed. Scans no longer record the cover's format,
so an audio-only prepared file now maps no video at all, as streaming
already drops it; clients show the server's artwork.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
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: dd95d767-e106-4153-973a-ad2a89fd5b12
Commits
Reviewing files that changed from the base of the PR and between 71f3b7a and 88af1c2.
Files selected for processing: 10
docs/downloads-api.md
internal/downloadprepare/transport.go
internal/downloadprepare/transport_test.go
internal/downloads/policy.go
internal/downloads/policy_action_test.go
internal/playback/prepare_tracks.go
internal/playback/prepare_tracks_test.go
internal/playback/resolver.go
internal/playback/resolver_test.go
internal/playback/transcode.go
Files skipped from review as they are similar to previous changes: 2
internal/downloadprepare/transport_test.go
internal/downloadprepare/transport.go
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
…ng off
MP4 cannot hold FLAC, so a container-only remux of a FLAC audiobook encodes
its audio to AAC. With transcoding off, audio-only media now remuxes only
when the remux copies its audio, and is otherwise served as it is.
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 settingsReview 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
coderabbitaiBot
added
the
api-v2
API v2 / Huma migration program (epic #135); long-running, stacked by phase
label
Nov 4, 2026
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Prevent audio conversion in disabled-transcoding audio-only downloads. · resolver.go:175-188
internal/playback/resolver.go:175-188 Minor · Functional Correctness · Quick win
Prevent audio conversion in disabled-transcoding audio-only downloads.
An audio-only source with a copyable AAC primary track and a non-copyable FLAC secondary track can select PlayRemux when download transcoding is disabled. The prepared "copy" plan then converts the secondary track to AAC. Make the download policy reject this remux path unless every audio track in the prepared plan is copyable. Keep this check in the download policy, not the general streaming resolver, because streaming remuxes operate on the selected audio track.
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: 4fb21571-fc69-42b3-a8b4-ab3c8ce57e10
Commits
Reviewing files that changed from the base of the PR and between 1719405 and 5abb80c.
Files selected for processing: 3
docs/downloads-api.md
internal/playback/resolver.go
internal/playback/resolver_test.go
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
…nscoding off
The transcode-off check only looked at the primary codec, so a book with a
copyable AAC track and a FLAC second track still remuxed and encoded the
FLAC track. It now asks the prepared-track plan whether any track would be
encoded.
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
api-v2API v2 / Huma migration program (epic #135); long-running, stacked by phasebugSomething isn't workingdocumentationImprovements or additions to documentationgoPull requests that update go codeimpact: usabilityCore flow broken or severely blockedpriority: P2Limited scope, workaround exists, or polishsize/L200–499 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
Closes #3486
Related issue: N/A
Validation tasks: none (#1168 and #1254 cover downloads and audiobooks but have no passed cases yet)
Downloading an audiobook fails whenever the client sends its capabilities. An Original request is planned as a 20 Mbps H.264 transcode, and ffmpeg can't produce it. With cover art, the encode maps the cover as the video stream and the MP4 muxer refuses H.264 for it (
Could not find tag for codec h264 in stream #0). Without cover art there is no video stream to map at all (Stream map '' matches no streams). Either way the preparation fails all three attempts, and every bitrate preset fails the same way. Withoutcapsthe same file downloads fine. This hits audiobooks and podcasts (both beta) on any client that sends caps.The cause is
playback.Resolve, which only downloads use. It checks the file's video codec against the client's video codecs. An audio-only file has no video codec, so the check never matches and the decision falls through to a full transcode.Approach
Resolvenow treats audio-only media (MediaFile.IsAudioOnly, which also covers older rows that recorded the cover as an MJPEG video track) as having no video to decide on, and skips the resolution ceiling for it, as the v3 source descriptor already does for streaming. An audiobook downloads as the original when the device plays its audio and container, and as a remux with the audio converted to AAC when it doesn't. Converting an audiobook's audio is its transcode, so with transcoding off a book whose audio the device can't decode is served as it is, which is what happened before this change. A book that only needs a new container still remuxes, as a video file does, but only when the remux copies its audio: MP4 can't hold FLAC, so a FLAC book is served as it is rather than encoded.Bitrate presets are video bitrate classes, so on audio-only media a preset serves the source the same way. The row keeps the requested
qualitywitheffective_qualityoriginal, as it already does when a video source fits a preset.The remux has to work whatever the book's cover is: missing, or in a format MP4 can't hold (a GIF cover fails with
Could not find tag for codec gif), and scans no longer record the cover's format. So the prepare options carry a newAudioOnlyflag, set from the file and sent in the prepare request a remote node receives, and an audio-only prepared file maps no video at all, in both layouts. Clients show the server's artwork, as they do when streaming it. Streaming never sets it. Video files keep a required video map and an unchanged execution fingerprint. The served-quality check also stops comparing an older row's recorded cover resolution with the video quality ceiling, which would otherwise refuse a book (or its direct file) that serves no video.docs/downloads-api.mddescribes the audio-only rules.jellycompat's
/Items/{id}/Downloadonly serves originals throughServeDirectand never reaches this resolver, so it needs no change. This is server-side download planning, so the Apple and Android clients need no follow-up.Validation
Resolvetable rows:0:v:0.AudioOnlysurvives the trip to a node and changes the execution fingerprint.main.go test ./internal/downloads/ ./internal/downloadprepare/: pass.go test ./internal/playback/: everything this touches passes. 30 hardware-probe tests (the VideoToolbox, NVENC, QSV and VA-API probe fakes) fail on my Mac. The ones I reran onmainfail there the same way, so CI's Linux run is the one to trust for them.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3488/
I ran real servers built from
main(6aa6791e) and from this branch (88af1c2f; the later commits change only the transcode-off rule, the contract file and docs), each on a fresh database, and followed the issue's steps. The library held a synthetic two-second audiobook, an M4B with AAC stereo and an MJPEGattached_piccover, a FLAC with no picture, or an MP3 with a GIFattached_piccover. Downloads were enabled and the requests used the issue's caps (h264/aac/mp4,m4b/1080p).mainoriginaltranscodeat20mbps(H.264 1080p); failed 3 of 3 with the muxer errororiginal; file 200audio/mp4, identical to the source5mbpstranscode(H.264 1080p); failedoriginal,quality5mbpskept; file identical to the sourceoriginaltranscodeat20mbps; failed 3 of 3,Stream map '' matches no streamsremux,ready; file is AAC stereo, 2.0 s, no video streamoriginaltranscodeat20mbps; failed 3 of 3 with the muxer errorremux,ready; file is AAC stereo, 2.0 s, no video streamResponse excerpts, trimmed to the changed fields (
GET /api/v2/downloadsrow, thenGET /api/v2/admin/downloads/preparations), for the M4Boriginalrequest:main(6aa6791e):{"quality": "original", "effective_quality": "20mbps", "delivery_format": "transcode", "target_bitrate_kbps": 141, "status": "failed"} {"state": "failed", "format": "transcode", "output": {"container": "mp4", "video_codec": "h264", "audio_codec": "aac", "resolution": "1080p"}, "attempts": 3, "max_attempts": 3, "error": "exit status 234 (stderr: [mp4 @ …] Could not find tag for codec h264 in stream #0, codec not currently supported in container"}This branch (
88af1c2f):{"quality": "original", "effective_quality": "original", "delivery_format": "original", "target_bitrate_kbps": 0, "status": "queued"} GET /api/v2/downloads/{id}/file: 200, Content-Type audio/mp4, 35275 bytes, SHA-256 identical to the sourceFor the coverless FLAC
originalrequest:main(6aa6791e):{"quality": "original", "effective_quality": "20mbps", "delivery_format": "transcode", "target_bitrate_kbps": 157, "status": "failed"} {"state": "failed", "format": "transcode", "output": {"video_codec": "h264", "audio_codec": "aac", "resolution": "1080p"}, "attempts": 3, "error": "exit status 234 (stderr: Stream map '' matches no streams."}This branch (
88af1c2f):{"quality": "original", "effective_quality": "original", "delivery_format": "remux", "target_bitrate_kbps": 0, "status": "ready"} GET /api/v2/downloads/{id}/file: 200, 49439 bytes; ffprobe: one aac stream, 2 channels, 44100 Hz, duration 2.000000, no videoRisks
playback.Resolve, and the new rules apply only whenIsAudioOnlyis true, which needs an audiobook or podcast base type with audio and no non-image video track. Video downloads are unchanged.audio_only, so a remote node older than this change can't return a matching result for one and the job retries elsewhere. Those prepares failed before anyway.video/mp4, like every prepared MP4. I left the content type alone.Checklist
AI Disclosure
playback.Resolve, the preset and bulk paths, the policy gates and theIsAudioOnlyclassification, and checked the prepare arguments against real ffmpeg. It found that a coverless audiobook's remux still failed on the required video map, and that with transcoding off such a download would now be refused instead of served. Both are fixed here, and the coverless case is in the evidence. Its low-severity note about stale cover resolutions on older rows, which CodeRabbit also raised, is fixed too.Note
Keep audio-only media off the video transcode path in downloads and playback
sourceMethodhelper (see policy.go)AudioOnlytoplayback.TranscodeOptsanddownloadprepare.Request, so prepared downloads omit the embedded cover-art video stream from ffmpeg stream mapping (transcode.go, transport.go)playback.Resolvetreats audio-only media as video-compatible, and when transcoding is disabled falls back to direct delivery for unsupported audio or an audio-encoding remux; container-only remux remains allowed (resolver.go)servedQuality(empty video quality for audio-only files), so a recorded cover-art resolution like 2160p no longer fails an original download under a 1080p ceilingaudio_onlyflag to the OpenAPI schemadownloadprepare.Request.audio_onlyis part of the executor contract; older nodes will produce a different execution fingerprint for requests carrying it. Also checkappendPreparedVideoMapin bitmap-burn-in branches, which keep the original video mappingMacroscope summarized f0b3c01.