ffmpeg sample code Linux Server Edition

ffmpeg sample code Linux Server Edition

I have made small modifications to the ffmpeg sample decode that is available for the windows edition in order to compile it on the Linux edition. I have it compiling but cannot get the libavformat library to link. I am not terribly familiar with cmake so if someone could point out to me how to link libavformat that would be great.

My error:

pipeline_decode.cpp:(.text+0x252): undefined reference to `av_register_all'
pipeline_decode.cpp:(.text+0x27e): undefined reference to `avformat_open_input'
pipeline_decode.cpp:(.text+0x291): undefined reference to `avformat_find_stream_info'
pipeline_decode.cpp:(.text+0x2a9): undefined reference to `av_dump_format'
pipeline_decode.cpp:(.text+0x342): undefined reference to `avcodec_find_decoder'
pipeline_decode.cpp:(.text+0x363): undefined reference to `avcodec_open2'
pipeline_decode.cpp:(.text+0x3d8): undefined reference to `av_bitstream_filter_init'CMakeFiles/sample_decode_ffmpeg_drm.dir/src/pipeline_decode.cpp.o: In function `FFMPEGReader::Close()':
pipeline_decode.cpp:(.text+0x4d4): undefined reference to `av_bitstream_filter_close'
pipeline_decode.cpp:(.text+0x4dd): undefined reference to `av_close_input_file'
CMakeFiles/sample_decode_ffmpeg_drm.dir/src/pipeline_decode.cpp.o: In function `FFMPEGReader::Reset()':
pipeline_decode.cpp:(.text+0xb90): undefined reference to `av_seek_frame'
CMakeFiles/sample_decode_ffmpeg_drm.dir/src/pipeline_decode.cpp.o: In function `FFMPEGReader::ReadNextFrame(mfxBitstream*)':
pipeline_decode.cpp:(.text+0xbe5): undefined reference to `av_read_frame'
pipeline_decode.cpp:(.text+0xc0f): undefined reference to `av_free_packet'
pipeline_decode.cpp:(.text+0xc73): undefined reference to `av_free_packet'
pipeline_decode.cpp:(.text+0xca5): undefined reference to `avcodec_decode_audio4'
pipeline_decode.cpp:(.text+0xd19): undefined reference to `av_bitstream_filter_filter'
pipeline_decode.cpp:(.text+0xd65): undefined reference to `av_free'
collect2: ld returned 1 exit status
make[2]: *** [__bin/release/sample_decode_ffmpeg_drm] Error 1
make[2]: Leaving directory `/opt/intel/mediasdk/samples/__cmake/intel64.make.release'
make[1]: *** [sample_decode_ffmpeg/CMakeFiles/sample_decode_ffmpeg_drm.dir/all] Error 2
make[1]: Leaving directory `/opt/intel/mediasdk/samples/__cmake/intel64.make.release'

thanks.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I figured this out.

I needed to add:

list( APPEND LIBS dl avformat )

to the CMakeLists.txt file in the code directory. I ran the build.pl script again and it worked fine.

I've played with ffmpeg and had some similiar problems in the past, so I could spend a couple minutes looking at it, but it's hard to say what you did wrong without the makefile. So could you post the makefile?

You probably are linking to the ffmpeg libraries wrong, I found easier to do using .so files in linux.

Leave a Comment

Please sign in to add a comment. Not a member? Join today