Skip to content

fix(jellycompat): populate MediaStream ColorRange (SDR washed out in clients) - #448

Closed
n0de0ne wants to merge 1 commit into
Silo-Server:mainfrom
n0de0ne:pr/jellyfin-colorrange
Closed

n0de0ne wants to merge 1 commit into
Silo-Server:mainfrom
n0de0ne:pr/jellyfin-colorrange

Conversation

@n0de0ne

@n0de0ne n0de0ne commented Jul 21, 2026 •

Copy link
Copy Markdown

Silo never captured or reported the video color range (limited/tv vs full/pc), so the Jellyfin-compat MediaStream omitted ColorRange. Clients (Infuse, etc.) then render limited-range content as full-range on direct play -> raised blacks, capped whites -> washed out / faded, even on plain SDR h264.

Thread ffprobe's color_range through to the API, mirroring the existing ColorSpace/ColorTransfer/ColorPrimaries handling:

  • scanner/probe.go: capture color_range and set it on the built VideoTrack
  • scanner/scanner.go: carry ColorRange through applyProbeData (persist path)
  • scanner/types.go, models/media.go: add ColorRange to track structs
  • jellycompat/dto.go: add ColorRange to mediaStreamDTO
  • jellycompat/handlers_playback.go: populate ColorRange from the track
  • catalogseed/{types,service}.go: carry it through catalog-seed import

Values pass through verbatim (tv/pc), same as Jellyfin; untagged files stay empty (omitempty). Existing libraries need a re-scan to repopulate video_tracks.

Summary by CodeRabbit

  • New Features
    • Added support for detecting and preserving video color range metadata.
    • Color range information is now included in video track details and playback stream metadata when available.
    • Media exports and responses can now include the video color_range value.

…clients)

Silo never captured or reported the video color range (limited/tv vs full/pc),
so the Jellyfin-compat MediaStream omitted ColorRange. Clients (Infuse, etc.)
then render limited-range content as full-range on direct play -> raised blacks,
capped whites -> washed out / faded, even on plain SDR h264.

Thread ffprobe's color_range through to the API, mirroring the existing
ColorSpace/ColorTransfer/ColorPrimaries handling:
- scanner/probe.go: capture color_range and set it on the built VideoTrack
- scanner/scanner.go: carry ColorRange through applyProbeData (persist path)
- scanner/types.go, models/media.go: add ColorRange to track structs
- jellycompat/dto.go: add ColorRange to mediaStreamDTO
- jellycompat/handlers_playback.go: populate ColorRange from the track
- catalogseed/{types,service}.go: carry it through catalog-seed import

Values pass through verbatim (tv/pc), same as Jellyfin; untagged files stay
empty (omitempty). Existing libraries need a re-scan to repopulate video_tracks.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Video color range metadata is parsed from ffprobe output, stored on video tracks, and propagated to catalog records and Jellyfin-compatible playback stream DTOs.

Changes

Video color range propagation

Layer / File(s) Summary
Probe color range capture
internal/scanner/probe.go, internal/scanner/types.go
ffprobe color_range metadata is parsed and copied into VideoTrackInfo.
Video track persistence
internal/models/media.go, internal/scanner/scanner.go
VideoTrack stores ColorRange, and probe application copies the parsed value into persisted tracks.
Catalog and playback exposure
internal/catalogseed/..., internal/jellycompat/...
Catalog records and playback stream DTOs include the video track color range.
Estimated code review effort: 2 (Simple) ~10 minutes

Possibly related issues

Suggested reviewers: quick104

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: threading MediaStream ColorRange through jellycompat to address washed-out SDR playback.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/scanner/probe.go`:
- Line 212: Normalize ffprobe’s ColorRange value before assigning it to
VideoTrackInfo: convert only the "unknown" sentinel to an empty string, while
preserving "tv" and "pc" unchanged. Update the ColorRange mapping in the
surrounding probe construction without altering other stream fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8bef80e3-4b09-4ba9-86c5-b47bbdfbb3f5

📥 Commits

Reviewing files that changed from the base of the PR and between 3457382 and c388369.

📒 Files selected for processing (8)
  • internal/catalogseed/service.go
  • internal/catalogseed/types.go
  • internal/jellycompat/dto.go
  • internal/jellycompat/handlers_playback.go
  • internal/models/media.go
  • internal/scanner/probe.go
  • internal/scanner/scanner.go
  • internal/scanner/types.go

Comment thread internal/scanner/probe.go
ColorPrimaries: s.ColorPrimaries,
ColorSpace: s.ColorSpace,
ColorTransfer: s.ColorTransfer,
ColorRange: s.ColorRange,

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n '"color_range"[[:space:]]*:[[:space:]]*"unknown"' .
rg -n 'ColorRange|color_range' internal/scanner internal/models internal/catalogseed internal/jellycompat

Repository: Silo-Server/silo-server

Length of output: 161


🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline internal/scanner/probe.go --view expanded
printf '\n---\n'
sed -n '1,280p' internal/scanner/probe.go
printf '\n---\n'
rg -n 'normalizeColorRange|ColorRange|color_range|unknown' internal/scanner internal/models internal/catalogseed internal/jellycompat

Repository: Silo-Server/silo-server

Length of output: 21673


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '600,710p' internal/scanner/probe.go
printf '\n---\n'
sed -n '1,320p' internal/models/media.go
printf '\n---\n'
sed -n '860,930p' internal/jellycompat/handlers_playback.go
printf '\n---\n'
sed -n '2530,2610p' internal/catalogseed/service.go

Repository: Silo-Server/silo-server

Length of output: 20714


Normalize ffprobe’s unknown color-range sentinel before storing it.

ffprobeStream.ColorRange is copied through as-is, so unset ranges become the literal string unknown in VideoTrackInfo and downstream JSON/API payloads. Map only unknown to "" and leave tv / pc unchanged.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/scanner/probe.go` at line 212, Normalize ffprobe’s ColorRange value
before assigning it to VideoTrackInfo: convert only the "unknown" sentinel to an
empty string, while preserving "tv" and "pc" unchanged. Update the ColorRange
mapping in the surrounding probe construction without altering other stream
fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants