-
-
Save malefs/be85b952277513fc6aabe4e1de1b9134 to your computer and use it in GitHub Desktop.
Raspberry Pi MJPEG stream over UDP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from picamera import PiCamera | |
| from io import BytesIO | |
| import socket | |
| import time | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| with PiCamera(resolution='VGA', framerate=5) as camera: | |
| time.sleep(2) | |
| buff = BytesIO() | |
| for _ in camera.capture_continuous(buff, format='mjpeg'): | |
| sock.sendto(buff.getvalue(), ('10.10.0.10', 7000)) | |
| buff.seek(0) | |
| buff.truncate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment