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:
2026-06-09 18:48:19 +02:00
parent accf1ec793
commit b6cca04df3
2 changed files with 14 additions and 3 deletions

View File

@ -4,3 +4,9 @@ HEIGHT=720
FPS=15 FPS=15
BITRATE_KBPS=1500 BITRATE_KBPS=1500
ENCODER=auto 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

View File

@ -102,9 +102,12 @@ def _get_cpu_pct() -> float | None:
def _h264_level(w: int, h: int) -> str: def _h264_level(w: int, h: int) -> str:
"""Minimum H.264 level for the given resolution.""" if w * h > 1920 * 1080:
# level 4 required for anything above 720p return "5"
return "4" if w * h > 1280 * 720 else "3.2" elif w * h > 1280 * 720:
return "4"
else:
return "3.2"
# --- Pipeline builder -------------------------------------------------------- # --- Pipeline builder --------------------------------------------------------
@ -314,6 +317,8 @@ def settings_post():
patch = {k: v for k, v in data.items() if k in allowed} patch = {k: v for k, v in data.items() if k in allowed}
if not patch: if not patch:
return jsonify({"error": "no valid fields", "allowed": sorted(allowed)}), 400 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) _gst.restart_with(patch)
return jsonify({"status": "restarting", "applied": patch}) return jsonify({"status": "restarting", "applied": patch})