Here’s the deal, I am a network engineer, i’m not a programmer. So please forgive if i use the wrong terms or acronyms.
I have ffmpeg running on a windows machine, and I am able to use it to send a Multicast RTP audio stream to a Grandstream GSC3506 SIP paging speaker playing a .wav file from the hard drive on my PC. The GSC3506 can “listen” for multicast broadcasts and grab onto them at will. The audio works perfect from the windows ffmpeg.
I’m trying to get Home Assistant Core (which is running as a VM on ESXI) to do the same so that i can build automatons that will broadcast announcements through the paging system. Im struck trying to get ffmpeg to actually fire off the stream. Seems like it is blowing up on the output part of the script. If i run the full complete script via developer tools / services, it doesn’t do anything, it fails silently. If i chop off the “udp://239.1.1.2:20480?ttl=10” from the end of the script, the call service button actually turns green and there is an output below in the window that shows ffmpeg doing stuff, but reporting an error that its missing an argument.
Details below:
configuration.yaml
ffmpeg:
ffmpeg_bin: /usr/bin/ffmpeg
shell_command:
ffmpeg_h4_alarm:
ffmpeg -stream_loop -1 -re -i media/H4.wav -filter_complex aresample=16000,asetnsamples=n=160 -acodec adpcm_g722 -ac 1 -vn -f rtp udp://239.1.1.2:20480?ttl=10
Above is the full complete command that will fail silently.
Below is the command with the udp portion removed which will run in development tools but obviously generate an error.
ffmpeg -stream_loop -1 -re -i media/H4.wav -filter_complex aresample=16000,asetnsamples=n=160 -acodec adpcm_g722 -ac 1 -vn -f rtp
And at this point the “automation” is just a toggle to test the thing -which calls “ffmpeg_h4_alarm”.
Below is the output from call service in development tools.
stdout: “”
stderr: |-
ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r10) 20220924
configuration: --prefix=/usr --disable-librtmp --disable-lzma --disable-static --disable-stripping --enable-avfilter --enable-gnutls --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librist --enable-libsoxr --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-lto --enable-pic --enable-postproc --enable-pthreads --enable-shared --enable-vaapi --enable-vdpau --enable-vulkan --optflags=-O3 --enable-libjxl --enable-libsvtav1 --enable-libvpl
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 5. 0.100 / 5. 0.100
libpostproc 57. 1.100 / 57. 1.100
Trailing option(s) found in the command: may be ignored.
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from ‘media/H4.wav’:
Metadata:
title : Hospital Code4
track : 18
comment : Made with Sony ACID Music Studio 6.0
Duration: 00:00:04.75, bitrate: 64 kb/s
Stream #0:0: Audio: pcm_mulaw ([7][0][0][0] / 0x0007), 8000 Hz, 1 channels, s16, 64 kb/s
Filter asetnsamples:default has an unconnected output
returncode: 1
What am i missing? is the ffmpeg in HA not the full blown version, or is my command syntax that worked on windows incompatible with the llinux version?
Any help will be greatly appreciated, thank you!