User avatar
ekla
Posts: 47
Joined: Wed Apr 09, 2014 9:39 am
Location: Lyon, France

Compile libav (avconv) pi2

Thu Jun 04, 2015 6:12 pm

hello all,

I just want to share my way of compiling libav (avconv) for the pi2. Maybe it can helps people. Maybe not !
the latest libav with libx264 libmp3 libopus libfdkaac and alsa

For this recipe you need a fresh pi2 with raspbian installed.
You can do this by ssh.

Code: Select all

sudo apt-get update 
sudo apt-get upgrade

Code: Select all

sudo apt-get install libmp3lame-dev libopus-dev libtool libbsd-dev pkg-config autotools-dev python-dev automake autoconf libtool make g++

Code: Select all

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
sudo make -j 4
sudo make install
sudo make distclean
cd

Code: Select all

wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
unzip fdk-aac.zip
cd mst*
autoreconf -fiv
./configure --enable-shared
sudo make -j 4
sudo make install
sudo make distclean
cd

Code: Select all

git clone git://git.videolan.org/x264.git
cd x264/
./configure --enable-shared
sudo make -j 4
sudo make install
sudo make distclean
cd

Code: Select all

wget http://mirrors.zerg.biz/alsa/lib/alsa-lib-1.0.25.tar.bz2
tar xjf alsa-lib*
cd alsa*
./configure --enable-shared
sudo make -j 4
sudo make install
cd

Code: Select all

git clone git://github.com/libav/libav
cd libav

Code: Select all

./configure --enable-gpl --enable-nonfree --enable-libx264 --enable-libopus --enable-libfdk-aac --enable-libmp3lame
you should see all the encoders freshly installed in the list.

Code: Select all

sudo make -j 4 
sudo make install
sudo make distclean
sudo ldconfig
sudo cp avconv /usr/local/bin
well done !

cheers
our fears are like dragons guarding our most precious treasures

User avatar
dwywit
Posts: 21
Joined: Mon Aug 13, 2012 9:50 am

Re: Compile libav (avconv) pi2

Fri Jun 05, 2015 4:47 am

Thanks, that's helpful. I want to set up a pi to create DCP (Digital Cinema Package), and the OpenDCP project specifies ffmpeg, although I'm sure avconv would work just as well.

mshannon
Posts: 9
Joined: Thu Oct 17, 2013 4:14 pm

Re: Compile libav (avconv) pi2

Mon Oct 05, 2015 2:07 pm

Hi Thanks for this.

At: "git clone git://git.videolan.org/x264.git" I kept getting timed out, I found a fix that said use this instead: "git clone http://git.videolan.org/git/x264.git". That worked.

However at: "wget http://mirrors.zerg.biz/alsa/lib/alsa-l ... 25.tar.bz2" I'm getting the error:
"Resolving mirrors.zerg.biz (mirrors.zerg.biz)... 127.0.0.1
Connecting to mirrors.zerg.biz (mirrors.zerg.biz)|127.0.0.1|:80... failed: Connection refused."

Anyone any idea how to get round this error?

Coen.b
Posts: 1
Joined: Wed Oct 21, 2015 9:52 pm

Re: Compile libav (avconv) pi2

Wed Oct 21, 2015 10:01 pm

@ mshannon

Hi,

I got this same error also.

You can download this file from several other sites. F.i. via:
wget http://alsa.mirror.fr/lib/alsa-lib-1.0.25.tar.bz2

Success!

Best regards,

Coen

rotwang
Posts: 243
Joined: Sat Dec 07, 2013 1:12 pm

Re: Compile libav (avconv) pi2

Wed Oct 28, 2015 11:55 am

dwywit wrote:Thanks, that's helpful. I want to set up a pi to create DCP (Digital Cinema Package), and the OpenDCP project specifies ffmpeg, although I'm sure avconv would work just as well.
You might care to look at dcpomatic, but you will need something a hell of a lot faster than a raspberrypi unless your videos are very very short, or you have extreme patience. I can get conversion rates upto 4frames/second, but thats running 8 cores 64bit.
Roger

tvjon
Posts: 820
Joined: Mon Jan 07, 2013 9:11 am

Re: Compile libav (avconv) pi2

Wed Oct 28, 2015 7:53 pm

I missed this post originally, so seeing it now, decided I'd try building it for jessie.

I'm surprised libfdk-aac built ok for OP:

pi@j1 ~/Downloads/mstorsjo-fdk-aac-047376a $ autoreconf -fiv

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --force-missing

Useless use of /d modifier in transliteration operator at /usr/local/share/automake-1.8/Automake/Wrap.pm line 60.

configure.ac:7: option `tar-ustar' not recognized

autoreconf: automake failed with exit status: 1

I changed

tar-ustar to tar -ustar

producing a different error message, but still no good.


Next I tried building fdk-aac-0.1.4 from sourceforge. Still failed:

pi@j1 ~/fdk-aac-0.1.4 $ ./autogen.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
aclocal: macro `_LT_DECL_SED' required but not defined
aclocal: macro `_LT_FUNC_STRIPNAME_CNF' required but not defined
autoreconf: aclocal failed with exit status: 1


So I updated automake to v 1.15. Still no good for mstorsjo-fdk-aac-047376a but ok for fdk-aac-0.1.4

pi@j1 ~/fdk-aac-0.1.4 $ ./autogen.sh

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force
autoreconf: configure.ac: not using Autoheaded Z80 code.

autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:20: installing './compile'
autoreconf: Leaving directory `.'

That proceeded to build ok. As yet, I don't know the implications for using that rather than
mstorsjo-fdk-aac-047376a

Other observations:

Unsure why yasm is included in the OP's list as it seems to be a red herring. It's a X86 assembler. I built it anyway out of interest. I'll try it on some of my old Z80 source.

sudo is unnecessary for make, just make install.

A quick test of avconv converted a short h264 clip to a .mov

giamat86
Posts: 2
Joined: Sun Dec 29, 2013 4:10 pm

Re: Compile libav (avconv) pi2

Mon Jan 04, 2016 1:09 pm

Thank you very much!! You have saved my time!! ;)

Return to “Graphics, sound and multimedia”