Extract Audio Stream from RTSP & Play In Browser?

I have an IP security camera mounted as a baby monitor, this camera can generate either an MJPEG stream or RTSP. I’ve got the MJPEG stream going into HomeAssistant, this works well enough for video, but doesn’t help with audio. I’m curious if there’s any good ways to extract the audio stream and play it back through HomeAssistant (probably on an Android phone), essentially turning the camera into a simple audio-only baby monitor?

I assume there’s some ffmpeg tricks I can do to extract the audio, but I’m not sure if HomeAssistant can easily play the audio in the browser?

Alternatively I suppose I could just try to get VLC or somesuch working on our phones, but it’s been kind of a pain on Android so I’m hoping HomeAssistant can do all of this work.

1 Like

you managed?

Nope, never explored this further.

I have done this with VLC. You can convert the RTSP stream with VLC to an mp3 stream an it generates real-time a new http stream play that url in any Mediaplayer within home assistant.

Can you provide some detail around how you did the mp3 stream? Seems like exactly what I’m looking for.

Sure, here you go

  1. Open VLC
  2. CTR+S
  3. In the network tab enter your RTSP stream url.
  4. Select Stream on the bottom
  5. Next
  6. Select HTTP as Target en click on add.
  7. Select a port (path is optional)
  8. Select Audio - MP3 profile (you can tweak the profile if you like) and select transcode
  9. Next
  10. Stream

Now VLC is streaming your RTSP as an MP3 stream and you can listing to it with the ipadres of the machine were VLC is running. example, http://192.168.1.10:8080

1 Like

Thanks for the details. How are you getting the audio into HA from that point?

That depends on where you want to listen the stream, you can open the http stream in any Mediaplayer within Home Assistant. i am using Node-RED to do this. There is a CAST node so you can set your HTTP stream as source to Chromecast or a Google Home speaker. To hear the stream in webbrowser you can use Browser Modd im also control this in the media play via NODE-Red but it is also possible without.

Unfortunately it is not possible to stream to the Android app. For this I am going to ask for a feature request

Thanks for your help, much appreciated.

I’m still trying to figure out how to use Unifi cameras as a baby monitor on my Google Home Hubs, and came across this thread (there’s no audio with the stream component).

One option I found in this thread is the FFmpeg Noise component. It won’t stream to mp3 as far as I know, but you could use the binary sensor to them create a text-to-speech alert on a Sonos or Google Home. In my case, something like “your kid is out of bed” could be useful (and probably creepy) coming out of my bedstand speaker. Just thought it was worth mentioning if it happened to support your use case.

Nice, can you please share your configuration for this screenshot?
I know this topic is 1.5 year in the past but I like this configuration.