如何使用Python重塑脚本的输出流,使其适用于cvlc流?
该流由来自raspberry pi摄像机的帧组成 stream.py需要更改:如何使用Python重塑脚本的输出流,使其适用于cvlc流?,python,python-3.x,raspberry-pi,vlc,streaming-video,Python,Python 3.x,Raspberry Pi,Vlc,Streaming Video,该流由来自raspberry pi摄像机的帧组成 stream.py需要更改: 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 # FP
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)
我用来将stream.py的输出流输送到cvlc的命令无效,因为cvlc似乎无法正确解释流:
(服务器)
应可通过以下方式访问:
(客户)
它通过以下方式顺利运行:
(服务器)
进一步参考:
- 虽然我决定不使用dnn,但是:
python3 stream.py | cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264
vlc http://raspberrypi:8090
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