perf: réduire la latence du flux MJPEG
- Pipeline 640x480@30fps au lieu de 1280x720@15fps - appsink max-buffers=1 sync=false pour éliminer le buffering - Suppression du time.sleep(0.066) dans generate_mjpeg Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@ -35,10 +35,10 @@ def capture_loop():
|
||||
# Pipeline GStreamer pour CSI sur Pi Bookworm
|
||||
pipeline = (
|
||||
"libcamerasrc ! "
|
||||
"video/x-raw,width=1280,height=720,framerate=15/1 ! "
|
||||
"video/x-raw,width=640,height=480,framerate=30/1 ! "
|
||||
"videoconvert ! "
|
||||
"video/x-raw,format=BGR ! "
|
||||
"appsink drop=1"
|
||||
"appsink drop=1 max-buffers=1 sync=false"
|
||||
)
|
||||
cam = cv2.VideoCapture(pipeline, cv2.CAP_GSTREAMER)
|
||||
|
||||
@ -71,7 +71,6 @@ def generate_mjpeg():
|
||||
+ jpeg.tobytes()
|
||||
+ b"\r\n"
|
||||
)
|
||||
time.sleep(0.066)
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
|
||||
Reference in New Issue
Block a user