简体   繁体   English

来自Netcat的OpenCV流视频

[英]OpenCV stream video from Netcat

I am using Netcat and Mplayer to stream video from one device to another like this: 我正在使用NetcatMplayer将视频从一台设备流式传输到另一台设备,如下所示:

cat [video file] | nc [client ip address] [port] (server)

nc -L -p [port] | mplayer [options]              (client)

I would like to ask if there is a way to pick up the stream with OpenCV to perform some image processing. 我想问一下是否有一种方法可以使用OpenCV提取流以执行某些图像处理。

I have tried something like 我已经尝试过类似的东西

VideoCapture stream("udp://@<ip>:<port>/"); 

but the process gets stuck at this point. 但此刻过程陷入困境。

Thank you for your help ! 谢谢您的帮助 !

I'm doing a similar thing myself, was able to get it working by simply piping through stdin: 我自己也在做类似的事情,能够通过简单地通过stdin进行管道操作就可以使其工作:

nc -L -p [port] | ./opencvprogram

and then in the opencv program: 然后在opencv程序中:

VideoCapture stream("/dev/stdin");

Did you try 你试过了吗

VideoCapture stream("udp://@:6000"); //6000 is just an example

?

Are you sure that your video is streaming as UDP? 您确定您的视频以UDP流传输吗?

You can check this code too. 您也可以检查此代码

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

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