360° Omnidirectional High-Torque 2-Axis Expandable Pan-Tilt Camera Module, Driven By Serial Bus Servos, Based On General Driver Board For Robots

Improve camera stream latency
For more "immediate feedback" on the stream, some addjustements of the source code could be made. 

   

   

 Reduce resolution on startup 

 camera = Camera()

camera.set_video_resolution("240P")

 

 Limit framerates to avoid hammering the network 

 def gen(cameraInput):

 yield b'--frame\r\n'

 while True:

 frame = cameraInput.get_frame()

 yield b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n--frame\r\n'

 time.sleep(0.05) # 20 FPS max

 

 Add headers on the stream 

 @app.route('/video_feed')

def video_feed():

 return Response(

 gen(camera),

 mimetype='multipart/x-mixed-replace; boundary=frame',

 headers={

 "Cache-Control": "no-cache, no-store, must-revalidate",

 "Pragma": "no-cache",

 "Expires": "0",

 "X-Accel-Buffering": "no"

 }

 )