Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Python重塑脚本的输出流,使其适用于cvlc流?_Python_Python 3.x_Raspberry Pi_Vlc_Streaming Video - Fatal编程技术网

如何使用Python重塑脚本的输出流,使其适用于cvlc流?

如何使用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

该流由来自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 # 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