fix(media): ابعاد خروجی FFmpeg با Pillow خوانده شود — ffprobe روی WebP صفر برمیگرداند
This commit is contained in:
@@ -460,9 +460,11 @@ def _ffmpeg_webp(data: bytes) -> tuple[bytes, int | None, int | None]:
|
|||||||
run_convert(["-frames:v", "1"], still_vf)
|
run_convert(["-frames:v", "1"], still_vf)
|
||||||
with open(dst, "rb") as fh:
|
with open(dst, "rb") as fh:
|
||||||
out = fh.read()
|
out = fh.read()
|
||||||
dims = _ffprobe_video(dst)[0] or {}
|
# ffprobe روی WebP عرض/ارتفاع صفر برمیگرداند — ابعاد از خود خروجی با Pillow
|
||||||
width = int(dims["width"]) if dims.get("width") else None
|
try:
|
||||||
height = int(dims["height"]) if dims.get("height") else None
|
width, height = Image.open(io.BytesIO(out)).size
|
||||||
|
except Exception:
|
||||||
|
width = height = None
|
||||||
return out, width, height
|
return out, width, height
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user