2017-10-23 8 views
4

Ich habe ffmpeg entsprechend article installiert. ffmpeg Installation war in Ordnung. Jetzt baue ich Opencv mit ffmpeg Unterstützung und ich habe einige Fehler. Die Fehler sindFehler beim Aufbau opencv mit ffmpeg

/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1484:21: error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope 
     c->flags |= CODEC_FLAG_GLOBAL_HEADER; 
        ^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)’: 
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1512:30: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope 
    if (oc->oformat->flags & AVFMT_RAWPICTURE) { 
          ^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘void CvVideoWriter_FFMPEG::close()’: 
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1686:35: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope 
     if((oc->oformat->flags & AVFMT_RAWPICTURE) == 0) 
           ^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, bool)’: 
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1920:32: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope 
    if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) { 
           ^
In file included from /home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg.cpp:45:0: 
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In static member function ‘static AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext*, AVCodecID, int, int, int, double, AVPixelFormat)’: 
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:2214:25: error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope 
      c->flags |= CODEC_FLAG_GLOBAL_HEADER; 
         ^
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:230: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o' failed 
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o] Error 1 
CMakeFiles/Makefile2:2349: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed 

Was könnte falsch sein?

+0

Die gleichen Probleme mit Ubuntu 16.04, ffmpeg von github und opencv 3.3.0. – Anonymous

+0

@ Anonym ja ja Ubuntu 16.04 und opencv 2.4.13.4. Wie löst man das Problem? – batuman

+2

Das ist der Versionskonflikt. OpenCV wurde nicht aktualisiert, um der neuesten Version von ffmpeg zu entsprechen. Ich habe von diesem Link (http://ffmpeg.org/releases/) zur früheren Version von ffmpeg gewechselt und mit --enable-shared flag kompiliert, jetzt ist es ok. – batuman

Antwort

6

Meine Lösung ist, die fehlenden definiert (insgesamt 2) von FFmpeg unter Verwendung grep -r, die in libavcodec/avcodec.h gefunden wie dem folgenden Code führt zu grep:

#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22) 
#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER 
#define AVFMT_RAWPICTURE 0x0020 

kopieren und fügen sie es an die Spitze von:

opencv-3.3.0/modules/videoio/src/cap_ffmpeg_impl.hpp 

Compile und alles funktioniert auch mit den neuesten Quellen