Monitor multiple cameras at once
1from lynx import LYNX, StreamManager2 3model = LYNX("lynx-basic")4mgr = StreamManager(5 sources={6 "front": "rtsp://192.168.1.50/live",7 "back": "rtsp://192.168.1.51/live",8 },9 model=model,10)11 12for stream_id, results in mgr:13 print(stream_id, len(results))14 15mgr.stop()The GPU prefers a steady batch of frames over N small bursty queues from N processes. StreamManager multiplexes input from many cameras into one inference session, which gives you higher throughput and lower P99 latency than running N separate Python processes each with its own model.
Use it when you have multiple fixed-position cameras (store, warehouse, facility, traffic intersection) and one GPU to share. Iteration yields (stream_id, results) interleaved across cameras — you'll see "front" then "back" then "front" etc., not all-front-then-all-back. Match your downstream logic to that ordering.
Reconnect (reconnect=True, default): RTSP streams drop. Cameras reboot, networks blip, your router pretends nothing happened. With reconnect on, the manager re-establishes silently and you don't lose the stream for the rest of the run. Without it, one drop kills the iteration.
Queue size (queue_size=8, default): the per-stream frame buffer. Larger means more tolerance for inference being slower than the camera (frames pile up rather than getting dropped), at the cost of memory and latency. Smaller means tight latency but dropped frames if the model can't keep up. Adjust if you see frame age climbing in your logs.