Community
cancel
Showing results for 
Search instead for 
Did you mean: 
YYeon1
Novice
980 Views

How to Capture Video Stream from Edi-Cam Server using C++ in openCV?

Hi everyone,

I am trying to do some processing on video being streamed from an Edi-Cam server (https://github.com/drejkim/edi-cam GitHub - drejkim/edi-cam: Video streaming on Intel Edison) which is written in nodejs.

Is it possible for me to capture video stream from Edi-Cam Server using C++ in openCV?

The C++ coding that i wrote as follow:

# include

# include

# include

# include

# include

using namespace std;

using namespace cv;

int main()

{

Mat frame;

namedWindow("video", 1);

VideoCapture cap(" http://192.168.8.102:8080/video.mjpg");

if(!cap.isOpened())

{

cout<<"Camera not found"<<endl;

getchar();

return -1;

}

while ( cap.isOpened() )

{

cap >> frame;

if(frame.empty()) break;

imshow("video", frame);

if(waitKey(30) >= 0) break;

}

return 0;

}

When running the C++, it does not show me the video and show me "Camera not found".

However, in Intel Edison terminal, it shows:

 

"GET /video.mjpg 206 87.816 ms - 1248"

Thank you.

5 Replies
YYeon1
Novice
76 Views

intel_corp

Could you help me?

idata
Community Manager
76 Views

Hi Yeong,

 

 

Can you explain me the procedure that you are trying to follow to capture the video stream with OpenCV? Are you running the Edi-Cam code first? Or just running the C++ code?

 

 

By the way I'm not sure if it is possible to do this, because the Edi-Cam example uses FFMPEG library and you want to use another library like OpenCV. I think that the best suggestion that I can give you is to use just one library.

 

 

I will be waiting for your reply to help you more.

 

 

Have a nice day!

 

 

Regards,

 

-Leonardo
YYeon1
Novice
76 Views

Hi Leonardo,

Thanks for your reply. Yes, I am running the Edi-Cam code first and I can view the video using web browser without any problem. After that, I would like to do some image processing using openCV.

Is there any alternative method? How to use FFMPEG to view and save the video?

If I want to use openCV library, how to stream video using openCV?

Thank you.

Regards,

Yeong

idata
Community Manager
76 Views

Hi Yeong,

 

 

Right now, I'm doing my best to help you. So I found some links that can be useful for you:

 

 

FFMPEG and OpenCV: http://stackoverflow.com/questions/7574554/stream-video-from-ffmpeg-and-capture-with-opencv

 

https://siddhantahuja.wordpress.com/2011/08/15/ros-opencv-read-a-video-file-using-ffmpeg/

 

 

FFMPEG Video Streaming: https://trac.ffmpeg.org/wiki/StreamingGuide

 

 

Looks like you can use both libraries and maybe those links can guide you, but I think you shouldn't use the Edi-Cam code and try to create your own code.

 

 

Just let us know if you still have issues.

 

 

Thank you for remaining so positive.

 

 

Best Regards,

 

-Leonardo
idata
Community Manager
76 Views

Hi Yeong,

 

 

I was wondering if you have updates about this case. Was the information helpful?

 

 

Remember that we are here to help, just contact us.

 

 

Regards,

 

-Leonardo
Reply