2016-04-21 186 views
0

我对树莓2 ,我在这一步卡住编译的OpenCV编译OpenCV的,上树莓派2

[ 18%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o 

与返回了很多的错误,我只拿开始时的2,其他的他们看起来是一样的,但 不同的{ CODEC_ID_H264, MKTAG('h', '2', '6', '4') },

In file included from /home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:60:0, 
       from /home/pi/opencv/modules/highgui/src/cap_ffmpeg.cpp:45: 
/home/pi/opencv/modules/highgui/src/ffmpeg_codecs.hpp:104:7: error: 'CODEC_ID_H264' was not  declared in this scope 
    { CODEC_ID_H264, MKTAG('H', '2', '6', '4') }, 
    ^
/home/pi/opencv/modules/highgui/src/ffmpeg_codecs.hpp:105:7: error: 'CODEC_ID_H264' was not  declared in this scope 
    { CODEC_ID_H264, MKTAG('h', '2', '6', '4') }, 
    ^

和最后一部分是关于

/home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function 'double  CvCapture_FFMPEG::get_fps()': 
/home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:821:49: error: 'AVStream' has no member named 'r_frame_rate' 
    double fps = r2d(ic->streams[video_stream]->r_frame_rate); 
              ^
In file included from /home/pi/opencv/modules/highgui/src/cap_ffmpeg.cpp:45:0: 
/home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp: In function 'int   icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)': 
/home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:1237:72: error: 'avcodec_encode_video'  was not declared in this scope 
     out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture); 
                    ^
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:215: 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:1823: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all'  failed 
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 
Makefile:137: recipe for target 'all' failed 

请帮我这个当我得到它stucked很长一段时间后,尝试几次,谢谢

+0

或者,有没有什么办法可以为Raspberry Pi编译一个bin? –

回答

0

这个错误可能是由于您使用的是从仓库的ffmpeg的事实。从源代码构建OpenCV时,强烈建议您也建立各自的ffmpeg版本。从您的Pi中删除ffmpegx264的任何安装,然后进行构建。

检查this guide here了解更多信息。

+0

非常感谢,它做到了 –

+0

很高兴。 :)也许标记我的帖子为答案(因为它是:D)? – rbaleksandar

+0

这似乎不适合我。 运行时 './configure --enable-shared --disable-static --cross-prefix = arm-xilinx-linux-gnueabi- -arch = armv7l --target-os = linux --prefix = ' 即时得到这种错误的(如在共享链路you'v指定): 'BEGIN /tmp/ffconf.LHUE6snE.c INT主(无效){返回0; } END /tmp/ffconf.LHUE6snE.c arm-xilinx-linux-gnueabi-gcc -mcpu = -c -o /tmp/ffconf.kpNuXlt1.o /tmp/ffconf.LHUE6snE.c ./configure:884 :./configure:arm-xilinx-linux-gnueabi-gcc:找不到 C编译器测试失败。“ 任何想法可能工作? – frmsaul