Ошибки при установке OpenCV и FFMPEG через Rightscripts

Я пишу RightScript для установки OpenCV-2.3.1 на сервер Linux. Я использую пакет FFMPEG: ffmpeg-0.7-rc1

Я делаю то же самое, что и при ручной установке на сервер, но получаю некоторые ошибки, когда пытаюсь загрузить коробку с помощью правых скриптов. OpenCV устанавливается и отлично работает при сборке вручную через bash.

Ошибки, которые я получаю:

In file included from /OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg.cpp:45:
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function 'void CvCapture_FFMPEG::close()':
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:451: warning: 'void av_close_input_file(AVFormatContext*)' is deprecated (declared at /usr/local/include/libavformat/avformat.h:1533)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:451: warning: 'void av_close_input_file(AVFormatContext*)' is deprecated (declared at /usr/local/include/libavformat/avformat.h:1533)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function 'bool CvCapture_FFMPEG::reopen()':
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:483: warning: 'void av_close_input_file(AVFormatContext*)' is deprecated (declared at /usr/local/include/libavformat/avformat.h:1533)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:483: warning: 'void av_close_input_file(AVFormatContext*)' is deprecated (declared at /usr/local/include/libavformat/avformat.h:1533)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:486: error: 'av_open_input_file' was not declared in this scope
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:487: warning: 'int av_find_stream_info(AVFormatContext*)' is deprecated (declared at /usr/local/include/libavformat/avformat.h:1357)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:487: warning: 'int av_find_stream_info(AVFormatContext*)' is deprecated (declared at /usr/local/include/libavformat/avformat.h:1357)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:494: error: 'avcodec_thread_init' was not declared in this scope
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:497: warning: 'int avcodec_open(AVCodecContext*, AVCodec*)' is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3380)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:497: warning: 'int avcodec_open(AVCodecContext*, AVCodec*)' is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3380)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function 'bool CvCapture_FFMPEG::open(const char*)':
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:524: error: 'av_open_input_file' was not declared in this scope
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:529: warning: 'int av_find_stream_info(AVFormatContext*)' is deprecated (declared at /usr/local/include/libavformat/avformat.h:1357)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:529: warning: 'int av_find_stream_info(AVFormatContext*)' is deprecated (declared at /usr/local/include/libavformat/avformat.h:1357)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:541: error: 'avcodec_thread_init' was not declared in this scope
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:550: warning: 'int avcodec_open(AVCodecContext*, AVCodec*)' is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3380)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:550: warning: 'int avcodec_open(AVCodecContext*, AVCodec*)' is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3380)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In function 'AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, CodecID, int, int, int, double, int)':
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:999: warning: 'AVStream* av_new_stream(AVFormatContext*, int)' is deprecated (declared at /usr/local/include/libavformat/avformat.h:1557)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:999: warning: 'AVStream* av_new_stream(AVFormatContext*, int)' is deprecated (declared at /usr/local/include/libavformat/avformat.h:1557)
In file included from /OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg.cpp:45:
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In function 'int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)':
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1121: warning: 'int avcodec_encode_video(AVCodecContext*, uint8_t*, int, const AVFrame*)' is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4077)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1121: warning: 'int avcodec_encode_video(AVCodecContext*, uint8_t*, int, const AVFrame*)' is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4077)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function 'void CvVideoWriter_FFMPEG::close()':
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1298: error: 'url_fclose' was not declared in this scope
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function 'bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, bool)':
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1411: error: 'av_set_parameters' was not declared in this scope
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1415: error: 'dump_format' was not declared in this scope
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1442: warning: 'int avcodec_open(AVCodecContext*, AVCodec*)' is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3380)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1442: warning: 'int avcodec_open(AVCodecContext*, AVCodec*)' is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3380)
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1479: error: 'URL_WRONLY' was not declared in this scope
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1479: error: 'url_fopen' was not declared in this scope
/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1485: error: 'av_write_header' was not declared in this scope
20:09:04: make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.o] Error 1
20:09:04: make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
20:09:04: make: *** [all] Error 2
20:09:04: cd: 23: can't cd to /root/OpenCV-2.3.1/samples/c
20:09:04: chmod: cannot access `build_all.sh': No such file or directory
20:09:04: /var/cache/rightscale/right_scripts/right_scripts_cookbook/recipes/CVScripts___Install_OpenCV: 25: ./build_all.sh: not found
*ERROR> Chef converge failed
*ERROR> An external command returned an error during the execution of Chef:

Я выполнил поиск в Google и понял, что некоторые функции FFMPEG устарели. Я также попытался установить последний пакет FFMPEG, и я получаю те же ошибки. Кроме того, мне интересно, почему я не получаю эти ошибки, когда устанавливаю его вручную на сервер через bash, а только при установке с помощью Rightscripts.


person Giridhar Murali    schedule 13.06.2012    source источник


Ответы (3)


Использование пакета FFMPEG ffmpeg-0.8 решает проблему. Он отлично работает с OpenCV-2.3.1. Недавно было внесено несколько исправлений в FFMPEG, что приводит к некоторым конфликтам. ffmpeg-0.8 стабилен и отлично работает.

person Giridhar Murali    schedule 15.06.2012

Мне не нужен ffmpeg, так как я идентифицирую только изображения, поэтому используйте эту опцию, чтобы пропустить комбинированный видеомодуль:

make -DWITH_FFMPEG=OFF xxxxxx

person Xiaohui Zhang    schedule 02.06.2015

Вам также необходимо установить пакет ffmpeg-dev, если он есть в вашем дистрибутиве. Если нет, вам может потребоваться установить libavcodec-dev, libavformat-dev и libswscale-dev.

Если они у вас установлены, но сборка OpenCV по-прежнему не может их найти, возможно, это связано с тем, что pkg-config не может найти заголовки ffmpeg. Эта информация обычно находится в /usr/lib/pkgconfig, что означает, что вам, возможно, придется добавить правильный путь вручную, если у вас другой путь. Например, если файлы ffmpeg для pkg-config расположены по адресу /usr/local/lib/pkgconfig, перед повторным запуском CMake следует выполнить:

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
person karlphillip    schedule 14.06.2012
comment
Во-первых, нет пакета ffmpeg-dev. Системе не удалось найти такой пакет. Я загружаю пакет ffmpeg, компилирую и устанавливаю его. Я уже установил libavformat-dev, но не libavcodec-dev. Пробовал установить libavcodec-dev и перезагрузить бокс, но ошибки все равно сохраняются. - person Giridhar Murali; 14.06.2012
comment
Я проверил, и в PKG_CONFIG_PATH уже есть /usr/local/lib/pkgconfig. Облом! Любые другие идеи? - person Giridhar Murali; 14.06.2012