CMake FFmpeg Tip

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

ldo
Posts: 544
Joined: Sun Nov 07, 2010 11:30 pm
Location: Hamilton, New Zealand

CMake FFmpeg Tip

Postby ldo » Sun Nov 25, 2012 4:09 am

I have FFmpeg built from source on my system, to get around outdated distro packages. I also have a lot of additional functionality enabled, which means my FFmpeg libraries depend on a whole bunch of additional libraries like faac and faad, lame, schrödinger, theora and so on.

My first thought was to add these extra libraries to the CMAKE_EXE_LINKER_FLAGS variable. This is not the place, because the expansion of this variable is included at the wrong point in the final link command, where they will not be used to resolve undefined symbols in the FFmpeg libraries. As a result, your link will fail.

To ensure these libraries are included at the right place, put them on the end of the FFMPEG_LIBRARIES value, after the FFmpeg libraries proper. They will similarly be included immediately after the FFmpeg libraries in the link command, thereby correctly resolving the necessary symbols.

For example, my FFMPEG_LIBRARIES definition currently looks like this (all on one line):

Code: Select all

FFMPEG_LIBRARIES="avdevice;avfilter;avformat;avcodec;avutil;swscale;swresample;postproc;nut;bz2;faac;faad;gsm;jack;modplug;mp3lame;opencore-amrnb;opencore-amrwb;rtmp;schroedinger-1.0;speex;theoraenc;theoradec;vpx;x264;xvidcore"


Everything up to and including “postproc” is an FFmpeg library; everything after that is a non-FFmpeg library needed to resolve dependencies in the FFmpeg libraries.

Return to “Coding Blender”

Who is online

Users browsing this forum: No registered users and 0 guests