参考:
- Pangolin安装error: ‘AV_PIX_FMT_VAAPI_MOCO’ was not declared in this scopelink
- Ubuntu 14.04下安装Pagolin遇到的问题及解决方法(之一)link
- ubuntu 安装Pangolin 过程link
- Pangolin github link
安装之前先装依赖:
sudo apt-get install libglew-dev
安装过程中碰到的问题:
1. pangolin/video/drivers/ffmpeg_common.h:37:39: error: ‘AV_PIX_FMT_VAAPI_MOCO’ was not declared in this scope
2. pangolin/video/drivers/ffmpeg_common.h:37:39: error: ‘AV_PIX_FMT_VAAPI_IDCT’ was not declared in this scope
3. components/pango_video/include/pangolin/video/drivers/ffmpeg_common.h:37:39: error: ‘AV_PIX_FMT_VAAPI_VLD’ was not declared in this scope
4. components/pango_video/src/drivers/ffmpeg.cpp:62:5: error: ‘av_register_all’ was not declared in this scope
av_register_all();
5. error: invalid conversion from ‘const AVInputFormat*’ to ‘AVInputFormat*’ [-fpermissive]
fmt = av_find_input_format(codec_hint.c_str());
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/home/wxf/softwares/3rdparty/Pangolin/components/pango_video/src/drivers/ffmpeg.cpp:120:36: error: ‘AVStream {aka struct AVStream}’ has no member named ‘codec’
if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO)
^~~~~
/home/wxf/softwares/3rdparty/Pangolin/components/pango_video/src/drivers/ffmpeg.cpp:123:42: error: ‘AVStream {aka struct AVStream}’ has no member named ‘codec’
}else if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_AUDIO)
^~~~~
/home/wxf/softwares/3rdparty/Pangolin/components/pango_video/src/drivers/ffmpeg.cpp:139:54: error: ‘AVStream {aka struct AVStream}’ has no member named ‘codec’
pVidCodecCtx = pFormatCtx->streams[videoStream]->codec;
^~~~~
/home/wxf/softwares/3rdparty/Pangolin/components/pango_video/src/drivers/ffmpeg.cpp:142:35: error: invalid conversion from ‘const AVCodec*’ to ‘AVCodec*’ [-fpermissive]
pVidCodec=avcodec_find_decoder(pVidCodecCtx->codec_id);
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/home/wxf/softwares/3rdparty/Pangolin/components/pango_video/src/drivers/ffmpeg.cpp:180:17: error: ‘avpicture_get_size’ was not declared in this scope
numBytesOut=avpicture_get_size(fmtout, w, h);
一般因为命名空间改变,或者命名空间中变量名字的改变导致出现的错误,是版本冲突引起的
解决问题的思路是:
查看ffmpeg的版本
$ ffmpeg -version
ffmpeg version 3.0.12 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --enable-shared --prefix=/usr/local/ffmpeg
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
- Pangolin不处理视频的话,不编译ffmpeg
cd /xxx/Pangolin/components/pango_video
cp CMakeLists.txt CMakeLists1.txt
gedit CMakeLists.txt
删除关于编译FFMPEG的这段
option(BUILD_PANGOLIN_FFMPEG "Build support for ffmpeg video input" ON)
if(BUILD_PANGOLIN_FFMPEG)
find_package(FFMPEG QUIET)
if(FFMPEG_FOUND)
target_sources( ${COMPONENT} PRIVATE
${DRIVER_DIR}/ffmpeg.cpp
${DRIVER_DIR}/ffmpeg_convert.cpp
${DRIVER_DIR}/ffmpeg_output.cpp
)
target_link_libraries(${COMPONENT} PRIVATE ${FFMPEG_LIBRARIES} )
target_include_directories(${COMPONENT} PRIVATE ${FFMPEG_INCLUDE_DIRS} )
PangolinRegisterFactory( VideoInterface FfmpegVideo FfmpegVideoConvert)
PangolinRegisterFactory( VideoOutputInterface FfmpegVideoOutput)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# FFMPEG is a real pain for deprecating the API.
set_source_files_properties(${DRIVER_DIR}/ffmpeg.cpp PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations")
endif()
message(STATUS "ffmpeg Found and Enabled")
endif()
endif()
保存、退出
然后:
make -j6
sudo make install
ldconfig