balajiv
Posts: 33
Joined: Mon May 06, 2013 6:08 am

FFMPEG for Raspberry Pi

Tue Jun 18, 2013 4:23 pm

Hi All,

I am trying to build the FFMPEG for Raspberry Pi. I have been trying the steps provided in various links; but in vain.

I tried the following link: http://lumux.co.uk/2012/07/03/cross-com ... pberry-pi/

But on trying the compile the source code as: ./configure --host=arm-linux --cross-prefix=${CCPREFIX} --enable-static

I see an error: No working C compiler found.

pi@raspberrypi ~/ffmpeg/x264 $ ./configure --host=arm-linux --cross-prefix=${CCPREFIX} --enable-static
No working C compiler found.

Appreciate any pointers for the same.

Thanks.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26660
Joined: Sat Jul 30, 2011 7:41 pm

Re: FFMPEG for Raspberry Pi

Tue Jun 18, 2013 5:01 pm

What happens when you type

gcc -version

on the command line?

EDIT: Hold on, you seem to be trying to cross compile the ffmpeg code, which you don't need to do on the Raspi itself, on.y when compiling for the Raspi on another machine.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

balajiv
Posts: 33
Joined: Mon May 06, 2013 6:08 am

Re: FFMPEG for Raspberry Pi

Tue Jun 18, 2013 5:08 pm

pi@raspberrypi ~ $ gcc --version
gcc (Debian 4.6.3-14+rpi1) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I am using RPi itself to build ffmpeg since I do not have any other Ubuntu Linux machine. :-(

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26660
Joined: Sat Jul 30, 2011 7:41 pm

Re: FFMPEG for Raspberry Pi

Wed Jun 19, 2013 8:42 am

OK, you need to use the instructions for building on the Pi itself (or any other native build), not on another machine. That should be in the readme somewhere in the source tree.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

balajiv
Posts: 33
Joined: Mon May 06, 2013 6:08 am

Re: FFMPEG for Raspberry Pi

Wed Jun 19, 2013 1:18 pm

The link given above have the steps for Raspberry Pi only.

Are there any other links which provide the steps to build FFMPEG for Raspberry Pi ?

balajiv
Posts: 33
Joined: Mon May 06, 2013 6:08 am

Re: FFMPEG for Raspberry Pi

Wed Jun 19, 2013 3:40 pm

I tried compiling the ffmpeg as per the link:

http://ffmpeg.org/trac/ffmpeg/wiki/How% ... (Raspbian)

I am stuck with the toolchain build.

pi@raspberrypi ~/ctng $ ct-ng build
[INFO ] Performing some trivial sanity checks
[INFO ] Build started 20130619.191723
[INFO ] Building environment variables
[ERROR] Build failed in step '<none>'
[ERROR] Error happened in '/opt/cross/lib/ct-ng-1.9.3/scripts/functions' in function 'CT_DoExecLog' (line unknown, sorry)
[ERROR] called from '/opt/cross/lib/ct-ng-1.9.3/scripts/crosstool-NG.sh' at line # 248 in function 'main'
[ERROR] Look at '' for more info on this error.
[ERROR] (elapsed: 0:03.74)
[00:06] / make: *** [build] Error 1

The above error is thrown. Can someone please help to resolve this ?

Thanks in advance.

User avatar
rpdom
Posts: 17174
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: FFMPEG for Raspberry Pi

Wed Jun 19, 2013 4:52 pm

Those links seem to only give instructions for cross-compiling on another computer for the Raspberry Pi
We will describe here the method to cross-compile FFmpeg for Raspbian
The instructions are not for how to build FFmpeg on a Pi. You can run them on a Linux PC instead, then copy the finished file to your Pi.

bullwinkle
Posts: 117
Joined: Wed Jan 09, 2013 12:14 pm

Re: FFMPEG for Raspberry Pi

Wed Jun 19, 2013 5:35 pm

Hi
about 6 months ago I needed to compile ffmpeg. These steps could be different now due to new versions/etc. This is what I did
Compile and Install ffmpeg using details found on site
i. http://sirlagz.net/2012/08/04/how-to-st ... pberry-pi/
ii. Added one extra module“--enable-libfreetype” in the compile to include time stamp (may be required for “gray scale” also) based on this site
http://einar.slaskete.net/2011/09/05/ad ... ng-ffmpeg/
in order to add the module freetype must be install

It took about 3 hours to compile...

Code: Select all

	
Following the instructions from the site, to compile…

COMPLETE THESE STEPS USING ROOT 
1.	Add the following lines into /etc/apt/sources.list
deb-src http://www.deb-multimedia.org sid main
deb http://www.deb-multimedia.org wheezy main non-free
2.	Run apt-get update
3.	Run apt-get install deb-multimedia-keyring
4.	Remove the second line from /etc/apt/sources.list
deb http://www.deb-multimedia.org wheezy main non-free
5.	Run apt-get source ffmpeg-dmo
6.	You should now have a folder called ffmpeg-dmo-0.11 <-- The version will change as time goes by.
7.	Change the directory to the folder containing the source. e.g. cd ffmpeg-dmo-0.11
8.	sudo apt-get install freetype*
9.	Run ./configure to setup the source.
1.	To include the datestamp change the above to
2.	./configure --enable-libfreetype 
10.	Run make && make install to compile and install ffmpe
STOP USING ROOT 

Stokestack
Posts: 42
Joined: Wed Aug 15, 2012 1:00 am

Re: FFMPEG for Raspberry Pi

Wed Jul 24, 2013 5:45 am

I just followed the steps here http://www.raspberrypi.org/phpBB3/viewt ... 43&t=45368 and it worked without incident. It did take hours, though.

But I can't figure out where the lib is installed. Anybody know? I'd like to copy it off and save it, or even post it for download somewhere.

Thanks.

bullwinkle
Posts: 117
Joined: Wed Jan 09, 2013 12:14 pm

Re: FFMPEG for Raspberry Pi

Wed Jul 24, 2013 1:32 pm

I'm no expert, but try

Code: Select all

which ffmpeg

Code: Select all

ldd /output/from/above

Stokestack
Posts: 42
Joined: Wed Aug 15, 2012 1:00 am

Re: FFMPEG for Raspberry Pi

Wed Jul 24, 2013 8:55 pm

Thanks. I had forgotten to run "make install". It's where one might expect: /usr/local/bin/ffmpeg.

abhijoseph
Posts: 1
Joined: Thu Aug 14, 2014 1:54 am

Re: FFMPEG for Raspberry Pi

Thu Aug 14, 2014 2:13 am

To balajiv's initial query..
I have used the below updated command to configure step for x264 libs

$ ./configure --host=arm-linux --cross-prefix=${CCPREFIX} --enable-static --disable-avs --disable-cli --disable-opencl
$ make
cd ..

And the below command worked for me for building ffmpeg
$ ./configure --enable-cross-compile --cross-prefix=${CCPREFIX} --arch=armel --target-os=linux --enable-gpl --prefix=[locationofffmpeg] --enable-nonfree --enable-libx264 --extra-cflags="-Ix264/" --extra-ldflags="-Lx264/"


Also please make sure the debian linux is 32bit, I tried on x64 and that required additional lib32 libraries to be installed for build to work. Otherwise the configure steps throws an error indication "No C compiler found".
Hope this helps!!

mube
Posts: 1
Joined: Fri Oct 17, 2014 5:00 pm

Re: FFMPEG for Raspberry Pi

Fri Oct 17, 2014 5:55 pm

In addition to abhijoseph's reply I had trouble building FFmpeg using the following resources:

http://lumux.co.uk/2012/07/03/cross-com ... pberry-pi/
http://www.raspberrypi.org/forums/viewt ... 67&t=47472
https://trac.ffmpeg.org/wiki/Compilatio ... aspberryPi

I fixed the issue by additionally running

Code: Select all

make install 
and then referencing the installation path.

Again, using Debian x86 (32bit)...

Code: Select all

sudo apt-get install build-essential git-core
sudo git clone https://github.com/raspberrypi/tools.git /opt/tools

export CFLAGS="-O2 -pipe -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -w"
export CCPREFIX="/opt/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-"

cd ~
mkdir arm
mkdir dev
cd dev
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

cd ffmpeg
git clone git://git.videolan.org/x264

cd x264
./configure --host=arm-linux --cross-prefix=${CCPREFIX} \
  --enable-static --prefix=/home/user/arm \
  --disable-avs --disable-cli --disable-opencl
make
make install
cd ..

./configure --enable-cross-compile --cross-prefix=${CCPREFIX} \
  --prefix=/home/user/arm \
  --arch=armel --target-os=linux --enable-gpl --enable-libx264 \
  --extra-cflags="-I/home/user/arm/include" \
  --extra-ldflags="-L/home/user/arm/lib" \
  --extra-libs=-ldl
make
make install
Be sure to update /home/user with the base path you would like to use.

In the above example the ffmpeg binaries will be placed in: /home/user/arm/bin

The ffmpeg binary files can then be copied over to the Raspberry Pi and run from there.

mcfleeg
Posts: 8
Joined: Fri Oct 04, 2013 5:11 pm

Re: FFMPEG for Raspberry Pi

Mon Mar 21, 2016 3:23 am

ffmpeg compiles pretty fast using:

make -j4

This makes use of all 4 cores. Just built ffmpeg on RPi 3. Didnt time it, but it was <1hour I think.

Return to “Graphics programming”