Unable to enable libvpx library in ffmpeg from command line

Posted on

Problem :

This is my first question I have asked on superuser, so please be patient with my ignorance if it should surface. I have spent hours and hours trying to figure this one out and would greatly appreciate your help.

I recently installed ffmpeg and it came with many libraries I needed, but it was missing libvpx. I installed the libvpx.tar.bz2 after the fact in the same directories as my other libraries and ran untar. Then I executed the following in the command line from my ffmpeg directory:

./configure --enable-libvpx

It didn’t seem to return any errors but it listed external libraries, enabled decoders, enabled encoders, etc. and at the bottom it said:

Creating config.mak, config.h, and doc/config.texi...
config.h is unchanged
config.asm is unchanged
libavutil/avconfig.h is unchanged

But when I run:

ffmpeg -codecs

It returns:

configuration: --prefix=/usr/local/cpffmpeg --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libopencore-amrnb --enable-decoder=liba52 --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/local/cpffmpeg/include/ --extra-ldflags=-L/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslint

Which does not contain –enable-libvpx. Is there something I am missing? How can I enable libvpx?

I am running CentOS 6.6. Thanks for your help!

Solution :

First, check whether libvpx was actually enabled. My guess is no:

$ grep LIBVPX config.h

Assuming this says 0 (meaning: disabled), figure out why by searching for “-lvpx” in config.log:

check_pkg_config vpx >= 0.9.1 vpx/vpx_decoder.h vpx/vp8dx.h
pkg-config –exists –print-errors vpx >= 0.9.1
check_func_headers vpx/vpx_decoder.h vpx/vp8dx.h vpx_codec_vp8_dx
-I/opt/local/include -L/opt/local/lib -lvpx -lm
check_ld cc -I/opt/local/include -L/opt/local/lib -lvpx -lm
check_cc -I/opt/local/include -L/opt/local/lib
BEGIN /var/folders/fz/vjyfg5z12vj759mhd1t27r_m0000gn/T//ffconf.m3VTrQlx.c
1 #include <vpx/vpx_decoder.h>
2 #include <vpx/vp8dx.h>
3 long check_vpx_codec_vp8_dx(void) { return (long) vpx_codec_vp8_dx; }
4 int main(void) { return 0; }
END /var/folders/fz/vjyfg5z12vj759mhd1t27r_m0000gn/T//ffconf.m3VTrQlx.c
-I/Users/ronaldbultje/Projects/libvpx -I/opt/local/include -std=c99 -fomit-frame-pointer -fPIC -pthread -I/opt/local/include -L/opt/local/lib -c -o /var/folders/fz/vjyfg5z12vj759mhd1t27r_m0000gn/T//ffconf.9gSJKIir.o
clang: warning: argument unused during compilation: ‘-L/opt/local/lib’
gcc -L/Users/ronaldbultje/Projects/libvpx/x86-64 -L/opt/local/lib
-Wl,-dynamic,-search_paths_first -I/opt/local/include -L/opt/local/lib -o /var/folders/fz/vjyfg5z12vj759mhd1t27r_m0000gn/T//ffconf.kMUmUAaJ /var/folders/fz/vjyfg5z12vj759mhd1t27r_m0000gn/T//ffconf.9gSJKIir.o
-lvpx -lm -framework CoreGraphics -lm -llzma -lbz2 -lz -pthread

In your case, you’ll likely see that these tests failed, for example because it couldn’t find the header files or the libs to link against. This is likely caused by not using the correct cflags/libs when trying to link against libvpx. To fix that, use –extra-cflags=.. and –extra-libs=.. when running configure. For example, when you put the libvpx headers in /path/to/libvpx/include and the libraries in /path/to/libvpx/libs, use:

--extra-cflags='-I /path/to/libvpx/include' --extra-libs='-L /path/to/libvpx/libs'

As additional configure options (i.e. in addition to –enable-libvpx). Then, it should work. Alternatively, move libvpx headers to /usr/include and libvpx libraries to /usr/lib, and then it’ll automatically find them. (In typical Linux distributions, this is where the default package manager will put these files.)

Leave a Reply

Your email address will not be published. Required fields are marked *