Capturing a Multicast UDP Video stream using OpenCV - opencv

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.

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

IplImage* frame;
CvCapture* pCapture;
pCapture = cvCaptureFromFile("udp://ip:port/path");
frame = cvQueryFrame(pCapture);
This will also do the job in case you don't have videoInput libraries

Related

Can I listen to non-VoIP audio captured in Wireshark

I am troubleshooting an Audio Over IP network system which uses multicast streams to pass audio over ethernet.
When a customer has pops/clicks in his or her audio, it usually means multicast flooding or some other network issue. I can use Wireshark to capture the packets and see this happening.
However, I would also like to be able to listen to the audio stream if possible so that I can hear what is happening. I can do this easily when I am working with VoIP calls but this is not VoIP/SIP.
I have turned on the RTP_RTSP and RTP_UDP protocols and can isolate the streams. But when I try to play one or save it as an .au file I am unable to do so. This is what they pretty much always look like when I hit "Play:"
Am I missing something, or is it only possible to play VoIP streams, not ordinary AoIP streams in Wireshark?
First, the Wireshark audio player supports a limited number of codecs see here. Check if your encoding is in that list. Second, the number of packets in you RTP stream looks too big for any "regular" codec: 1063 for ~6 seconds of recording (for example, G711 with 10 milliseconds sampling gives you only ~600 packets)

rtsp stream of an IP camera is much more delayed in VLC than in the NVR

I have an IP camera that i can view in VLC via the link rtsp://admin:admin#192.168.1.199:554/mpeg4/ch0/main/av_stream but i noticed there is a significant delay to the video in vlc compared to when the camera is viewed in the NVR. The vlc has a delay of 4-6 seconds while in the nvr its barely noticeable at all less than 1 second of delay.
I need to know why that is so i can then plan out what methods/libraries to use in the program im going to make. It helps to know why so that a possible work aroung maybe explored.
Is this a problem inherent to vlc or a limitation to rtsp?
Is there any way i can reduce this delay?
First get sure that your camera has no issue with getting multiple streams. Deactivate your camera on NVR and check if you have a better latency.
VLC use per default rtsp/rtp over TCP so force vlc to use rtsp/rtp over UDP just google about the vlc argument.
And verify if u have better latency.
As BijayRegmi wrote be aware of the default buffering.
Also you can try ffplay from ffmpeg libary and open the rtsp stream with it. There u have more informations about the health of the stream like package loss etc. Also this gives u an second option to verify your stream/latency, then u should know wich part produce the latency.

On video streams (RTSP specifically) does grab returns the most recent frame?

I'm using OpenCV to process a video stream that is provided via RTSP protocol. It's very easy to connect to the stream and read the frames. However, I'm having some timing issues and I want to make sure I'm doing it right.
The question is: how does VideoCapture::grab works in RTSP streams regarding frame buffering - does it retrieves the most recent frame provided by the stream or does it retrieves frames from a buffer? If so, can I control the buffer?

Delphi 7, indy9 tcp audio streaming

I am trying to make an application that use audio streaming through TCP connection, Using Delphi 7 and Indy9.
More clearly, How i can stream input from Client microphone and send it to (TCP or HTTP Server)? Consider real time.
Thank you
I never did this, but I think you can start with the basics ...
Set the frame rate to be used, 8000hz is a good choice
Choice a chunk size to capture from Microphone (1024, 2048, 4096,
etc)
Capture the audio from Microphone in short int or float32 (RAW Audio)
Put this chunk in one socket buffer preferably UDP, and send to
another side over UDP connection
If you make a loop with this process are you sending audio data by
socket
Now The other side just need get the data from every UDP connection
and play
This steps are a basic audio streaming :-)
In the future you might want to work with queuing, but that's another story

Relaying RTMP stream from one server to another

There is a WWW page with Flash stream on it. I want to download and forward this stream to another streaming server, when possible - replace audio stream (e.g. translate), but without recompressing video stream. Usual way for this ATM is to capture and broadcast Flash player view from the web page, which is obviously suboptimal because video needs to be recompressed, making the quality notably worse and loading the cpu.
Has someone an idea how to do it? VLC seems to be able making relay, but it also seems not to support RTMP at all.
if you're ready to do this programmatically you can use crtmpserver (C++) or red5 (Java) with any RTMP client, otherwise this question doesn't belong to SO

Resources