I am relatively new to the encoding and decoding techniques and have been trying to get down the bandwidth while using H264 / H265 video stream for object detection using YOLO. I found that NVIDIA has this Video Codec SDK has API’s for this, however when I try to build the Samples, I’m getting the following error. ffmpeg is already installed on my laptop (Ubuntu 16.04 LTS host) and is configured to enable all libraries required. I followed the README and included all the packages in respective PATH’s in the system variables. If anyone has any idea on how to follow up for the same, please let me know. Thanks!
Error as follows:
sindhura@sindhura-Lenovo-ideapad-Y700-15ISK:~/Downloads/Video_Codec_SDK_8.2.15/Samples$ make
make -C AppDecode/AppDec
make[1]: Entering directory ‘/home/sindhura/Downloads/Video_Codec_SDK_8.2.15/Samples/AppDecode/AppDec’
g++ -std=c++11 -I/usr/local/cuda/include -I…/…/NvCodec -I…/…/NvCodec/NvDecoder -I…/…/NvCodec/NvEncoder -I…/…/NvCodec/Common -o AppDec.o -c AppDec.cpp
In file included from AppDec.cpp:18:0:
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:26:5: error: ‘AVBSFContext’ does not name a type
AVBSFContext bsfc = NULL;
^
…/…/NvCodec/…/Utils/FFmpegDemuxer.h: In constructor ‘FFmpegDemuxer::FFmpegDemuxer(AVFormatContext)’:
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:57:52: error: ‘AVStream {aka struct AVStream}’ has no member named ‘codecpar’
eVideoCodec = fmtc->streams[iVideoStream]->codecpar->codec_id;
^
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:58:47: error: ‘AVStream {aka struct AVStream}’ has no member named ‘codecpar’
nWidth = fmtc->streams[iVideoStream]->codecpar->width;
^
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:59:48: error: ‘AVStream {aka struct AVStream}’ has no member named ‘codecpar’
nHeight = fmtc->streams[iVideoStream]->codecpar->height;
^
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:61:42: error: ‘AVStream {aka struct AVStream}’ has no member named ‘codecpar’
if (fmtc->streams[iVideoStream]->codecpar->format == AV_PIX_FMT_YUV420P10LE)
^
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:63:42: error: ‘AVStream {aka struct AVStream}’ has no member named ‘codecpar’
if (fmtc->streams[iVideoStream]->codecpar->format == AV_PIX_FMT_YUV420P12LE)
^
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:80:81: error: ‘av_bsf_get_by_name’ was not declared in this scope
const AVBitStreamFilter bsf = av_bsf_get_by_name(“h264_mp4toannexb”);
^
In file included from AppDec.cpp:17:0:
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:85:35: error: ‘bsfc’ was not declared in this scope
ck(av_bsf_alloc(bsf, &bsfc));
^
…/…/NvCodec/…/Utils/NvCodecUtils.h:112:24: note: in definition of macro ‘ck’ #define ck(call) check(call, LINE, FILE)
^
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:85:39: error: ‘av_bsf_alloc’ was not declared in this scope
ck(av_bsf_alloc(bsf, &bsfc));
^
…/…/NvCodec/…/Utils/NvCodecUtils.h:112:24: note: in definition of macro ‘ck’ #define ck(call) check(call, LINE, FILE)
^
In file included from AppDec.cpp:18:0:
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:86:57: error: ‘AVStream {aka struct AVStream}’ has no member named ‘codecpar’
bsfc->par_in = fmtc->streams[iVideoStream]->codecpar;
^
In file included from AppDec.cpp:17:0:
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:87:32: error: ‘av_bsf_init’ was not declared in this scope
ck(av_bsf_init(bsfc));
^
…/…/NvCodec/…/Utils/NvCodecUtils.h:112:24: note: in definition of macro ‘ck’ #define ck(call) check(call, LINE, FILE)
^
…/…/NvCodec/…/Utils/FFmpegDemuxer.h: In member function ‘bool FFmpegDemuxer::Demux(uint8_t*, int*)’:
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:183:35: error: ‘bsfc’ was not declared in this scope
ck(av_bsf_send_packet(bsfc, &pkt));
^
…/…/NvCodec/…/Utils/NvCodecUtils.h:112:24: note: in definition of macro ‘ck’ #define ck(call) check(call, LINE, FILE)
^
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:183:45: error: ‘av_bsf_send_packet’ was not declared in this scope
ck(av_bsf_send_packet(bsfc, &pkt));
^
…/…/NvCodec/…/Utils/NvCodecUtils.h:112:24: note: in definition of macro ‘ck’ #define ck(call) check(call, LINE, FILE)
^
…/…/NvCodec/…/Utils/FFmpegDemuxer.h:184:56: error: ‘av_bsf_receive_packet’ was not declared in this scope
ck(av_bsf_receive_packet(bsfc, &pktFiltered));
^
…/…/NvCodec/…/Utils/NvCodecUtils.h:112:24: note: in definition of macro ‘ck’ #define ck(call) check(call, LINE, FILE)
^
Makefile:28: recipe for target ‘AppDec.o’ failed
make[1]: *** [AppDec.o] Error 1
make[1]: Leaving directory ‘/home/sindhura/Downloads/Video_Codec_SDK_8.2.15/Samples/AppDecode/AppDec’
Makefile:31: recipe for target ‘AppDecode/AppDec’ failed
make: *** [AppDecode/AppDec] Error 2
There is a bug in the Makefile for AppDec (and a few other applications that depend on FFmpeg), due to which the path for the FFmpeg header files is not added to the list of included paths during compilation. This bug will usually show up only when the FFmpeg header files and libraries are installed to a location other than the default.
The fix for this is to add the line:
INCLUDES += $(shell pkg-config --cflags libavcodec libavutil libavformat)
to the end of common.mk in the Samples folder. This bug will be fixed in SDK 9.0.
I assume that the errors related to AVBSFContext and other symbols not being declared/defined is because of the installation of FFmpeg header files corresponding to an older FFmpeg version to one of the default include locations searched by the compiler.
I get exactly the same error, that people in this page have reported.
I have made the changes you suggested, but get the same error. I will be glad to know I the issue was resolved with above changes. Please suggest me what changes, I should make apart from what was suggested by @rypark.
I’m getting the same issue on Ubuntu 16.04 where libavcodec-dev is at version 2.8.15 the Nvidia Codec SDK is at version 9.1.23. The first reference to AVBSFContext is in version 4.0 of libavcodec-dev. What is the minimum required version of libavcodec-dev to build the samples? What is the recommended way to install this version that is compatible with the nvidia samples on Ubuntu16.04?
TL;DR;
The build is choking on
Video_Codec_SDK_9.1.23/Samples/AppDecode/AppDecPerf$ make
g++ -std=c++11 -I/usr/local/cuda/include -I../../NvCodec -I../../NvCodec/NvDecoder -I../../NvCodec/NvEncoder -I../../NvCodec/Common -I../../../include -I/usr/include/x86_64-linux-gnu -o AppDecPerf.o -c AppDecPerf.cpp
In file included from AppDecPerf.cpp:35:0:
../../NvCodec/../Utils/FFmpegDemuxer.h:35:5: error: ‘AVBSFContext’ does not name a type
AVBSFContext *bsfc = NULL;
^
My libavcodec-dev is installed in the standard location