I'm trying to install ffmpeg on my Raspberry Pi Zero W, but I get several error messages.
OS: Raspberry Pi OS (32-bit) Lite (May 2020)
I have executed the following commands:
sudo apt update
sudo apt full-upgrade
sudo apt install git
git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
./configure --arch=armel --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-nonfree
make -j2
sudo make install
Output of last command:
...
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
Maybe another package is missing? Do I have to change anything in the config?
One of the best things about FFmpeg is that it can be compiled across a wide variety of devices, including the Raspberry Pi. Using FFmpeg, you will be able to encode and decode a large variety of video and audio codecs.
Add the following to the ./configure parameters.
--extra-ldflags="-latomic"
So your command becomes:
./configure --extra-ldflags="-latomic" --arch=armel --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-nonfree
On arm platforms with the latest version of "something" installed, I've come across several programs (including ffmpeg) that seem to no longer automatically link the atomic library giving you this or a similar error. I haven't had the time to find out exactly what is causing it or why yet.
The above command manually tells the configure script to include atomic when linking.
Trying to enable the Pi's hardware h264 encoding by any chance?
As I don't know the reason of the above behavior, I can confirm that this happens to me too, on Raspberry Pi 3.
I found a workaround, by installing an oldest package by the next commands:
wget -O ffmpeg-4.1.5.tar.bz2 https://ffmpeg.org/releases/ffmpeg-4.1.5.tar.bz2
tar xvjf ffmpeg-4.1.5.tar.bz2
UPDATE: I found some problems with the installation from source, as Pi Zero f.ex the CPU may be hard float, so you should change some flags before compiling.
if you don't mind a version, install the already precompiled packages by:
sudo apt install ffmpeg -y
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With