使用 OpenCV 捕获多播 UDP 视频流 [英] Capturing a Multicast UDP Video stream using OpenCV

查看:44
本文介绍了使用 OpenCV 捕获多播 UDP 视频流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多播 UDP 视频流,我需要我的 OPenCV (Emgu) 2.4.x 应用程序来捕获和处理(客户端").

I have a multi-cast UDP Video stream that I need my OPenCV (Emgu ) 2.4.x app to capture and process ("client").

在客户端,我可以使用 VLC 捕获流(udp://xx.yy.zz.aaa:1234,但是我的应用无法捕获这个 udp 流.我的代码很简单(

On the client, I can capture the stream using VLC (udp://xx.yy.zz.aaa:1234, However the my app fails to capture this udp stream. My code is quite simple (

Capture cap = new Capture ("udp://@212.1.1.1:1234");

附言我已经尝试过 2/o @ 也在那个地址上尝试了 rtp.没有运气:-/

p.s. I have tried with and 2/o the @ also tried rtp on that address. No luck :-/

OpenCV 是否直接允许捕获"UDP 流?还是我需要在客户端上运行 VLC 以将视频重新流式传输为 rtp 或 http 或其他......?

Does OpenCV directly allow "capture" of UDP streams? or do I need to run VLC on the client to re-stream the video as rtp or http or some other....?

谢谢.

推荐答案

我终于想通了,分享一下,希望对大家有所帮助,

I finally figured this out and sharing in the hope that might help others,

Capture cap = new Capture ("udp://@212.1.1.1:1234");

别忘了@符号!

在 UDP 流上成功创建了捕获,但是访问捕获属性会导致它出现异常并导致错误.

the capture is successfully created on the UDP Stream, however accessing the capture properties causes it to exception out and causes the error.

长话短说,UDP 流似乎不会流式传输设备属性,因此您可能需要在其他地方获取它或对其进行编码.

Long story short, the UDP stream does not appear to stream the device properties so you might need to obtain that elsewhere or code it in.

另外需要注意的是,由于 FPS(每秒帧数)不可靠,即使不是完全不正确,您可能需要调整 FPS,尤其是在循环轮询流时.

On other thing of note, that since the FPS (frames per sec) is unreliable, if not outright incorrect, you might need to make the FPS adjustable, especially if you are polling the stream in a loop.

HTH

这篇关于使用 OpenCV 捕获多播 UDP 视频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆