Page 1 of 1

how to build vlc with aac (mp4a) and mp3 support

Posted: 10 Jan 2009 19:55
by marrem
I wanted to build vlc with x264, aac and mp3 support.

I have debian 'lenny' testing, and added the debian-multimedia repository.

I have installed the vlc build-deps (with apt-get).
I have installed the debian multimedia repos versions of libx264, libfaac and libmp3lame.

I have built and installed x264 and ffmpeg from source.

ffmpeg is able to encode video's to mp4 with h264 video and aac audio. I also recoded some aac audio files to mp3.

This is what is says when run:

Code: Select all

ffmpeg FFmpeg version SVN-r16517, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --enable-pthreads --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libx264 --enable-gpl --enable-postproc --enable-swscale --extra-cflags=-I/usr/local/lib --extra-ldflags=-L/usr/local/lib libavutil 49.12. 0 / 49.12. 0 libavcodec 52.10. 0 / 52.10. 0 libavformat 52.23. 1 / 52.23. 1 libavdevice 52. 1. 0 / 52. 1. 0 libswscale 0. 6. 1 / 0. 6. 1 libpostproc 51. 2. 0 / 51. 2. 0 built on Jan 10 2009 14:01:02, gcc: 4.3.2
I downloaded the vlc source (v 0.9.8a).

I configured with these options:
(most taken from and older debian source package)

Code: Select all

./configure \ --enable-release \ --enable-libtool \ --disable-gnome \ --disable-gtk \ --disable-familiar \ --disable-fb \ --enable-ggi \ --enable-sdl \ --enable-esd \ --disable-qt \ --enable-mad \ --enable-arts \ --enable-jack \ --enable-lirc \ --enable-a52 \ --enable-aa \ --enable-dvbpsi \ --enable-mozilla \ --disable-kde \ --enable-mp4 \ --enable-dvb \ --disable-satellite \ --enable-ogg \ --enable-vorbis \ --enable-wxwidgets \ --with-wx-config=wx-config \ --disable-slp \ --enable-flac \ --disable-skins \ --disable-basic-skins \ --disable-skins2 \ --enable-freetype \ --enable-mkv \ --enable-speex \ --enable-caca \ --disable-live555 \ --enable-libmpeg2 \ --enable-dca \ --enable-fribidi \ --enable-cdio \ --enable-mod \ --enable-theora \ --enable-modplug \ --enable-dvdnav \ --enable-gnutls \ --enable-ffmpeg \ --with-ffmpeg-mp3lame \ --with-ffmpeg-faac \ --with-ffmpeg-config-path=/usr/local/bin/ffmpeg-config \ --enable-ncurses \ --enable-smb \ --disable-gnomevfs \ --enable-bonjour \ --enable-mpc \ --enable-vcd \ --enable-vcdx \ --enable-xosd \ --enable-twolame \ --enable-notify \ --enable-faad \ --enable-mediacontrol-bindings \ --enable-x264 \ CFLAGS=-I/usr/local/lib \ LDFLAGS=-L/usr/local/lib
I added the CF and LD flag so the build processes can find the x264 and ffmpeg libs and include files.

After building and installing it turns out, vlc can encode h264, but doesn't know how to encode aac/mp4a nor mp3.

Strange thing is that when I run:

./configure --help

there are no options regarding mp4a, aac (except libfaad (aac decodig)) or mp3.

marc@thirdworld:/usr/src/vlc-0.9.8a$ ./configure --help | grep mp3
marc@thirdworld:/usr/src/vlc-0.9.8a$ ./configure --help | grep aac
marc@thirdworld:/usr/src/vlc-0.9.8a$ ./configure --help | grep mp4

so how do I tell the build process to enable these capabilities.

Anyway when I run vlc, it says:

Code: Select all

VLC media player 0.9.8a Grishenko [00000001] main libvlc debug: VLC media player - version 0.9.8a Grishenko - (c) 1996-2008 the VideoLAN team [00000001] main libvlc debug: libvlc was configured with ./configure '--enable-release' '--enable-libtool' '--disable-gnome' '--disable-gtk' '--disable-familiar' '--disable-fb' '--enable-ggi' '--enable-sdl' '--enable-esd' '--disable-qt' '--enable-mad' '--enable-arts' '--enable-jack' '--enable-lirc' '--enable-a52' '--enable-aa' '--enable-dvbpsi' '--enable-mozilla' '--disable-kde' '--enable-mp4' '--enable-dvb' '--disable-satellite' '--enable-ogg' '--enable-vorbis' '--enable-wxwidgets' '--with-wx-config=wx-config' '--disable-slp' '--enable-flac' '--disable-skins' '--disable-basic-skins' '--disable-skins2' '--enable-freetype' '--enable-mkv' '--enable-speex' '--enable-caca' '--disable-live555' '--enable-libmpeg2' '--enable-dca' '--enable-fribidi' '--enable-cdio' '--enable-mod' '--enable-theora' '--enable-modplug' '--enable-dvdnav' '--enable-gnutls' '--enable-ffmpeg' '--with-ffmpeg-mp3lame' '--with-ffmpeg-faac' '--with-ffmpeg-config-path=/usr/local/bin/ffmpeg-config' '--enable-ncurses' '--enable-smb' '--disable-gnomevfs' '--enable-bonjour' '--enable-mpc' '--enable-vcd' '--enable-vcdx' '--enable-xosd' '--enable-twolame' '--enable-notify' '--enable-faad' '--enable-mediacontrol-bindings' '--enable-x264' 'CFLAGS=-I/usr/local/lib' 'LDFLAGS=-L/usr/local/lib' [00000001] main libvlc debug: translation test: code is "C"
So what do I do to enable mp3 and aac encoding?

Re: how to build vlc with aac (mp4a) and mp3 support

Posted: 10 Jan 2009 20:08
by xtophe
First i don't see the point to get x264 from debian multimedia and compile it
then the ffmpeg detection in configure depends on pkg-config. So you should add a PKG_CONFIG_PATH=usr/local/lib/pkgconfig
Then check config.log and vlc-config to see if -lmp3lame and -lfaac are correctly added to the ldflags of the avcodec modue

Re: how to build vlc with aac (mp4a) and mp3 support

Posted: 11 Jan 2009 17:16
by marrem
Hi Xtophe,
First i don't see the point to get x264 from debian multimedia and compile it
then the ffmpeg detection in configure depends on pkg-config. So you should add a PKG_CONFIG_PATH=usr/local/lib/pkgconfig
Then check config.log and vlc-config to see if -lmp3lame and -lfaac are correctly added to the ldflags of the avcodec modue
I did try the debian-multimedia versions of ffmpeg and x264, but they gave me trouble encoding h264 at reasonably constant bitraties (encoding files with ffmpeg, that is). That's why I built the latest versions from source. The latest ffmpeg has (contrary to the version from deb-mm) included in the sources, some preset files for x264 compression. Using these gives very good results. Unfortunately using these preset files with the deb-mm version of ffmpeg didn't work. The x264 bitrate sank to very low values. Because of these ffmpeg woes, I compiled ffmpeg and x264 from source.

Since there is no vlc in debian-mm I had to build this myself as well.

Now I have added the PKG_CONFIG_PATH to my configure run. I also chucked out lots of other stuff that I don't need. I only use vlc to stream and record from my dvb sat card, operating vlc via the command line.

Now the configure I did looks like:

Code: Select all

./configure \ --enable-release \ --enable-libtool \ --disable-gnome \ --disable-gtk \ --disable-familiar \ --disable-fb \ --enable-a52 \ --enable-aa \ --enable-mp4 \ --enable-dvb \ --enable-dvbpsi \ --enable-ogg \ --enable-vorbis \ --enable-flac \ --disable-skins \ --disable-basic-skins \ --disable-skins2 \ --enable-mkv \ --enable-speex \ --disable-live555 \ --enable-libmpeg2 \ --enable-dca \ --enable-theora \ --enable-gnutls \ --enable-ffmpeg \ --with-ffmpeg-mp3lame \ --with-ffmpeg-faac \ --with-ffmpeg-config-path=/usr/local/bin/ffmpeg-config \ --enable-faad \ --enable-x264 \ --enable-ncurses \ --enable-twolame \ --enable-notify \ CFLAGS=-I/usr/local/lib \ LDFLAGS=-L/usr/local/lib \ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
You wrote "PKG_CONFIG_PATH=usr/local/lib/pkgconfig". I assumed that should be absolute path.

I did a 'make distclean' and then I ran the configure command described above.

Code: Select all

Then check config.log and vlc-config to see if -lmp3lame and -lfaac are correctly added to the ldflags of the avcodec modue
marc@thirdworld:/usr/src/vlc-0.9.8a$ grep lfaac config.log
marc@thirdworld:/usr/src/vlc-0.9.8a$ grep lfaac vlc-config
marc@thirdworld:/usr/src/vlc-0.9.8a$ grep lmp3lame config.log
marc@thirdworld:/usr/src/vlc-0.9.8a$ grep lmp3lame vlc-config

Alas I don't see them in said files.

By the way how do you tell configure you want mp3/lame and faac:

marc@thirdworld:/usr/src/vlc-0.9.8a$ ./configure --help | grep mp3
marc@thirdworld:/usr/src/vlc-0.9.8a$ ./configure --help | grep faac
marc@thirdworld:/usr/src/vlc-0.9.8a$ ./configure --help | grep lame
--enable-twolame twolame codec (default disabled)
--with-twolame-tree=PATH twolame tree for static linking

So are those --with-ffmpeg-faac and --with-ffmpeg--libmp3lame flags deprecated?

Regards,
Marc

Re: how to build vlc with aac (mp4a) and mp3 support

Posted: 11 Jan 2009 17:56
by xtophe
So are those --with-ffmpeg-faac and --with-ffmpeg--libmp3lame flags deprecated?

Indeed, they are. --with-ffmpeg-config is also deprecated.

in config.log it would be good to check that it use the pkg-config method to detect the avcodec flags and not one of the other ones.

Also you could check that libavcodec.pc has the -lfaac and -lmp3lame

Re: how to build vlc with aac (mp4a) and mp3 support

Posted: 11 Jan 2009 21:48
by marrem
Indeed, they are. --with-ffmpeg-config is also deprecated.

in config.log it would be good to check that it use the pkg-config method to detect the avcodec flags and not one of the other ones.

Also you could check that libavcodec.pc has the -lfaac and -lmp3lame
How then do I tell configure that I want faac, libmp3lame support?


I did 'make distclean' and repeated configure (without the deprecated options).

config.log:

Code: Select all

[...] onfigure:30784: checking for pkg-config configure:30802: found /usr/bin/pkg-config configure:30814: result: /usr/bin/pkg-config configure:30843: checking pkg-config is at least version 0.9.0 configure:30846: result: yes [...] configure:44996: checking for AVCODEC configure:45004: $PKG_CONFIG --exists --print-errors "libavcodec libavutil" configure:45007: $? = 0 configure:45022: $PKG_CONFIG --exists --print-errors "libavcodec libavutil"configure:45025: $? = 0 configure:45073: result: yes configure:45102: checking libavcodec/avcodec.h usability configure:45119: gcc -std=gnu99 -c -I/usr/local/lib -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wmiss ing-prototypes -Wvolatile-register-var -I/usr/local/include -DSYS_LINUX -I/us r/local/include conftest.c >&5configure:45125: $? = 0configure:45139: result: yes [...]

What are the 'libavcodec flags' sections I ought to look out for in config.log?
And what are 'the other methods' they could be detected?

libavcodec.pc:

Code: Select all

Name: libavcodec Description: FFmpeg codec library Version: 52.10.0 Requires: Requires.private: Conflicts: Libs: -L${libdir} -lavcodec Libs.private: Cflags: -I${includedir} ~
No sign of -lfaac or -lmp3lame.
OK this is no vlc question but rather ffmpeg. But do I have to do more than enable faac and mp3lame in ffmpeg.
Is libavcodec linked in statically or should I build a shared lib? (which I didn't do).

Thanks for your answers so far.

Marc