Capturing a Multicast UDP Video stream using OpenCV

13,376

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

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

don't forget the @ symbol!

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

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.

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

Share:
13,376
Mikos
Author by

Mikos

Updated on June 04, 2022

Comments

  • Mikos
    Mikos almost 2 years

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

    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");
    

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

    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....?

    Thanks.

  • berak
    berak about 11 years
    just curious, as i got no real idea about emgu, is this on win or linux ?
  • Mikos
    Mikos about 11 years
    Emgu is a .net wrapper for OpenCV (I ran it on windows. However I have heard Emgu runs fine on Linux with Mono.
  • Gulzar
    Gulzar almost 8 years
    What is different from your question where it did not work to your answer where it did work?same lins of code no?