fix(mediainfo): 分辨率判定收敛为「宽度为主 + 高度救窄画幅 + 竖屏翻转」
- 上一版用 h>=1600 兜底 4K,误伤了 2560x1920(53 个 4:3 老动画, 实际是 1080p 档)和 1080x1920 竖屏直拍(14 个) - 现规则:竖屏先翻转 → w>=3000 判 2160p → w>=1700 判 1080p → h>=900 救 4:3 的 1440x1080 → w>=1000 判 720p → h>=600 判 720p → 其余 480p - 用全库 4697 个实测分辨率回归:3840x1608/1632/1634、4096x1720 判 2160p; 1920x800~1072 判 1080p;2560x1920、1440x1080 判 1080p;1080x1920 竖屏判 1080p - 新规则下库内标签不符从 579 降到 493(415 个 1080p 实为 4K 裁切、64 个实为 720p 等)
This commit is contained in:
@@ -13,14 +13,28 @@ class MediaInfoService:
|
|||||||
def classify_resolution(width: int, height: int) -> str:
|
def classify_resolution(width: int, height: int) -> str:
|
||||||
"""按宽高综合判定画质档位。
|
"""按宽高综合判定画质档位。
|
||||||
|
|
||||||
不能只看高度:2.39:1 的 4K 片源裁掉黑边后高度只有 ~1608,
|
要点:
|
||||||
用 h>2000 会把 3840×1608 误判成 1080p。宽度才是可靠判据。
|
- 以「宽度」为主判据:2.39:1 的 4K 片源裁掉黑边后高度只有 ~1608,
|
||||||
|
用 h>2000 会误判成 1080p;
|
||||||
|
- 但不能只看高度下限:2560×1920 这类 4:3 老片其实只有 1080p 档,
|
||||||
|
用 h>=1600 会误报成 2160p;
|
||||||
|
- 4:3 的 1440×1080 宽度不够 1700,靠高度 >=900 补回 1080p;
|
||||||
|
- 竖屏(手机直拍 1080×1920)先翻转成横向再判。
|
||||||
"""
|
"""
|
||||||
if width >= 3000 or height >= 1600:
|
if height > width: # 竖屏 → 按横向处理
|
||||||
|
width, height = height, width
|
||||||
|
|
||||||
|
if width >= 3000: # 3840 / 4096 宽的 4K
|
||||||
return "2160p"
|
return "2160p"
|
||||||
if width >= 1700 or height >= 900:
|
if width >= 1700: # 1920 宽(含 1920×800 等 scope)
|
||||||
return "1080p"
|
return "1080p"
|
||||||
|
if height >= 900: # 4:3 的 1440×1080
|
||||||
|
return "1080p"
|
||||||
|
if width >= 1000: # 1280×720 / 1024×576
|
||||||
return "720p"
|
return "720p"
|
||||||
|
if height >= 600:
|
||||||
|
return "720p"
|
||||||
|
return "480p"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_scene_tags(f_path: Path):
|
def get_scene_tags(f_path: Path):
|
||||||
|
|||||||
Reference in New Issue
Block a user