stream.py needs to be changed:
import sys
import cv2
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
RES_W = 640
RES_H = 480
camera = PiCamera()
camera.resolution = (RES_W, RES_H)
camera.framerate = 24 # FPS
rawCapture = PiRGBArray(camera, size=(RES_W, RES_H))
# allow the camera to warmup
time.sleep(2)
for frame in camera.capture_continuous(rawCapture, format="bgr"):
# image is apparently not the right format for cvlc
image = frame.array
# processing the image for face recognition purposes
# ...
# related to first reference
sys.stdout.buffer.write(image)
# clear the stream in preparation for the next frame
rawCapture.truncate(0)
The command I used to pipe the output stream of stream.py to cvlc which did not work because cvlc seems unable to interpret the stream correctly:
(server)
python3 stream.py | cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264
It is supposed to be accessible using:
(client)
vlc http://raspberrypi:8090
and it worked without problems through:
(server)
raspivid -o - -t 0 -n -w 640 -h 400 -fps 24 | cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264
For further references: