read ip camera from openCV in C - url

I am trying to catch the mjpeg from an ip camera in openCV
but without success till now.
I have the url which displays the mjpeg video in firefox browser
"http://192.168.2.15/GetData.cgi"
but i cannot take it in opencv
Any ideas or solutions are welcomed...
Kind Regards
Thanks in advance

You need the data to be present locally either via the hard drive or in RAM. It would be slow, but I would recommend writing a web service to download frames of the video to the hard drive and then read them into opencv.

Related

Using OpenCV to process live video from Phantom 4

I would like to process frames live in OpenCV from the video feed on a DJI Phantom 4. I've been able to set up OpenCV for iOS in xCode but I need help finding a tutorial/instructions on how to send the frames over from the DJI Camera into OpenCV in the correct format on the fly. Any suggestions?
Thanks
Hello there Ilia Labkovsky,
I think am in the same boat, I have got a P3 and would like to process the images via OpenCV. I am intending to use my laptop PC as an image processor, sending the images directly via TCP/IP and doing my own image processing off-board. I am yet to establish this though, I may come across some problems.
Is there a way I can privately message you on Stack Overflow?
Best of luck with the programming :)
There is a tutorial for Android on the DJI sample apps on how to parse and obtain the yuv frames. From there you can use openCv to process the frames: https://github.com/DJI-Mobile-SDK-Tutorials/Android-VideoStreamDecodingSample

Streaming H.264 video from a Raspberry Pi on an iOS device

Full disclosure: I'm a pretty junior developer and new to asking questions. I also don't know that much about video streaming as a concept so if the answer is right in front of my face I probably just glazed right over it.
That being said, I am trying to do something that seems like it should be pretty simple but can't seem to figure it out. I'm trying to get a H.264 live stream video off of a Raspberry Pi and view it in my app. I've found a number of things about encoding videos but couldn't seem to get anything to work.
Anything anyone has to offer would be a large help, even if it is just a direction to look in because I'm pulling my hair out trying to figure this one out.
You'll first need to install some platform on your Raspberry Pi that can serve data to a client. You can look into web server platforms like Apache. Once installed, you can verify this is working by hitting the IP address of the Raspberry Pi from any browser: e.g. 192.168.1.67:80
Then you need to make sure the video is available through the file system on your Raspberry Pi. Searching something like "Adding files to Apache" might help.
You can test that the file is available by hitting the IP address of your Raspberry Pi from any browser: e.g.
192.168.1.67:80/path/to/video.mp4
This means that the video file is available and can be downloaded, but won't be streamed by default. Then you can look into some JavaScript framework that can help you with the streaming portion.
Apple has super famous HLS protocol for streaming videos. You would need to first encode video input coming from camera, then pass it to your server who's basically doing all the "behind the scene" work and provides you with *.m3u8 URL. I've implemented this pattern with Wowza Streaming Engine. You can use it or similar tools.
On the flip side, if you're inclined towards having more simple and straight forward solution; more like a CDN approach, then you may follow #Bret's answer.

OpenCV not working with different RTSP streaming URLs. grab() from videocapture is always 0

I'm working with opencv to read the frames from a RTSP streaming link via VideoCapture function. It worked well for a specific RTSP camera. But the thing is, I have tried to connect different RTSP cameras in the same network but for my surprise, it wouldnt work.
Any thoughts of what could cause this problem? I need to be able to get the stream of any rtsp url with the same openCV code for my purpose.
The camera that worked is a generic chinese one and it also worked with the big buck bunny comic provided by rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov. The second camera that I tried and got no outputs is an AirCam Dome from Ubiquiti wich has 4 rtsp links. I tried every resolution.
Check if you have 'opencv_ffmpeg341.dll' or something like this in your running folder.
If you are using Windows system, put the dll in x64 or x86 folder.

Streaming opencv Video

I need some ideas about how to stream video feed coming from opencv to a webpage. I currently have gStreamer, but I don't know if this is the right tool for the job. Any advice on using gStreamer or any hyperlinks to tutorials would be helpful and appreciated!
Thanks!
OpenCV doesn't provide an interface for streaming video, which means that you'll need to use some other techonology for this purpose.
I've used GStreamer in several professional projects: this is the droid you are looking for.
I do not have any experience w/ streaming OpenCV output to a website. However I'm sure this is possible using gstreamer.
Using a gstreamer stream, it is possible to get data and convert the data in to OpenCV format. I recommend you read up on GstAppSink and GstBuffer.
Basically, if I remember correctly, you must run a pipeline in the a background thread. Then using some function in gst_app_sink, you can get the buffer data from the sink.
A quick lookup on the issue, you had to use GST_BUFFER_DATA for this
I remember having to convert the result from yCBCr to bgr, a collegue had problems as the conversion of opencv was inadequate. So you might have to write your own. (This was back in the IplImage* days)

Snapshot using vlc (to get snapshot on RAM)

I was planning to use the vlc library to decode an H.264 based RTSP stream and extract each frame from it (convert vlc picture to IplImage). I have done a bit of exploration of the vlc code and concluded that there is a function called libvlc_video_take_snapshot which does a similar thing. However the captured frame in this case is saved on the hard disk which I wish to avoid due to the real time nature of my application. What would be the best way to do this? Would it be possible without modifying the vlc source (I want to avoid recompilation if possible). I have heard of vmem etc but could not really figure out what it does and how to use it.
The picture_t structure is internal to the library, how can we get an access to the same.
Awaiting your response.
P.S. Earlier I tried doing this using FFMPEG, however the ffmpeg library has a lot of issues while decoding an H.264 based RTSP stream on windows and hence I had to switch to VLC.
Regards,
Saurabh Gandhi

Resources