繁体   English   中英

RTMP stream 从 OpenCV/cv2 到 nginx 服务器,但客户端只得到一个绿色 window

[英]RTMP stream from OpenCV/cv2 to an nginx server, but client get just a green window

我想实现一个监视服务器来检测带有 openCV 的对象。

为此,我为此工作流设置了 Ubuntu 服务器:

Mobile CAM (from an Android) stream
|
| put the stream with RTMP to server rtmp://nginx/live/in [1]
|
v
nginx with the rtmp plugin
^
|
| the python script gets the mobile CAM stream from nginx rtmp://nginx/live/in [2]
|
v
surveillance script
|
| Stream to output back to rtmp://nginx/live/out with the results [3]
|
v
nginx with the rtmp plugin
^
|
| get the output stream from nginx rtmp://nginx/live/in [4]
|
RTMP stream client

我真的不了解 stream 和 RTMP 参数。 到目前为止,我的 [1] 和 [2] 工作正常,所以我在 phython OpenCV 脚本的帧中拥有来自移动 CAM 的视频。

在目标客户端 [4](我使用 ffplay rtmp://nginx/live/out)上,我只有一个绿色的 window,没有其他内容。

我将其用于流式传输部分:

...
                send_gst = "appsrc ! videoconvert ! video/x-raw,format=I420,clock-rate=90000 ! x264enc ! video/x-h264,stream-format=(string)byte-stream,alignment=(string)au ! h264parse ! queue ! flvmux ! rtmpsink location=rtmp://nginx/live/out"
                writer = cv2.VideoWriter(send_gst, 0, 20, (520, 380), True)
...
        if writer is not None:
                writer.write(frame)
...

也许有人可以给我一些提示或哪部分代码需要帮助我。

解决了,源和目的分辨率应该是一样的

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM