Error in running AppDec

Setup-
Ubuntu: 18.04
Nvidia Driver: 440.33.01
Cuda: 10.2
Video Codec sdk: 9.1.23
GPU: RTX 2080 Ti

Hi,
I am facing issue in getting the video codec apps to run. If I try to run the command
./AppDec -i it throws following error:

[ERROR][07:56:35] General error -1094995529 at line 214 in file ../../NvCodec/../Utils/FFmpegDemuxer.h
[ERROR][07:56:35] No AVFormatContext provided.
NvDecoder : cuvidCreateVideoParser(&m_hParser, &videoParserParameters) returned error 300 at ../../NvCodec/NvDecoder/NvDecoder.cpp:572

I tried the fix of adding line av_register_all(); in *CreateFormatContext func of FFmpegDemuxer.h (as suggested in some forum topics) but then it throws error:

 [INFO ][08:01:19] Media format: QuickTime / MOV (mov,mp4,m4a,3gp,3g2,mj2)
Segmentation fault (core dumped)

the ffmpeg -version command gives:
ffmpeg version N-98364-g3223f6b Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration:
libavutil 56. 55.100 / 56. 55.100
libavcodec 58. 93.102 / 58. 93.102
libavformat 58. 47.100 / 58. 47.100
libavdevice 58. 11.100 / 58. 11.100
libavfilter 7. 86.100 / 7. 86.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100

I am unable to get the setup working.

Hi,
I tried with a fresh setup inside CUDA=10.0 docker(9.1.23 as suggested in ReadMe.txt) and build ffmpeg4.1 from src provided inside the SDK package. Steps I follow:

cd /Video_Codec_SDK_9.1.23/Samples/External/FFmpeg/src/
unzip ffmpeg-4.1.zip
cd ffmpeg-4.1
./configure
make
make install
cd /Video_Codec_SDK_9.1.23/Samples/AppDecode/AppDec/
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:/usr/lib/pkgconfig/
make

It throws following error:

Comparison operator but no version after package name ‘libswresample’ in file ‘/usr/local/lib/pkgconfig/libavcodec.pc’
Comparison operator but no version after package name ‘libswresample’ in file ‘/usr/local/lib/pkgconfig/libavcodec.pc’
g++ -std=c++11 -o AppDec AppDec.o NvDecoder.o -L/usr/local/cuda/lib64/stubs -L…/…/…/Lib/linux/stubs/x86_64 -ldl -lcuda -lnvcuvid
AppDec.o: In function FFmpegDemuxer::FFmpegDemuxer(AVFormatContext*)': AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0x1bf): undefined reference to avformat_find_stream_info’
AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0x1fc): undefined reference to av_find_best_stream' AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0x870): undefined reference to av_init_packet’
AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0x8a0): undefined reference to av_init_packet' AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0x8e5): undefined reference to av_bsf_get_by_name’
AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0x9c4): undefined reference to av_bsf_alloc' AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0xa1f): undefined reference to avcodec_parameters_copy’
AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0xa35): undefined reference to av_bsf_init' AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0xa6a): undefined reference to av_bsf_get_by_name’
AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0xb49): undefined reference to av_bsf_alloc' AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0xba4): undefined reference to avcodec_parameters_copy’
AppDec.cpp:(.text._ZN13FFmpegDemuxerC2EP15AVFormatContext[_ZN13FFmpegDemuxerC5EP15AVFormatContext]+0xbba): undefined reference to av_bsf_init' AppDec.o: In function FFmpegDemuxer::CreateFormatContext(char const*)‘:
AppDec.cpp:(.text._ZN13FFmpegDemuxer19CreateFormatContextEPKc[_ZN13FFmpegDemuxer19CreateFormatContextEPKc]+0x20): undefined reference to avformat_network_init' AppDec.cpp:(.text._ZN13FFmpegDemuxer19CreateFormatContextEPKc[_ZN13FFmpegDemuxer19CreateFormatContextEPKc]+0x42): undefined reference to avformat_open_input’
AppDec.o: In function FFmpegDemuxer::~FFmpegDemuxer()': AppDec.cpp:(.text._ZN13FFmpegDemuxerD2Ev[_ZN13FFmpegDemuxerD5Ev]+0x37): undefined reference to av_packet_unref’
AppDec.cpp:(.text._ZN13FFmpegDemuxerD2Ev[_ZN13FFmpegDemuxerD5Ev]+0x57): undefined reference to av_packet_unref' AppDec.cpp:(.text._ZN13FFmpegDemuxerD2Ev[_ZN13FFmpegDemuxerD5Ev]+0x79): undefined reference to av_bsf_free’
AppDec.cpp:(.text._ZN13FFmpegDemuxerD2Ev[_ZN13FFmpegDemuxerD5Ev]+0x85): undefined reference to avformat_close_input' AppDec.cpp:(.text._ZN13FFmpegDemuxerD2Ev[_ZN13FFmpegDemuxerD5Ev]+0xa6): undefined reference to av_freep’
AppDec.cpp:(.text._ZN13FFmpegDemuxerD2Ev[_ZN13FFmpegDemuxerD5Ev]+0xb6): undefined reference to av_freep' AppDec.cpp:(.text._ZN13FFmpegDemuxerD2Ev[_ZN13FFmpegDemuxerD5Ev]+0xd9): undefined reference to av_free’
AppDec.o: In function FFmpegDemuxer::Demux(unsigned char**, int*, long*)': AppDec.cpp:(.text._ZN13FFmpegDemuxer5DemuxEPPhPiPl[_ZN13FFmpegDemuxer5DemuxEPPhPiPl]+0x7c): undefined reference to av_packet_unref’
AppDec.cpp:(.text._ZN13FFmpegDemuxer5DemuxEPPhPiPl[_ZN13FFmpegDemuxer5DemuxEPPhPiPl]+0xa6): undefined reference to av_read_frame' AppDec.cpp:(.text._ZN13FFmpegDemuxer5DemuxEPPhPiPl[_ZN13FFmpegDemuxer5DemuxEPPhPiPl]+0xf3): undefined reference to av_packet_unref’
AppDec.cpp:(.text._ZN13FFmpegDemuxer5DemuxEPPhPiPl[_ZN13FFmpegDemuxer5DemuxEPPhPiPl]+0x156): undefined reference to av_packet_unref' AppDec.cpp:(.text._ZN13FFmpegDemuxer5DemuxEPPhPiPl[_ZN13FFmpegDemuxer5DemuxEPPhPiPl]+0x17a): undefined reference to av_bsf_send_packet’
AppDec.cpp:(.text._ZN13FFmpegDemuxer5DemuxEPPhPiPl[_ZN13FFmpegDemuxer5DemuxEPPhPiPl]+0x1b1): undefined reference to av_bsf_receive_packet' AppDec.cpp:(.text._ZN13FFmpegDemuxer5DemuxEPPhPiPl[_ZN13FFmpegDemuxer5DemuxEPPhPiPl]+0x2cd): undefined reference to av_malloc’
collect2: error: ld returned 1 exit status
Makefile:33: recipe for target ‘AppDec’ failed
make: *** [AppDec] Error 1

I am stuck at this stage unable to get the sdk working.
Any help will be appreciated.

Thanks.

Hi all,
Seems like Nvidia doesn’t give much attention to the Video Codec section of the forum so took me a lot more time to find a solution and install Video codec SDK.
Steps I followed to install Video codec-

apt-get install build-essential yasm cmake libtool libc6 libc6-dev unzip wget libnuma1 libnuma-dev git pkg-config
mkdir ffmpeg
cd ffmpeg
git clone git.ffmpeg.org Git - ffmpeg.git/summary
in nv-codec-headers github find compatible nv-codec-header and download the zip or tar file(nv-codec-headers-n9.1.23.2.zip for video codec 9.1.23)
unzip nv-codec-headers-n9.1.23.2.zip
cd nv-codec-headers-n9.1.23.2
make install
cd …/ffmpeg
./configure --enable-nonfree --enable-cuda-sdk --enable-cuda-nvcc --disable-optimizations --pkg-config=PKGCONFIG --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 (Proper configure argument is a must)
make -j 6
make install
cd /
cp /path to Video codec/Video_Codec_SDK_9.1.23.zip ./
unzip Video_Codec_SDK_9.1.23.zip
cd Samples/AppDecode/

We can now make all the samples inside this folder(leaving those requiring Vulkan).
The readme and notes inside the sdk do not provide the configure parameter for the FFmpeg to use hardware decode and encode so use according to your need.

Thanks.