From 900ad1fde14bac1f6f9ce6961f48e2577e119c8e Mon Sep 17 00:00:00 2001 From: imSp4rky Date: Sun, 17 May 2026 19:06:53 -0600 Subject: [PATCH] fix(titles): normalize odd resolutions in filename quality token Non-16:9 aspect ratios with widths like 1918x1080 or 1620x720 were producing filenames like 911p. Snap width to the nearest standard (3840/2560/1920/1280) within 50px and snap the resulting resolution back to the track's actual height when within 10px or already a standard step. --- unshackle/core/titles/title.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/unshackle/core/titles/title.py b/unshackle/core/titles/title.py index 579cbe8..4eb68c7 100644 --- a/unshackle/core/titles/title.py +++ b/unshackle/core/titles/title.py @@ -113,7 +113,20 @@ class Title: aspect_ratio.append(1) ratio = aspect_ratio[0] / aspect_ratio[1] if ratio not in (16 / 9, 4 / 3, 9 / 16, 3 / 4): + if abs(width - 3840) <= 50: + width = 3840 + elif abs(width - 2560) <= 50: + width = 2560 + elif abs(width - 1920) <= 50 or abs(width - 1620) <= 50: + width = 1920 + elif abs(width - 1280) <= 50 or abs(width - 1080) <= 50: + width = 1280 + resolution = int(max(width, primary_video_track.height) * (9 / 16)) + + track_height = primary_video_track.height + if abs(resolution - track_height) <= 10 or track_height in (2160, 1440, 1080, 720, 480): + resolution = track_height except Exception: pass