Opencv mjpg note

Source: Internet
Author: User

I'm using opencv 1.1pre1 under windows. I have a Network Camera and I need to grab frames from opencv. that camera can stream a standard MPEG4 stream over RTSP or MJPEG over HTTP. I 've seen into threads talking about using FFMPEG with opencv but I cannot make it work.

How I can grab frames from an IP camera with opencv?

Thanks

Andrea

============

 

 

Use ffmpeglib to connect to the stream.

These functions may be useful. But take a look in the docs

av_open_input_stream(...);
av_find_stream_info(...);
avcodec_find_decoder(...);
avcodec_open(...);
avcodec_alloc_frame(...);

You wowould need a little algo to get a complete frame, which is available here

http://www.dranger.com/ffmpeg/tutorial01.html

Once you get a frame you cocould copy the video data (for each plane if needed) into a iplimage which is an opencv image object.

You can create an iplimage using something like...

IplImage *p_gray_image = cvCreateImage(size, IPL_DEPTH_8U, 1);

Once you have an iplimage, you cocould perform all sorts of image operations available in the opencv lib

Link | flag Answered APR 3'09 at 9: 31 indeera
1, 68339
 

 

 

 

  I 've seen in our threads that FFmpeg is already embedded and used inside opencv, is this right? Maybe I need to recompile opencv with ffgmpeg support? In this case how I can do this under windows? Thanks-grifo APR 3'09
  I'm not aware of this. however, FFmpeg is an application where as ffmpeglib is a library. if you are new to these please look at the dranger.com tutorials. -indeera Apr 3 '09
======================== 

 

Opencv can be compiled with FFMPEG support. From./Configure -- Help:

--with-ffmpeg     use ffmpeg libraries (see LICENSE) [automatic]

You can then use * cvcreatefilecapture_ffmpeg * to create a cvcapture with e.g. the URL of the camera's mjpg stream.

I use this to grab frames from an axis camera:

CvCapture *capture = 
    cvCreateFileCapture_FFMPEG("http://axis-cam/mjpg/video.mjpg?resolution=640x480&req_fps=10&.mjpg");
Link | flag Answered Jun 18 '09 at 14: 28f3lix
4,8093622
 

 

 

 

  Is it possible to configure opencv with FFMPEG support under windows? -Grifo Jun 25 '09
============== 

 

I just do it like this:

CvCapture *capture = cvCreateFileCapture("rtsp://camera-address");

Also make sure this DLL is available at runtime else cvcreatefilecapture will return null

opencv_ffmpeg200d.dll

The camera needs to allow unauthenticated access too, usually set via its web interface. MJPEG format worked via RTSP but MPEG4 didn't.

Hth

Si

Link | flag Answered Feb 11 at 11: 48 sipickles
1075
 

 

 

 

  Are you using opencv 2.0? -Grifo Mar 2 at 8:41
  The Library version says that he is using opencv 2.0-that's200Part inopencv_ffmpeg200d.dll-Jamuraa Mar 17 at 20:41
==============================

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.