Since http://www.jeffreythompson.org/blog/2014/11/13/installing-ffmpeg-for-raspberry-pi/ is a bit messy, here is how you can compile ffmpeg with x264 on raspbian. Changes are building in your home directory, getting just a shallow git clone and building with all CPU cores. Also no unnecessary sudo…
Read the comments below!
# In a directory of your choosing (I used ~/ffmpeg):
# build and install x264 git clone --depth 1 git://git.videolan.org/x264 cd x264 ./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl make -j 4 sudo make install # build and make ffmpeg git clone --depth=1 git://source.ffmpeg.org/ffmpeg.git cd ffmpeg ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree make -j4 sudo make install |
Read the comments below!
Hopefully someone, somewhere will provide a repository for this kind of stuff some day.
It takes just 25 minutes on a Raspberry Pi 3. Not hours or days like some old internet sources on old Raspis say.
In case you are wondering v4l2 should work with this.
Thanks for the short tutorial. Just one thing you might want to correct (or at least something for future readers). Your blog seems to have messed up the “–” (double-minus) and made “–” (dash) out of them.
God, I hate that “feature” of WordPress so much… Sorry!
https://git.videolan.org/git/ffmpeg.git
the actual repository to get ffmpeg from. hope this helps!
Hi!
I would like to use ffmpeg just for audio. Is there a way to compile just that?
Sure! Check out https://stackoverflow.com/questions/24849129/compile-ffmpeg-without-most-codecs but you will need to specify all the codecs you want that way.
Maybe a matter of versions, but I had to write “–” instead of “-” in
./configure –host=arm-unknown-linux-gnueabi –enable-static –disable-opencl
… and in the second “make -j4” to add a space like in the first one = “make -j 4”
hmmm the system seems to translate “double -” to “–“
Yeah, WordPress is being super helpful with the conversion of double dashes to a fancy typographic dash. Sorry :(
make -j4 should work though.
I’m running yours commands but
./configure –host=arm-linux –cross-prefix=${CCPREFIX} –enable-static –prefix=/home/user/arm –disable-avs –disable-cli –disable-opencl
the result is
No working C compiler found.
You will have to install build-essential
Pingback: | 3D Printing – RepRap Snappy
Pingback: | Live 3D Printing, Well Sort Off…
ffplay won’t be compiled unless SDL 2 libraries have been installed.
Worked like a charm!
Now my homebridge have two dLink cameras added. ME LIKE :-)
//J
Which release did you use of ffmpeg.git? I tried master and n3.2, but it does not compile:
collect2: error: ld returned 1 exit status
Makefile:131: recipe for target ‘ffprobe_g’ failed
make: *** [ffprobe_g] Error 1
make: *** Waiting for unfinished jobs….
collect2: error: ld returned 1 exit status
Makefile:131: recipe for target ‘ffserver_g’ failed
make: *** [ffserver_g] Error 1
collect2: error: ld returned 1 exit status
Makefile:131: recipe for target ‘ffmpeg_g’ failed
make: *** [ffmpeg_g] Error 1
hi, did you figure out the issue, i have the same
Thank you for the very useful tutorial. Just one question about the line:
./configure –arch = armel –target-os = linux –enable-gpl –enable-libmp3lame –enable-nonfree
Why –arch = armel and not –arch = armhf as the Raspy has the hard-float?
Thanks again
Oh, excellent suggestion. Is it much faster?
Appears to be much faster.
Thanks for the instructions… worked brilliantly… :)
Thanks a lot for putting together these instructions, saved me a lot of time to install the ffmpeg missing library.
In order for alsa USB devices to work properly, compile with the following:
–extra-libs=-lasound
This causes C compiler test fails
NVM, //Lasound2 missing
sudo apt-get -y install libasound2-dev
So after dancing around with this I’ve noticed, x264 is CPU intensive. I hardly get 4-5 fps on the same.
Well the RPi has a GPU and you can use h264_omx to do hardware encoding where you can get upto 25/30fps while livestreaming.
FFPEG Config:
sudo ./configure –arch=armhf –target-os=linux –enable-gpl –enable-omx –enab
le-omx-rpi –enable-nonfree –enable-libfreetype –extra-libs=-lasound –enable-
libmp3lame
As pointed out by Teo Ruscin, If you don’t have lasound please do the following
sudo apt-get -y install libasound2-dev
Above tested with Raspberry Pi B (1st gen) with a Logitech C920.
The best I managed to get is a 480p stream @ 2000kbps to Youtube. Still figuring out the audio section as aplay -L doesn’t list the C920 Audio device.
Building FFMPEG takes almost 7-8hrs. I’m getting a RPi3 soon, so will rebuild it on the new setup and report back.
Cheers.
can you tell me how much space ffmpeg will occupy on pi memory card ?
It worked flawlessly on my RPi 2! Thank you for the excellent guide! :-)
Hello Hannes, I’ve just run successfully the installation on a RPi3 with newest Raspbian.
It works like a charm! :)
Thanks for the script & have a nice time!
BR
Hope somebody can help
i keep getting this error :
“/usr/local/lib/libavcodec.a(libx264.o): In function `X264_init’:
/home/pi/src/FFmpeg/libavcodec/libx264.c:814: undefined reference to `x264_encoder_open_148′
collect2: error: ld returned 1 exit status
Makefile:202: recipe for target ‘x264’ failed
make: *** [x264] Error 1 “
Sounds like you don’t have x264?
Pingback: #StackBounty: #audio #alsa #ffmpeg FFMPEG: Unknown input format: 'alsa' – TechUtils.in
Why you are disabling opencl. Isn’t it nice to use gpu for ffmpeg?
I don’t remember but I would think that the Raspberry GPU has no OpenCL support.