[Libav-user] undefined reference to av_frame_alloc/free

Jason Blum jason.j.blum at gmail.com
Fri May 30 14:29:25 CEST 2014


>
> >  Do I need to create a ffmpeg package finding module .cmake file to make
> the .so full path appear?
>

Yes, it turns out you do need to use a cmake package finding module. The
full explanation:

Found the answer in some loosely related topics. I can't explain WHY this
works, but it does.

You need to use a package finding .cmake module for ffmpeg. You can find
one here:

https://code.google.com/r/kyberneticist-webport/source/browse/cmake_modules/FindFFMPEG.cmake

After the find_package( ) for catkin, set the CMAKE_MODULE_PATH variable to
where you put the FindFFMPEG.cmake file, assuming your project is
"ardrone_2":

set(CMAKE_MODULE_PATH ${ardrone_2_SOURCE_DIR})

Then use find_package on FFMPEG:

find_package(FFMPEG)

The FindFFMPEG.cmake file sets the FFMPEG_LIBRARIES variable:

set(FFMPEG_LIBRARIES
  ${FFMPEG_LIBAVCODEC}
  ${FFMPEG_LIBAVFORMAT}
  ${FFMPEG_LIBAVUTIL}
)

Setting the CMAKE_MODULE_PATH messes up the whatever directory cmake thinks
it's in, so you need to specify absolute paths when you use add_executable(
), assuming your package is "ardrone_2":

add_executable(h264_decoder_node
${ardrone_2_SOURCE_DIR}/src/h264_decoder.cpp)

Then link using that variable:

target_link_libraries(h264_decoder_node ${catkin_LIBRARIES}
${FFMPEG_LIBRARIES} swscale)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140530/7ee71227/attachment.html>


More information about the Libav-user mailing list