[Speex-dev] compiling ffmpeg with --enable-libspeex (was Re: from Adobe Flex / Flash Player 10 .flv Speex via Red5 to .wav PCM?)

James Salsman jsalsman at gmail.com
Wed Mar 11 22:52:27 PDT 2009


I am having trouble compiling ffmpeg to support speex, which didn't
work with the ubuntu libspeex-dev package, but looks like it might
with the Speex version 1.2rc1 tarball from http://speex.org/downloads/

How do I tell ffmpeg's configure and/or make to use the 1.2rc1 version
of libspeex in /usr/local/include instead of the older debian/ubuntu
libspeex-dev package in /usr/include/speex?

At present, here is where I am stuck:

~/src/ffmpeg$ make
gcc -L"/home/jsalsman/src/ffmpeg"/libavdevice
-L"/home/jsalsman/src/ffmpeg"/libavformat
-L"/home/jsalsman/src/ffmpeg"/libavcodec
-L"/home/jsalsman/src/ffmpeg"/libavutil -rdynamic -export-dynamic
-Wl,--warn-common -Wl,--as-needed
-Wl,-rpath-link,"/home/jsalsman/src/ffmpeg"/libpostproc
-Wl,-rpath-link,"/home/jsalsman/src/ffmpeg"/libswscale
-Wl,-rpath-link,"/home/jsalsman/src/ffmpeg"/libavfilter
-Wl,-rpath-link,"/home/jsalsman/src/ffmpeg"/libavdevice
-Wl,-rpath-link,"/home/jsalsman/src/ffmpeg"/libavformat
-Wl,-rpath-link,"/home/jsalsman/src/ffmpeg"/libavcodec
-Wl,-rpath-link,"/home/jsalsman/src/ffmpeg"/libavutil -Wl,-Bsymbolic
-o ffmpeg_g ffmpeg.o cmdutils.o -lavdevice -lavformat -lavcodec
-lavutil -lm -lamrnb -lm -lspeex -ldl -ldl
/home/jsalsman/src/ffmpeg/libavcodec/libavcodec.a(libspeexdec.o): In
function `libspeex_decode_close':
/home/jsalsman/src/ffmpeg/libavcodec/libspeexdec.c:127: undefined
reference to `speex_header_free'
collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1

~/src/ffmpeg$ grep speex_header_free /usr/include/speex/*
[no matches]

~/src/ffmpeg$ ls -l /usr/include/speex/
total 76
...
-rw-r--r-- 1 root root 13179 2008-05-07 14:14 speex.h
-rw-r--r-- 1 root root  3720 2008-05-07 14:14 speex_header.h
-rw-r--r-- 1 root root  4456 2008-05-07 14:14 speex_jitter.h
-rw-r--r-- 1 root root  6147 2008-05-07 14:14 speex_preprocess.h
-rw-r--r-- 1 root root  3190 2008-05-07 14:14 speex_stereo.h
-rw-r--r-- 1 root root  4355 2008-05-07 14:14 speex_types.h

I got the speex-1.2rc1 tarball from http://speex.org/downloads/ and
./configure, make, and sudo make install worked fine, placing a
different (and slightly larger) version of the headers in
/usr/local/include/speex/:

~/src/ffmpeg$ grep speex_header_free /usr/local/include/speex/*
/usr/local/include/speex/speex_header.h:void speex_header_free(void *ptr);

Now again, how do I tell ffmpeg's configure and/or make to use the
1.2rc1 version of libspeex in /usr/local/include instead of the older
debian/ubuntu libspeex-dev package in /usr/include/speex?


Background:  It turned out that in order to build ffmpeg with
./configure --enable-libspeex, I apparently needed the debian/ubuntu
package called libspeex-dev. There doesn't seem to be any
documentation hinting at this, and configuring without that package
fails without a really useful or explicit error message to help solve
the problem; please see the transcript excerpts below.

This thread was particularly useful:
  http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2008-October/thread.html#55124

~/src/ffmpeg$ ./configure --enable-libspeex
ERROR: libspeex not found
If you think configure made a mistake, make sure you are using the latest
version from SVN.  If the latest version fails, report the problem to the
ffmpeg-user at mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.err" produced by configure as this will help
solving the problem.

~/src/ffmpeg$ sudo apt-get install libspeex
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libspeex is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libspeex1
E: Package libspeex has no installation candidate

~/src/ffmpeg$ sudo apt-get install libspeex1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  speex
The following NEW packages will be installed:
  libspeex1
0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
Need to get 0B/75.3kB of archives.
After this operation, 184kB of additional disk space will be used.
Selecting previously deselected package libspeex1.
(Reading database ... 22077 files and directories currently installed.)
Unpacking libspeex1 (from .../libspeex1_1.1.12-3ubuntu0.8.04.1_i386.deb) ...
Setting up libspeex1 (1.1.12-3ubuntu0.8.04.1) ...

Processing triggers for libc6 ...
ldconfig deferred processing now taking place

~/src/ffmpeg$ ./configure --enable-libspeex
ERROR: libspeex not found
If you think configure made a mistake, make sure you are using the latest
version from SVN.  If the latest version fails, report the problem to the
ffmpeg-user at mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.err" produced by configure as this will help
solving the problem.

~/src/ffmpeg$ grep -i speex !!$
grep -i speex config.err
# ./configure --enable-libspeex
    libspeex
    libspeex
libspeex_decoder'
FFMPEG_CONFIGURATION='--enable-libspeex'
libspeex='yes'
libspeex_decoder='yes'
libspeex_decoder_deps='libspeex'
opt='--enable-libspeex'
option='libspeex'
optval='--enable-libspeex'
var='libspeex'
check_lib speex/speex.h speex_decoder_init -lspeex
check_header speex/speex.h
    1	#include <speex/speex.h>
/tmp/ffmpeg-conf--17548-.c:1:25: error: speex/speex.h: No such file or directory
ERROR: libspeex not found

~/src/ffmpeg$ sudo apt-get install libspeex-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  libspeex-dev
0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
Need to get 92.8kB of archives.
After this operation, 324kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com hardy-updates/main libspeex-dev
1.1.12-3ubuntu0.8.04.1 [92.8kB]
Fetched 92.8kB in 1s (76.0kB/s)
Selecting previously deselected package libspeex-dev.
(Reading database ... 22083 files and directories currently installed.)
Unpacking libspeex-dev (from
.../libspeex-dev_1.1.12-3ubuntu0.8.04.1_i386.deb) ...
Setting up libspeex-dev (1.1.12-3ubuntu0.8.04.1) ...

~/src/ffmpeg$ ./configure --enable-libspeex
install prefix            /usr/local
....

~/src/ffmpeg$ make
gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I.
-I"/home/jsalsman/src/ffmpeg" -D_ISOC99_SOURCE
-D_POSIX_C_SOURCE=200112 -std=c99 -fomit-frame-pointer -g
-Wdeclaration-after-statement -Wall -Wno-switch
-Wdisabled-optimization -Wpointer-arith -Wredundant-decls
-Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wundef -O3
-fno-math-errno      -MM -MG libavcodec/libspeexdec.c | sed -e
"/^#.*/d" -e "s,^[[:space:]]*libspeexdec\.o,libavcodec/libspeexdec.o,"
-e "s,\([[:space:]]\)\(version\.h\),\1\$(BUILD_ROOT_REL)/\2," >
libavcodec/libspeexdec.d
....
(see eventual error above:
"...src/ffmpeg/libavcodec/libavcodec.a(libspeexdec.o): In function
`libspeex_decode_close':
/home/jsalsman/src/ffmpeg/libavcodec/libspeexdec.c:127: undefined
reference to `speex_header_free')


On Wed, Mar 11, 2009 at 7:14 PM, Keith Kyzivat <kkyzivat at sipez.com> wrote:
>
> I'm quite sure you won't find an answer to the first question here, you'll
> have to ask in some Adobe-Flash centric forums.
> As for the second question, once you have a file with speex audio, you can
> use speexdec (included in speex distribution) to convert it to a PCM Wave
> file (*.wav), or a raw PCM file.
>
> On Wed, Mar 11, 2009 at 4:51 PM, James Salsman <jsalsman at gmail.com> wrote:
>>
>> I am having trouble converting a .flv file uploaded from Adobe Flex /
>> Flash Player 10 to a Red5 server using the speex coder:
>>
>> http://livedocs.adobe.com/flex/3/langref/flash/media/Microphone.html
>>
>> http://jira.red5.org/confluence/display/codecs/Speex+Codec
>>
>> Questions:
>>
>> 1. How do I extract the audio track out of such a .flv file?
>>
>> 2. How do I convert it from Speex to .wav PCM?
>>
>> Thanks.
>> _______________________________________________
>> Speex-dev mailing list
>> Speex-dev at xiph.org
>> http://lists.xiph.org/mailman/listinfo/speex-dev

(cross-posted to ffmpeg-user)


More information about the Speex-dev mailing list