Hi,
first of all: great work and big thanks @sherrell!
I did find some time today to dig into the “Docker ffmpeg not being able to stream RTSPS”-issue. After some pocking around I realized that apparently the stream component of HA does not use ffmpeg itself (so a replacement with a static build does not work), but rather uses pyav that is bound to the (within the docker container) available shared libav* libraries (as intended through the pip install command).
So, in order to make streaming work with docker, these libraries need to be upgraded to newer versions.
Sadly, this is easier said than done. The libraries are directly installed through the apt system from the underlying docker-base image (python-3.7) that HA chose to use. This base image is based off of Debian Stretch, which -bad for us- only offers the old versions.
Hopefully, after Debian Buster is being released in July 2019, also the python docker-base images will be upgraded to Buster.
Until then, only compiling a version of ffmpeg within the docker file itself is a suitable solution.
To do so, run the following commands in a terminal of THE (running) HOME-ASSISTANT DOCKER CONTAINER:
cd
apt-get update
apt-get -y install build-essential autoconf automake cmake libtool git
apt-get install checkinstall yasm libass-dev libfreetype6-dev libtool libvorbis-dev texinfo wget zlib1g-dev gnutls-dev libmp3lame-dev libssh-dev libtheora-dev libvorbis-dev libx264-dev libx265-dev opencl-dev
wget https://ffmpeg.org/releases/ffmpeg-4.1.3.tar.bz2
tar -xf ffmpeg-4.1.3.tar.bz2
cd ffmpeg-4.1.3
./configure --enable-gpl --enable-nonfree --enable-shared --enable-libtheora --enable-libvorbis --enable-libxcb --enable-libfreetype --enable-libass --enable-gnutls --enable-libx264 --enable-libmp3lame --enable-opencl --enable-libdrm
make
apt-get remove ffmpeg
apt-get -y purge ffmpeg "libav*" "libpostproc*"
apt-get -y autoremove
checkinstall -y --deldoc=yes --pkgversion=10:4.1.3-1
apt-get install libpostproc-dev
pip uninstall av
pip install av==6.1.2
Beware: this takes some time, can break your HA installation and should only be done by people who know what they are doing…
When running ffmpeg
, the output should now be something like
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-gpl --enable-nonfree --enable-shared --enable-libtheor
a --enable-libvorbis --enable-libxcb --enable-libfreetype --enable-libass --enab
le-gnutls --enable-libx264 --enable-libmp3lame --enable-opencl --enable-libdrm
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfi
le}…
Use -h to get full help or, even better, run ‘man ffmpeg’
Of course this needs to be redone every time you download/use a new HA container. One could keep the created Debian package and use this to reinstall somewhat faster, though…
Maybe that helps someone. Next up for me is now the tensor-flow integration…
Cheers
#edit 1: incorporated sherrell‘s comments. Should make it work for most people now