feat(mediainfo): 分辨率档位补全为 8K~360p,按等效 16:9 高度落档

- 新增 4320p / 1440p / 576p / 480p / 360p 五档
- 判据改为「等效 16:9 高度」:v = max(真实高度, 宽度*9/16)
  · 3840x1608(2.39:1 4K)v=2160 → 2160p
  · 2560x1920(4:3 放大)v=1920 → 1440p,不再误报 4K
  · 1024x576 → 576p;720x480 → 480p;竖屏先翻转
- 全库 4697 个实测分辨率逐条核对:8K 以下全部落档正确
This commit is contained in:
ali
2026-11-19 19:12:41 +08:00
parent 985fc74552
commit 3830ca17a3
+22 -17
View File
@@ -11,30 +11,35 @@ class MediaInfoService:
@staticmethod @staticmethod
def classify_resolution(width: int, height: int) -> str: def classify_resolution(width: int, height: int) -> str:
"""按宽高综合判定画质档位。 """按宽高综合判定画质档位(覆盖 8K ~ 360p)。
要点: 1. 竖屏(手机直拍 1080×1920)先翻转成横向;
- 以「宽度」为主判据:2.39:1 的 4K 片源裁掉黑边后高度只有 ~1608, 2. 折算「等效 16:9 高度」v = max(h, w*9/16):
用 h>2000 会误判成 1080p; - 2.39:1 的 4K 裁切(3840×1608)v=2160 → 仍判 2160p;
- 但不能只看高度下限:2560×1920 这类 4:3 老片其实只有 1080p 档, - 16:9 片源 v 就是真实高度;
用 h>=1600 会误报成 2160p; - 4:3 片源 v 取真实高度(2560×1920 → v=1920,不会误报 4K);
- 4:3 的 1440×1080 宽度不够 1700,靠高度 >=900 补回 1080p; 3. 再按 v 落档:8K / 4K / 1440p / 1080p / 720p / 576p / 480p / 360p。
- 竖屏(手机直拍 1080×1920)先翻转成横向再判。
""" """
if height > width: # 竖屏 → 按横向处理 if height > width: # 竖屏 → 按横向处理
width, height = height, width width, height = height, width
if width >= 3000: # 3840 / 4096 宽的 4K equivalent = max(height, round(width * 9 / 16))
return "2160p"
if width >= 1700: # 1920 宽(含 1920×800 等 scope) if equivalent >= 4000:
return "4320p" # 8K
if equivalent >= 2000:
return "2160p" # 4K(含 2.39:1 裁切)
if equivalent >= 1400:
return "1440p" # 2K / 4:3 的 2560×1920
if equivalent >= 1000:
return "1080p" return "1080p"
if height >= 900: # 4:3 的 1440×1080 if equivalent >= 700:
return "1080p"
if width >= 1000: # 1280×720 / 1024×576
return "720p" return "720p"
if height >= 600: if equivalent >= 520:
return "720p" return "576p" # 1024×576 一类
return "480p" if equivalent >= 400:
return "480p"
return "360p"
@staticmethod @staticmethod
def get_scene_tags(f_path: Path): def get_scene_tags(f_path: Path):