Ffmpeg multicast audio stream - help needed

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://” 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:


ffmpeg_bin: /usr/bin/ffmpeg

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://

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’:
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!

Update: Turns out this was actually working, but because my HA server is behind a firewall the Multicast UDP traffic was not making it through to the phone vlan.

After calling the service in developer tools, you get this output:

stdout: “SDP:\nv=0\r\no=- 0 0 IN IP4\r\ns=No Name\r\nc=IN IP4\r\nt=0 0\r\na=tool:libavformat 60.3.100\r\nm=audio 0 RTP/AVP 9\r\nb=AS:128\r\na=control:streamid=0”
stderr: “ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers\n built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r10) 20220924\n 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\n libavutil 58. 2.100 / 58. 2.100\n libavcodec 60. 3.100 / 60. 3.100\n libavformat 60. 3.100 / 60. 3.100\n libavdevice 60. 1.100 / 60. 1.100\n libavfilter 9. 3.100 / 9. 3.100\n libswscale 7. 1.100 / 7. 1.100\n libswresample 5. 0.100 / 5. 0.100\n libpostproc 57. 1.100 / 57. 1.100\nGuessed Channel Layout for Input Stream #0.0 : mono\nInput #0, wav, from ‘media/Fire_alarm.wav’:\n Duration: 00:00:18.76, bitrate: 64 kb/s\n Stream #0:0: Audio: pcm_mulaw ([7][0][0][0] / 0x0007), 8000 Hz, 1 channels, s16, 64 kb/s\nStream mapping:\n Stream #0:0 (pcm_mulaw) → aresample:default\n asetnsamples:default → Stream #0:0 (g722)\nPress [q] to stop, [?] for help\nOutput #0, rtp, to ‘udp://’:\n Metadata:\n encoder : Lavf60.3.100\n Stream #0:0: Audio: adpcm_g722, 16000 Hz, mono, s16, 64 kb/s\n Metadata:\n encoder : Lavc60.3.100 g722\nsize= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A \rsize= 4kB time=00:00:00.47 bitrate= 69.5kbits/s speed=0.955x \rsize= 8kB time=00:00:00.99 bitrate= 69.1kbits/s speed=0.989x \rsize= 13kB time=00:00:01.49 bitrate= 69.0kbits/s speed=0.987x \rsize= 17kB time=00:00:02.01 bitrate= 69.0kbits/s speed=0.996x \rsize= 21kB time=00:00:02.51 bitrate= 68.9kbits/s speed=0.993x \rsize= 26kB time=00:00:03.03 bitrate= 68.9kbits/s speed=0.998x \rsize= 30kB time=00:00:03.55 bitrate= 68.9kbits/s speed= 1x \rsize= 34kB time=00:00:04.05 bitrate= 68.9kbits/s speed=0.999x \rsize= 38kB time=00:00:04.57 bitrate= 68.9kbits/s speed= 1x \rsize= 43kB time=00:00:05.07 bitrate= 68.9kbits/s speed= 1x \rsize= 47kB time=00:00:05.59 bitrate= 69.1kbits/s speed=1.03x \nvideo:0kB audio:44kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.624555%\nExiting normally, received signal 15.”
returncode: 255