I want to stream audio from a radio antenna to Google Home. To do this, and to allow for some automation, I have done the following with a Raspberry Pi:
- Created a pipeline from RTL_FM to SOX to FFMPEG:
rtl_fm -f 101.1M -M wbfm -s 600000 -r 48000 -g 15.7 | sox -t raw -e signed-integer -b 16 -c 1 -r 48000 - -t raw - | ffmpeg -f s16le -ar 48k -ac 1 -i - -c:a libopus -b:a 128k -f hls -hls_time 10 -hls_list_size 6 -hls_flags delete_segments+omit_endlist -segment_list_flags +live -segment_format mpegts ~/hls_stream/live.m3u8
- Used Caddy to serve the m3u8 file on the network. I can then access the stream without issue with VLC.
http://[RPi IP], radio.local {
root * /home/pi/hls_stream
file_server
header {
Access-Control-Allow-Origin
192.168.1.0/24
Access-Control-Allow-Methods "GET, OPTIONS"
Access-Control-Allow-Headers "Range, Accept-Encoding, Content-Type"
Access-Control-Expose-Headers "Content-Length, Content-Range"
}
}
:80 {
root * /usr/share/caddy
file_server
}
- Tried to use Home Assistant to get the stream onto various Google Home devices:
action: media_player.play_media
data:
media_content_id:
http://RPiIP/live.m3u8
media_content_type: music
target:
entity_id: media_player.kitchen_display
Step 3 is where I am stuck- despite lots of tweaking, I always get:
Failed to cast media http://RPiIP/live.m3u8. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
I know Google Home can be finicky about HLS and I’ve reviewed Add Advanced Features to Your Web Sender App | Cast | Google for Developers but am at a loss, especially because I know the stream works- I can access it with VLC from anywhere.
I’d welcome any help from the community!