Hi Tayrone
You can download the missing header files from de opencv source code
repository. It is in the path otherlibs/_graphics/include/ffmpeg
(this folder is missing in the current opencv 1.1 distribution).
You can access the source code from http in:
http://opencvlibrary.cvs.sourceforge.net/viewvc/opencvlibrary/opencv/o
therlibs/_graphics/include/ffmpeg/
With this code, the library will compile without problems with the
libraries that come in the distribution of opencv.
I wanted to use the last version of ffmpeg (20/10/2008). I had
problems to do this, but I solved them. I followed this steps:
- I downloaded the source code from the site of ffmpeg
http://ffmpeg.mplayerhq.hu/ using a SVN client.
- I compiled it with mingw and msys following the steps in the
documentation of that site.
- I added the NEW libraries libavcodec.a, libavdevice.a,
libavformat.a, libavutil.a, libgcc.a, libmingwex.a, libwsock32.a
under the path otherlibs\ffopencv (because I didn't want to delete
the old libraries in the path otherlibs\_graphics\lib).
- I added this code in ffmpeg because de img_convert function header
was missing:
extern "C" {
int img_convert(AVPicture *dst, int dst_pix_fmt,
const AVPicture *src, int src_pix_fmt,
int src_width, int src_height);
}
- The directory structure in the new files is different.
So I put the directories libavformat, libavcodec, and the others in a
ffmpeg directory under the path "otherlibs/_graphics/include/ffmpeg"
and added the path ..\_graphics\include\FFMPEG to the additional
include directories.
In this way, I changed
#include <ffmpeg/avformat.h>
#include <ffmpeg/avcodec.h>
To
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
- Also, I had some link errors, so I had to include this in
ffopencv.cpp:
extern "C" {
int strcasecmp(const char *a,const char *b) {
return _strcmpi(a,b);
}
- To solve the other link errors, I compiled the library to the
static version of the CRT (multithreaded runtime library, /MT), and
removed the libraries in the option "Ignore Specific Libraries".
- To make the library I used VC2008.
In the previous post, I forgot to include this line in the list of
lines that must be added to ffopencv.h:
CVAPI(CvCapture*) cvCreateFileCapture_FFMPEG( const char* filename );
The complete list of function headers is this:
CVAPI(CvCapture*) cvCreateFileCapture_FFMPEG( const char* filename );
CVAPI(void) cvReleaseCapture_FFMPEG(CvCapture** capture);
CVAPI(CvVideoWriter*) cvCreateVideoWriter_FFMPEG( const char *
filename, int fourcc,double fps, CvSize frameSize, int is_color );
CVAPI(int) cvWriteFrame_FFMPEG( CvVideoWriter * writer, const
IplImage * image );
CVAPI(void) cvReleaseVideoWriter_FFMPEG( CvVideoWriter ** writer );
I hope this can help you.
Dario
--- In OpenCV@yahoogroups.com, "tayronects" <tayronects@...> wrote:
>
> Hi Dario,
> Thanks for your help.
>
> I´ve tried to follow your steps, but I am getting a lot of errors
while
> trying to compile the ffmpeg library.
>
> I am using the ffmpeg-0.4.9-pre1 version. There is no
> <ffmpeg/avformat.h> neither - <ffmpeg/avcodec.h> there as defined
on
> cvcap_ffmpeg.cpp file (I am on VC2005).
>
> Could you confirm what is the ffmpeg library you are using?
>
> regards,
> Tayrone
>