0

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:

1
  • Baffled as to what you are asking. Can you please edit the question to be a question (i.e. what do you get error message wise) or what does not work and what have you tried before it is requested to be closed.
    – user115418
    Commented Sep 16, 2020 at 1:17

1 Answer 1

1

It is not working as VLC (the way you have it configured) is expecting a h264 packaged stream whereas your python program is providing a raw stream of RGB frames.

I suggest you have two options: a) do the proper packaging to create h264 and h264 encoded stream. you might look into using ffmeg for that, you could use that in your pipe. b) tweak your VLC command line to accept raw input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.