[PR #11185] fix: make sure the dimension is divisible by two for zscale #12777

Closed
opened 2026-02-07 07:01:37 +03:00 by OVERLORD · 0 comments
Owner

Original Pull Request: https://github.com/jellyfin/jellyfin/pull/11185

State: closed
Merged: Yes


zscale filter has an assertion that image dimensions must be divisible by subsampling factor, and for most yuv formats, this means the dimension has to be divisible by two. Our current logic recalculating dimensions may yield an odd number, especially for anamorphic videos, which fails the thumbnail generation.

Changes

  • Modify the filter logic for image extraction to use DAR instead of SAR, as SAR could be different from DAR for anamorphic videos, and DAR is what the video is expecting.
  • Use scale=round(iw*dar/2)*2:round(ih/2)*2 to generate an always even dimension. This would cause a side effect where 1x1 inputs being upscaled to 2x2, but this case is very unlikely.

Issues

Fixes #11183

**Original Pull Request:** https://github.com/jellyfin/jellyfin/pull/11185 **State:** closed **Merged:** Yes --- <!-- Ensure your title is short, descriptive, and in the imperative mood (Fix X, Change Y, instead of Fixed X, Changed Y). For a good inspiration of what to write in commit messages and PRs please review https://chris.beams.io/posts/git-commit/ and our documentation. --> zscale filter has an assertion that image dimensions must be divisible by subsampling factor, and for most yuv formats, this means the dimension has to be divisible by two. Our current logic recalculating dimensions may yield an odd number, especially for anamorphic videos, which fails the thumbnail generation. **Changes** <!-- Describe your changes here in 1-5 sentences. --> - Modify the filter logic for image extraction to use DAR instead of SAR, as SAR could be different from DAR for anamorphic videos, and DAR is what the video is expecting. - Use `scale=round(iw*dar/2)*2:round(ih/2)*2` to generate an always even dimension. This would cause a side effect where 1x1 inputs being upscaled to 2x2, but this case is very unlikely. **Issues** <!-- Tag any issues that this PR solves here. ex. Fixes # --> Fixes #11183
OVERLORD added the pull-request label 2026-02-07 07:01:37 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#12777