user3151568
user3151568

Reputation: 1

OpenCV stream video from Netcat

I am using Netcat and Mplayer to stream video from one device to another like this:

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.

I have tried something like

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

but the process gets stuck at this point.

Thank you for your help !

Upvotes: 0

Views: 3065

Answers (2)

Michael
Michael

Reputation: 115

I'm doing a similar thing myself, was able to get it working by simply piping through stdin:

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

and then in the opencv program:

VideoCapture stream("/dev/stdin");

Upvotes: 1

Mustafa Chelik
Mustafa Chelik

Reputation: 2184

Did you try

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

?

Are you sure that your video is streaming as UDP?

You can check this code too.

Upvotes: 0

Related Questions