[Libav-user] statically linking x264 and x265 into ffmpeg

Peter Steinbach steinbach at scionics.de
Tue Sep 6 11:14:00 EEST 2016


Hi to all,

for a project, I'd like to bundle ffmpeg statically. The project itself 
is cross-platform, which is proving to be a challenge.

For this, I'd like to build ffmpeg statically and link in libx264 and 
libx265 so that I only have to link my library in turn to ffmpeg and be 
done with it. I started to experiment with this on Linux. In order to 
achieve that, I compiled both libx264 and libx265 statically with 
--enable-pic (my distro only ships static libs with -fPIE :( ).

I then build ffmpeg with the following flags:
$ ./configure --prefix=/tmp/master-x264-x265-minimal --enable-static 
--enable-pic --disable-everything --disable-programs --enable-libx264 
--enable-libx265 --enable-gpl

When running "make V=1" and inspecting the gcc calls, I can however not 
see where both libx26* are linked into ffmpeg. I also inspected 
libavcodec, but couldn't find any (undefined) symbols of h264 or h265. I 
only saw
$ nm *.a | egrep -i "(264|hevc)"
                  U ff_h264_profiles
                  U ff_hevc_profiles
0000000000000340 D ff_h264_profiles
00000000000002e0 D ff_hevc_profiles
...

The pkgconfig files generated however contain direct references to 
"-lx26?". Excuse me if I am overseeing something obvious. I tried this 
with master from 10minutes ago and 3.0.2

So my question is, how can I link x264 and x265 into libavcodec so that 
symbols/objects from these dependencies are imported into libav* 
completely?
Best,
Peter


More information about the Libav-user mailing list