I have successfully streamed an h264 video over the local network with this command.
raspivid -o - -t 0 -n -w 1280 -h 720 -vf -vs -fps 30 -b 3500000 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264
I can view the stream on my iOS VLC app through the address
rtsp://192.168.0.146:8554/
But I have no luck viewing the stream on my local computer. Here's a script I made.
import cv2
import imutils
from imutils.video import VideoStream
stream = "rtsp://192.168.0.146:8554/"
vs = VideoStream(src=stream).start()
while True:
frame = vs.read()
cv2.imshow('frame', frame)
if cv2.waitKey(1) != -1:
break
vs.release()
cv2.destroyAllWindows()
OpenCV is not able to get any frame from the address. Please correct me if I'm wrong, but I am wondering perhaps it needs the video to be wrapped in a container like mp4. Can anyone tell me how to achieve that? Can it be easily piped in the first command?