fix(media): ابعاد خروجی FFmpeg با Pillow خوانده شود — ffprobe روی WebP صفر برمی‌گرداند

This commit is contained in:
aramesh-site deploy
2026-09-30 09:39:18 +00:00
parent c0eaac1daa
commit 1800909661
+5 -3
View File
@@ -460,9 +460,11 @@ def _ffmpeg_webp(data: bytes) -> tuple[bytes, int | None, int | None]:
run_convert(["-frames:v", "1"], still_vf)
with open(dst, "rb") as fh:
out = fh.read()
dims = _ffprobe_video(dst)[0] or {}
width = int(dims["width"]) if dims.get("width") else None
height = int(dims["height"]) if dims.get("height") else None
# ffprobe روی WebP عرض/ارتفاع صفر برمی‌گرداند — ابعاد از خود خروجی با Pillow
try:
width, height = Image.open(io.BytesIO(out)).size
except Exception:
width = height = None
return out, width, height