I am setting up a flask application on a pi zero to stream video via LAN. The camera can take normal pictures using libcamera-still command line, but when trying to stream the video the below blurry image appears. Here is the blurry image from the python stream. Blurry Video Output Image Here is the normal picture from command line. libcamera-still -o image.jpg I am using this python code: from flask import Flask, Response from picamera2 import Picamera2 import cv2 app = Flask(__name__) camera = Picamera2() camera.configure(camera.create_preview_configuration(main={"format": 'XRGB8888', "size": (640, 480)})) camera.start() def generate_frames(): while True: frame = camera.capture_array() ret, buffer = cv2.imencode('.jpg', frame) frame = buffer.tobytes() yield (b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n') @app.route('/video_feed') def video_feed(): return Response(generate_frames(), mimetype='multipart/x-mixed-replace; boundary=frame') if __name__ == '__main__': app.run(host='0.0.0.0', port=5000) For reproducibility, I am using a Pi Zero 2W, 64 Bit Raspberry Pi OS Bookworm, picamera2, flask, and opencv. Below is the camera used in the setup. https://www.amazon.com/dp/B01ER2SKFS?ref=ppx_yo2ov_dt_b_fed_asin_title I am loosely following this guide, although he uses a different camera in his setup. https://www.youtube.com/watch?v=NOAY1aaVPAw&t=466s I don't understand what the issue is with python. Could it be how the camera is configured? Maybe something with the streaming? Any thoughts would be greatly appreciated! Continue reading...