I have two Raspberry Pi connected to the same WiFi network and am trying to get a video livestream set up coming from RPi1's camera and being displayed on RPi2's HDMI screen.
Currently I am setting up the stream with the following code:
import socket import time import picamera with picamera.PiCamera() as camera: camera.rosultion = (640, 480) camera.framerate = 24 server_socket = socket.socket() server_socket.bind(('0.0.0.0', 8000)) server_socket.listen(0) connection = server_socket.accept().makefile('wb') try: camera.start_recording(connection, format='h264') camera.wait_recording(60) camera.stop_recording() finally: connection.close() server_socket.close()
The client Rpi then attempts to open the stream via VLC player with:
However this will only, after some loading time, display a single image and then hang immediately. Is there a better way to do a local network stream? Opening the stream on my PC with the same command works perfectly fine, although it does have 2 to 3 second latency.
Thank you for the help.