live-stream-radio icon indicating copy to clipboard operation
live-stream-radio copied to clipboard

[FULL GUIDE]: How to install ffmpeg with libfreetype (and h264 support) on raspbian

Open ALegitCookie opened this issue 5 years ago • 4 comments

Hello everybody. I had trouble finding out how to install/compile ffmpeg with libfreetype when i first started. Now that i know how, i'm going to share how to do it with you to save you some frustration.

you can skip the h264 support if you want, it's not super important for live-stream-radio. However, I just personally like having it.

Let's get started. (PLEASE NOTE, WHEREVER YOU SEE "-J4", IF YOUR RASPBERRY PI HAS LESS THAN 4 CPU CORES, REPLACE "J4" WITH "J")

Install h264 library Open a terminal window on your raspberry pi or connect via SSH. Type in the following: 1.Download the h264 library: git clone --depth 1 https://code.videolan.org/videolan/x264 2. Once it's done, change directory to the h264 folder: cd x264 3. Configure the installation: ./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl 4. Create the installation: make -j4 (this will take a bit so be patient) 5. Now install the h264 library on your system: sudo make install

Congrats. h264 is now installed. now to install ffmpeg with h264

  1. Change to home directory: cd ~
  2. download ffmpeg: git clone git://source.ffmpeg.org/ffmpeg --depth=1 (this will take a bit to download)
  3. Change to ffmpeg directory: cd ffmpeg
  4. Configure the installation: ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libfreetype
  5. Make the installation: make -j4 (this takes a long time, be patient)
  6. install: sudo make install

congratulations, you are now done!! Enjoy streaming your radio station on your raspberry pi!

ALegitCookie avatar May 15 '20 01:05 ALegitCookie

Oh yay! Thank you very much for this @ALegitCookie ! I'm sure people coming by will find this super useful! :smile: :+1:

torch2424 avatar May 18 '20 04:05 torch2424

I sure did. Thank you!

toplevelnick avatar May 21 '21 06:05 toplevelnick

If you get an error like below after running ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libfreetype to install ffmpeg

LD      ffmpeg_g
/usr/bin/ld: libavformat/libavformat.a(fifo.o): in function `fifo_init':
/home/pi/FFmpeg/libavformat/fifo.c:519: undefined reference to `__atomic_store_8'
/usr/bin/ld: libavformat/libavformat.a(fifo.o): in function `fifo_write_trailer':
/home/pi/FFmpeg/libavformat/fifo.c:624: undefined reference to `__atomic_fetch_add_8'
/usr/bin/ld: /home/pi/FFmpeg/libavformat/fifo.c:631: undefined reference to `__atomic_store_8'
/usr/bin/ld: libavformat/libavformat.a(fifo.o): in function `fifo_thread_write_packet':
/home/pi/FFmpeg/libavformat/fifo.c:188: undefined reference to `__atomic_fetch_sub_8'
/usr/bin/ld: libavformat/libavformat.a(fifo.o): in function `fifo_consumer_thread':
/home/pi/FFmpeg/libavformat/fifo.c:457: undefined reference to `__atomic_load_8'
/usr/bin/ld: libavformat/libavformat.a(fifo.o): in function `fifo_write_packet':
/home/pi/FFmpeg/libavformat/fifo.c:597: undefined reference to `__atomic_fetch_add_8'
collect2: error: ld returned 1 exit status
make: *** [Makefile:114: ffmpeg_g] Error 1

Try adding this flag --extra-ldflags="-latomic" to the ./configure parameters so it becomes ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libfreetype --extra-ldflags="-latomic"

techieanant avatar Nov 21 '21 03:11 techieanant

Also, if you get the gifsicle error below while installing live-stream-radio

 Error: autoreconf -ivf && ./configure --disable-gifview --disable-gifdiff --prefix="xxx\node_modules\gifsicle\vendor" --bindir=
"xxx\node_modules\gifsicle\vendor" && make install
Command failed: autoreconf -ivf
'autoreconf' is not recognized as an internal or external command,
operable program or batch file.

at ChildProcess.exithandler (child_process.js:211:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:192:7)
at maybeClose (internal/child_process.js:890:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:189:7)
at Pipe._handle.close [as _onclose] (net.js:501:12)

then try the commands below to install autoconf and other dependencies correctly

Linux: sudo apt-get install libtool automake autoconf nasm OS X: brew install libtool automake autoconf nasm

techieanant avatar Nov 21 '21 04:11 techieanant