Quantcast
Channel: Intel Communities : All Content - General Questions
Viewing all articles
Browse latest Browse all 6470

How to write the C++ coding in openCV to stream video from IP address?

$
0
0

Hi everyone,

 

I'm writing a C++ coding in openCV to stream video from IP address but it doesn't work. Please help.

Thank you.

 

#include <opencv/cv.h> 
#include <opencv2/highgui/highgui.hpp> 
#include <opencv2/imgproc/imgproc.hpp> 
#include <iostream> 
#include <stdio.h> 
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; 
} 

 

 

 

 

 

For line 12, I also tried:

 

cv::VideoCapture cap("ws://192.168.8.102:8080.mjpg");

 

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

 

cv::VideoCapture capture("http://user:password@192.168.8.102:8080/mjpeg.cgi?user=USERNAME&password=PWD&channel=0&.mjpg");

 

 

 

I confirmed the IP address and port number are correct because I can view the video using web browser.


Viewing all articles
Browse latest Browse all 6470

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>