feat: H.264 level 5 pour >1080p + validation résolution OV5647 max 2592x1944
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
6
.env.dev
6
.env.dev
@ -4,3 +4,9 @@ HEIGHT=720
|
||||
FPS=15
|
||||
BITRATE_KBPS=1500
|
||||
ENCODER=auto
|
||||
|
||||
# Résolutions validées OV5647 :
|
||||
# 640x480@15fps hw ~14% CPU
|
||||
# 1280x720@15fps hw ~14% CPU ← défaut
|
||||
# 1920x1080@10fps sw ~57% CPU
|
||||
# 2592x1944@1fps sw ~?% CPU ← pleine résolution capteur
|
||||
|
||||
@ -102,9 +102,12 @@ def _get_cpu_pct() -> float | None:
|
||||
|
||||
|
||||
def _h264_level(w: int, h: int) -> str:
|
||||
"""Minimum H.264 level for the given resolution."""
|
||||
# level 4 required for anything above 720p
|
||||
return "4" if w * h > 1280 * 720 else "3.2"
|
||||
if w * h > 1920 * 1080:
|
||||
return "5"
|
||||
elif w * h > 1280 * 720:
|
||||
return "4"
|
||||
else:
|
||||
return "3.2"
|
||||
|
||||
|
||||
# --- Pipeline builder --------------------------------------------------------
|
||||
@ -314,6 +317,8 @@ def settings_post():
|
||||
patch = {k: v for k, v in data.items() if k in allowed}
|
||||
if not patch:
|
||||
return jsonify({"error": "no valid fields", "allowed": sorted(allowed)}), 400
|
||||
if patch.get("width", 0) > 2592 or patch.get("height", 0) > 1944:
|
||||
return jsonify({"error": "resolution exceeds OV5647 max (2592×1944)"}), 400
|
||||
_gst.restart_with(patch)
|
||||
return jsonify({"status": "restarting", "applied": patch})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user