Fails to find ffmpeg headers

Bug #311188 reported by Lionel Le Folgoc
36
This bug affects 3 people
Affects Status Importance Assigned to Milestone
opencv (Ubuntu)
Fix Released
Low
Unassigned
Declined for Hardy by Lionel Le Folgoc
Declined for Intrepid by Lionel Le Folgoc
Declined for Karmic by Lionel Le Folgoc
Jaunty
Won't Fix
Low
Unassigned

Bug Description

 affects ubuntu/opencv
 status confirmed
 importance low
 tag ffmpegheaders
 done

Hi,

FFmpeg headers have moved in recent ffmpeg snapshots, thus this package
fails to find them:

checking ffmpeg/avcodec.h usability... no
checking ffmpeg/avcodec.h presence... no
checking for ffmpeg/avcodec.h... no

The package is then built without ffmpeg support.

--
Lionel Le Folgoc - https://launchpad.net/~mrpouit
EEBA 555E 0CDE 92BB 3AF4 4AB3 45A0 357B 5179 5910

Revision history for this message
Jozef Mlich (xmlich02) wrote :

i have just created symlinks to appropriate ffmpeg header files and then compiled from source codes.

/usr/include/ffmpeg$ ls -All
total 0
lrwxrwxrwx 1 root root 23 2009-03-05 15:58 avcodec.h -> ../libavcodec/avcodec.h
lrwxrwxrwx 1 root root 25 2009-03-05 16:15 avformat.h -> ../libavformat/avformat.h
lrwxrwxrwx 1 root root 21 2009-03-05 16:15 avio.h -> ../libavformat/avio.h
lrwxrwxrwx 1 root root 21 2009-03-05 16:15 avutil.h -> ../libavutil/avutil.h
lrwxrwxrwx 1 root root 23 2009-03-05 15:58 swscale.h -> ../libswscale/swscale.h

P.S. For me it is important feature to have video support in opencv.

Revision history for this message
Thiago Teixeira (tvst) wrote :

Yes, please fix this. Without the ability to load videos OpenCV is almost useless.

Revision history for this message
Thiago Teixeira (tvst) wrote :

When I try Jozef's fix above, I get an error regarding img_convert().

This has been discussed on the mailing list, and is probably why ffmpeg support is disabled:
http://www.nabble.com/Re%3A--OpenCV--img_convert-error-p19815303.html

Revision history for this message
Thiago Teixeira (tvst) wrote :

Actually, it turns out that the latest FFMPEG (version 0.5, which just came out) *does* have img_convert()!

So it should be just a matter of packaging FFMPEG 0.5 and repackaging OpenCV.

Revision history for this message
Gijs Molenaar (gijzelaar) wrote :

I'm a little bit worried, 2 months later now and there has been no workaround or fix. OpenCV is almost unusable now with Ubuntu Jaunty, one big reason why not to upgrade. Why is the importance low if this video functionality isn't working for anyone? Not everyone using Ubuntu is able to compile his/her own code and packages.

Revision history for this message
Gijs Molenaar (gijzelaar) wrote :

I've successfully compiled the latest ffmpeg-debian package on ubuntu from:

http://git.debian.org/?p=pkg-multimedia/ffmpeg-debian.git

Which is 0.5 + some latest changes After creating and applying the attached patch for opencv I got opencv started compiling, but then I still get the img_convert() error.

 g++ -DHAVE_CONFIG_H -I. -I../.. -I. -I../../cxcore/include -I../../cv/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DNDEBUG -fno-strict-aliasing -Wall -g -fopenmp -O2 -g -MT cvcap_ffmpeg.lo -MD -MP -MF .deps/cvcap_ffmpeg.Tpo -c cvcap_ffmpeg.cpp -fPIC -DPIC -o .libs/cvcap_ffmpeg.o
cvcap_ffmpeg.cpp: In function ‘int icvOpenAVI_FFMPEG(CvCaptureAVI_FFMPEG*, const char*)’:
cvcap_ffmpeg.cpp:121: warning: comparison between signed and unsigned integer expressions
cvcap_ffmpeg.cpp: In function ‘const IplImage* icvRetrieveFrameAVI_FFMPEG(CvCaptureAVI_FFMPEG*)’:
cvcap_ffmpeg.cpp:222: error: ‘img_convert’ was not declared in this scope
cvcap_ffmpeg.cpp: In function ‘double icvGetPropertyAVI_FFMPEG(CvCaptureAVI_FFMPEG*, int)’:
cvcap_ffmpeg.cpp:248: error: ‘INT64_C’ was not declared in this scope
cvcap_ffmpeg.cpp:252: error: ‘INT64_C’ was not declared in this scope
cvcap_ffmpeg.cpp:256: error: ‘INT64_C’ was not declared in this scope
cvcap_ffmpeg.cpp: In function ‘CvVideoWriter* cvCreateVideoWriter(const char*, int, double, CvSize, int)’:
cvcap_ffmpeg.cpp:533: warning: ‘AVFormatContext* av_alloc_format_context()’ is deprecated (declared at /usr/include/libavformat/avformat.h:873)
cvcap_ffmpeg.cpp:533: warning: ‘AVFormatContext* av_alloc_format_context()’ is deprecated (declared at /usr/include/libavformat/avformat.h:873)
cvcap_ffmpeg.cpp: In function ‘int cvWriteFrame(CvVideoWriter*, const IplImage*)’:
cvcap_ffmpeg.cpp:718: error: ‘img_convert’ was not declared in this scope
cvcap_ffmpeg.cpp: In function ‘void cvReleaseVideoWriter(CvVideoWriter**)’:
cvcap_ffmpeg.cpp:777: warning: comparison between signed and unsigned integer expressions
make[4]: *** [cvcap_ffmpeg.lo] Error 1
make[4]: Leaving directory `/home/gijs/Work/packaging/opencv-1.0.0/otherlibs/highgui'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/gijs/Work/packaging/opencv-1.0.0/otherlibs'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/gijs/Work/packaging/opencv-1.0.0'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/gijs/Work/packaging/opencv-1.0.0'
make: *** [build-stamp] Error 2
dpkg-buildpackage: failure: debian/rules build gave error exit status 2

Revision history for this message
Gijs Molenaar (gijzelaar) wrote :
Download full text (14.3 KiB)

Gentoo has a patch replacing img_convert():
http://bugs.gentoo.org/attachment.cgi?id=130219&action=edit

I modified it to quilt format and applied it (see attachment), but a build still fails. Now I'm really stuck, since my C/C++ skills are not very good.

To get as far as I'm now:
* put the patch and the patch in the previous post in debian/patches
* modify the debian/patches/series file to include the patches
* add libswscale-dev to the build deps in the control file
* build -> error....

I tried it with a latest ffmpeg build and with the ffmpeg from the ubuntu jaunty archives.

Build fail output:
 g++ -DHAVE_CONFIG_H -I. -I../.. -I. -I../../cxcore/include -I../../cv/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DNDEBUG -fno-strict-aliasing -Wall -g -fopenmp -O2 -g -MT cvcap_ffmpeg.lo -MD -MP -MF .deps/cvcap_ffmpeg.Tpo -c cvcap_ffmpeg.cpp -fPIC -DPIC -o .libs/cvcap_ffmpeg.o
cvcap_ffmpeg.cpp:61: error: two or more data types in declaration of ‘img_convert_ctx’
cvcap_ffmpeg.cpp:63: error: expected unqualified-id before ‘{’ token
cvcap_ffmpeg.cpp:74: error: declaration does not declare anything
cvcap_ffmpeg.cpp: In function ‘void icvCloseAVI_FFMPEG(CvCaptureAVI_FFMPEG*)’:
cvcap_ffmpeg.cpp:80: error: invalid use of incomplete type ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:60: error: forward declaration of ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:81: error: invalid use of incomplete type ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:60: error: forward declaration of ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:83: error: invalid use of incomplete type ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:60: error: forward declaration of ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:86: error: invalid use of incomplete type ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:60: error: forward declaration of ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:90: error: invalid use of incomplete type ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:60: error: forward declaration of ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:93: error: invalid use of incomplete type ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:60: error: forward declaration of ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:95: error: invalid use of incomplete type ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:60: error: forward declaration of ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:96: error: invalid use of incomplete type ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:60: error: forward declaration of ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:99: error: invalid use of incomplete type ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:60: error: forward declaration of ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:100: error: invalid use of incomplete type ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:60: error: forward declaration of ‘struct CvCaptureAVI_FFMPEG’
cvcap_ffmpeg.cpp:100...

Revision history for this message
Gijs Molenaar (gijzelaar) wrote :

I got it working! No need for new ffmpeg. I made a new patch, and I disabled the example Haar app.

Attached is the patch. I made a launchpad PPA with the working packages:
 * https://launchpad.net/~gijzelaar/+archive/opencv

I made a blog post about how to install the new packages:
 * http://gijs.pythonic.nl/blog/2009/may/3/getting-video-io-working-opencv-and-ubuntu-jaunty-/

Revision history for this message
Gijs Molenaar (gijzelaar) wrote :

Got the haar example working now also. Also added missing linkin flags.

I promise this is my final post, since it seems to be 100% working now.

Revision history for this message
Mar (morbus9000+kde) wrote :

Thanks Gijls, openCV now works for me with video.

Revision history for this message
Dan Halbert (dhalbert) wrote :

On jaunty x86_64 I successfully built and tested OpenCV from its SVN trunk, as of 2009-05-18 (1765). I did not have to apply any patches or add links to get it to build. I used the latest ffmpeg -dev libraries from the jaunty repository.

I originally got the img_convert() undeclared error because HAVE_FFMPEG_SWSCALE was not defined, but fixed it by installing libswscale-dev from the jaunty repositories. I also needed various other ffmpeg libraries to get all the features to be included.

I built using cmake, not autoconf: I get various errors trying to build with autoconf.

Revision history for this message
Gijs Molenaar (gijzelaar) wrote :

This bug report is about the 1.0 release.

Using libswscale-dev maybe can help, I didn't find out about that package untill now.

But for now my packages run fine, and no debian or ubuntu people are reacting to the bug reports.

Revision history for this message
seemu (davidvonpku) wrote :

Update: The 1.1pre1 version does not solve the problem yet, cvCreateVideoWriter returns NULL always.

But the current svn version (date: 30-06-09) seems not to have this problem.

Revision history for this message
Taesoo Kim (tsgatesv) wrote :

Hi, all. After I spent a couple of hours to work with ffmpeg, cvCreateVideoWriter in Ubuntu 9.04, I completed to record video with python-opencv binding. To see an example using pygame, python-opencv, visit http://blog.taesoo.org/?p=210 . Thanks.

kecsap (csaba-kertesz)
Changed in opencv (Ubuntu):
assignee: nobody → kecsap (csaba-kertesz)
kecsap (csaba-kertesz)
Changed in opencv (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
kecsap (csaba-kertesz) wrote :

Add a patch to fix the ffmpeg detection in 9.04 and 9.10

Revision history for this message
kecsap (csaba-kertesz) wrote :

Fix several issues in the ffmpeg reader/writer of the OpenCV in 9.04 and 9.10.

Revision history for this message
kecsap (csaba-kertesz) wrote :

In Karmic, my patches replace the 400_ffmpeg_splitting_autofoo.diff and 410_ffmpeg_use_swscale.diff patches.

Revision history for this message
kecsap (csaba-kertesz) wrote :

Fix several issues in the ffmpeg reader/writer of the OpenCV in 8.10.

Revision history for this message
kecsap (csaba-kertesz) wrote :

Fix several issues in the ffmpeg reader/writer of the OpenCV in 8.10.

Revision history for this message
kecsap (csaba-kertesz) wrote :

Fix several issues in the ffmpeg reader/writer of the OpenCV in 8.04.

Revision history for this message
kecsap (csaba-kertesz) wrote :

General comment for the newest patches:

I am an OpenCV developer and I would like to release my own software for Ubuntu and then I faced to this issue: the current OpenCV version is soooo old in the repositories that the ffmpeg part of the library is quite broken. I fixed several issues on this specific part of the library and decided to push upstream fixes for you.

1. I downloaded virtual images of Ubuntu 8.04, 8.10, 9.04 and 9.10.
2. I generated a patch of the upstream fixes (it is a well-separated part of the library, only one file -> no need for several patches).
3. It does not effect other parts of the library.
4. Does not break/modify the API of the module, the changes are done internally.

Basicly, the current patches attached to this bug report contain the same upstream fixes to OpenCV 1.0, but there are small differences of the OpenCV in these distribution versions because of the different patched state of the OpenCV and the differences in the ffmpeg versions. Here is a summary:

Ubuntu 9.10:

- My two patches replaces the 400_xxx.diff and 410_xxx.diff in the debian/patches directory.
- A dependency to libswscale-dev is needed to be added at debian/control.
(- changelog update is needed -> will be added when I upload the new versions of the packages?)

Ubuntu 9.04:

- Two patches 400_xxx.diff and 410_xxx.diff should be added in the debian/patches directory.
- A dependency to libswscale-dev is needed to be added at debian/control.
(- changelog update is needed -> will be added when I upload the new versions of the packages?)

Ubuntu 8.10:

- Only one patch must be added: 410_xxx.diff in the debian/patches directory.
(- changelog update is needed -> will be added when I upload the new versions of the packages?)

Ubuntu 8.04:

- Only one patch must be added: 410_xxx.diff in the debian/patches directory.
(- changelog update is needed -> will be added when I upload the new versions of the packages?)

Tests performed:
1. Execute my own software's unit tests which use reading/writing functions of the OpenCV's ffmpeg module and they were broken before the patch.
2. Execute the sample applications of OpenCV to find any regression.
3. Execute the (unit) tests of the OpenCV to find any regression.

kecsap (csaba-kertesz)
Changed in opencv (Ubuntu):
status: In Progress → Fix Committed
kecsap (csaba-kertesz)
Changed in opencv (Ubuntu):
status: Fix Committed → In Progress
Revision history for this message
Lionel Le Folgoc (mrpouit) wrote :

Only jaunty packages seem to be affected (hardy, intrepid, karmic and lucid package are built with ffmpeg support according to the build log).

Changed in opencv (Ubuntu Jaunty):
status: New → In Progress
importance: Undecided → Low
assignee: nobody → kecsap (csaba-kertesz)
Changed in opencv (Ubuntu):
assignee: kecsap (csaba-kertesz) → nobody
status: In Progress → Fix Released
kecsap (csaba-kertesz)
Changed in opencv (Ubuntu Jaunty):
assignee: kecsap (csaba-kertesz) → nobody
Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Jaunty reached end-of-life on 23 October 2010, so this bug will not be fixed in that version of Ubuntu. It has been fixed in newer versions.

Changed in opencv (Ubuntu Jaunty):
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.