[SOLVED] Problem on updating FFMPEG to version 4

Guys, I updated HA to version 1.110 and up until now I couldn’t get my ONVIF cameras to work again.

To sum up, on my searchs I found out here that I need FFMPEG version 4 in order to install AV version 8.0.1.

But I can’t get FFMPEG updated to version 4

Stream page says that I should be able to update using

sudo add-apt-repository ppa:jonathonf/ffmpeg-4
sudo apt upgrade

But this is what I get when I try

pi@raspberrypi:~$ sudo add-apt-repository ppa:jonathonf/ffmpeg-4
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 95, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources
    (self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/stretch

I read somewhere that these “ppa” are for ubuntu systems. To install PPA on raspberry pi I tried both ways here and none of them worked.

If I try to just sudo apt-get heres what I get that FFMPEG is already on the latest version (but it says 3.2.14, no 4)

pi@raspberrypi:~$ sudo apt-get install ffmpeg
Reading package lists… Done
Building dependency tree
Reading state information… Done
ffmpeg is already the newest version (7:3.2.14-1~deb9u1+rpt1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

Please, help me update it to version 4 so I can then update AV to 8.0.1 and finally have my ONVIF cameras working again.

Thanks!

For Raspbian you need to install from source… though updating to Buster may help.

My process was:

wget http://www.ffmpeg.org/releases/ffmpeg-4.2.2.tar.xz
tar xf ffmpeg-4.2.2.tar.xz
cd ffm*2
./configure --enable-shared --enable-pic
make -j4
sudo make install

That worked perfectly for me.

3 Likes

Thanks, dude.
Worked like a charm for me too.

(I just didn’t know on what directory to install, so I installed on my home directory.
So after installing I had to add “include /HOME_DIRECTORY/ffmpeg-4.2.2/libavdevice/*”
to /etc/ld.so.conf so it can recognize the libs)

I would like to share some additional notes on this for whoever is setting up 1st generation Nest cameras on RPi3
I had to add --enable-openssl so I could get the camera streams to work on Home Assistant Core 2022.3.8

./configure --enable-shared --enable-pic --enable-openssl

Also, I was getting this error message:

pi@raspberrypi:~ $ ffmpeg
/usr/bin/ffmpeg: not found

So I had to type in the following to fix it:

pi@raspberrypi:~ $ hash -d ffmpeg

After that I got a different error message:

pi@raspberrypi:~ $ ffmpeg
ImportError: libavcodec.so.58: cannot open shared object file: No such file or directory

It turns out that ffmpeg could not find the libraries:

pi@raspberrypi:~ $ ldd `which ffmpeg`
        linux-vdso.so.1 (0x7eda8000)
        /usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76f14000)
        libavdevice.so.58 => not found
        libavfilter.so.7 => not found
        libavformat.so.58 => not found
        libavcodec.so.58 => not found
        libswresample.so.3 => not found
        libswscale.so.5 => not found
        libavutil.so.56 => not found
        libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x754c4000)
        libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x75498000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x75342000)
        libxcb.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb.so.1 (0x75313000)
        libbz2.so.1.0 => /lib/arm-linux-gnueabihf/libbz2.so.1.0 (0x752f3000)
        libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x752cc000)
        libssl.so.1.1 => /usr/lib/arm-linux-gnueabihf/libssl.so.1.1 (0x7524d000)
        libcrypto.so.1.1 => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1 (0x7503b000)
        liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0x7500a000)
        /lib/ld-linux-armhf.so.3 (0x54b17000)
        libXau.so.6 => /usr/lib/arm-linux-gnueabihf/libXau.so.6 (0x74fff000)
        libXdmcp.so.6 => /usr/lib/arm-linux-gnueabihf/libXdmcp.so.6 (0x74fea000)
        libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x74fd6000)
        libbsd.so.0 => /lib/arm-linux-gnueabihf/libbsd.so.0 (0x74fab000)

I have fixed it by adding following entries in /etc/ld.so.conf

pi@raspberrypi:~ $ sudo vim /etc/ld.so.conf
/usr/local/lib
/usr/lib

Save file and run command:

pi@raspberrypi:~ $ ldconfig

Then you should see something like this:

pi@raspberrypi:~ $ ldd `which ffmpeg`
        linux-vdso.so.1 (0x7eda8000)
        /usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76f14000)
        libavdevice.so.58 => /usr/local/lib/libavdevice.so.58 (0x76ee6000)
        libavfilter.so.7 => /usr/local/lib/libavfilter.so.7 (0x76c26000)
        libavformat.so.58 => /usr/local/lib/libavformat.so.58 (0x769e5000)
        libavcodec.so.58 => /usr/local/lib/libavcodec.so.58 (0x7588b000)
        libswresample.so.3 => /usr/local/lib/libswresample.so.3 (0x75868000)
        libswscale.so.5 => /usr/local/lib/libswscale.so.5 (0x757ec000)
        libavutil.so.56 => /usr/local/lib/libavutil.so.56 (0x75533000)
        libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x754c4000)
        libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x75498000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x75342000)
        libxcb.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb.so.1 (0x75313000)
        libbz2.so.1.0 => /lib/arm-linux-gnueabihf/libbz2.so.1.0 (0x752f3000)
        libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x752cc000)
        libssl.so.1.1 => /usr/lib/arm-linux-gnueabihf/libssl.so.1.1 (0x7524d000)
        libcrypto.so.1.1 => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1 (0x7503b000)
        liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0x7500a000)
        /lib/ld-linux-armhf.so.3 (0x54b17000)
        libXau.so.6 => /usr/lib/arm-linux-gnueabihf/libXau.so.6 (0x74fff000)
        libXdmcp.so.6 => /usr/lib/arm-linux-gnueabihf/libXdmcp.so.6 (0x74fea000)
        libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x74fd6000)
        libbsd.so.0 => /lib/arm-linux-gnueabihf/libbsd.so.0 (0x74fab000)

Restart Home Assistant Core, 1st generation Nest camera stream should now work!
Hopefully someone find this useful because it took me a day or more to figure this out