Ask Your Question
3

how to using OpenCv API get web video stream!

asked 2013-11-20 01:30:53 -0500

风飞向何处 gravatar image

Is there have a API we can use to get video stream from web. For example from 192.168.1.180/?action=stream.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
4

answered 2013-11-20 01:54:50 -0500

Haris gravatar image

updated 2014-04-25 03:33:19 -0500

You can use OpenCV VideoCapture class to open video streaming from web

Using

VideoCapture cap;
cap.open(192.168.1.180/?action=stream?dummy=param.mjpg);

And see some links with this thread.

http://answers.opencv.org/question/3664/ip-network-camera-access/
http://stackoverflow.com/questions/712998/opencv-with-network-cameras
http://stackoverflow.com/questions/15584161/ip-camera-and-opencv

edit flag offensive delete link more

Comments

thinks for your replay! my compiler is vs2010 , I used your method! but I can't succeed. whether should i do some setting?

风飞向何处 gravatar image风飞向何处 ( 2013-12-18 03:33:21 -0500 )edit

thanks! I'm using your cord: cap.open("http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8dummy=param.mjpg"); the URL can open in browser,but can not open in vs2010 use you code :cap.open(URL); whether should I do some setting with my vs2010 ? or the version problem of my opencv . my opencv version is 2.3.0

风飞向何处 gravatar image风飞向何处 ( 2013-12-23 22:07:48 -0500 )edit

Are you able to capture using webcam ?

Haris gravatar imageHaris ( 2013-12-23 23:15:41 -0500 )edit

Mat grains(480,640,CV_8UC3,Scalar::all(0)); const string videoStreamAddress1 = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8?dummy=param.mjpg"; //From mjpeg streamer const string videoStreamAddress2 = "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8?dummy=param.mjpg"; //From mjpeg streamer

if(!vcap1.open(videoStreamAddress1)) { cout << "Error opening video stream1" <<endl; }
after execute this cord the screen print Error opening video stream1 , if i'm using browser I can capture webcam. but can't capture using vs2010

风飞向何处 gravatar image风飞向何处 ( 2013-12-23 23:45:02 -0500 )edit

The above code works fine for me on Windows7 vs2010 environment. Make sure that you are able to open video file from your PC. If no there are some issue with ffmpeg. See this link

Haris gravatar imageHaris ( 2013-12-24 02:01:06 -0500 )edit

thank you very mach! I have get webcam .I'm using ubuntu os . the ffmpeg is a encoding lib . it is using for linux not windows , so I think there is some error with my vs 2010 not ffmpeg

风飞向何处 gravatar image风飞向何处 ( 2013-12-24 03:24:35 -0500 )edit

Then just try with command line, so that you can assure is it the problem of vs2010. And this link might be helpful.

Haris gravatar imageHaris ( 2013-12-24 04:09:51 -0500 )edit
0

answered 2014-04-24 20:52:11 -0500

Talamantez gravatar image

updated 2014-04-24 21:51:44 -0500

Hello. I am able to get the above code to work. I would like to get a different type of stream to pipe in to opencv. I have an html5 canvas on a webpage served at 127.0.0.1:5555 that I am loading a stream into with the following code:

    <div id="droneStream" style="width: 640px; height: 360px"></div>

     new NodecopterStream(document.getElementById("droneStream"));
     var myImage = canvas.toDataURL("image/png");

I want to pipe that stream from the page into opencv in the way that you have accomplished above. Do you know how to structure the url to grab the image stream? Right now I have a URL that I know is wrong, but here is my opencv code:

capture.open("http://127.0.0.1:5555/#droneStream");

Thanks for your help.

edit flag offensive delete link more

Comments

2

hi Talamantez.

since this is not an answer, but another question, - would you be so nice to remove this, and start your own question ? (else it gets totally confusing)

reading theFAQ will be helpful, too.

berak gravatar imageberak ( 2014-04-24 23:51:00 -0500 )edit

Like @berak suggested ... please do not open cold turkey topics :)

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-25 03:34:45 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2013-11-20 01:30:53 -0500

Seen: 45,646 times

Last updated: Apr 25 '14