Support audio for camera stream

Please, support audio in camera yaml, also it will be nice to select microphones or audio stream for camera

check the codec that the audio from your camera is using / change if you can, because according to this it should be possible.

As I understand, many cheaper cameras only support PCM audio / G.711 codec or similar, which is not supported by the current Stream or ffmpeg integration, unfortunately.

A workaround would be to enable transcoding into a supported format, which I know is taxing on the computer’s CPU, but I would find it a worthwhile tradeoff. I couldn’t make it work with the currently available integration settings though.

By the way, there’s another similar feature request here (it has 12 votes as I write this): Camera stream with audio

Would these be the only codecs supported? Or am I looking in the wrong location? Seems very limited.

There’s a number of threads on this forum regarding getting audio into HA from CCTV cameras that support it, but as yet I haven’t found a solution. I really want to be able to use the the two-way audio from one of my cameras as an intercom in HA. (My camera supports these: G.711ulaw/G.711alaw/G.722.1/G.726/MP2L2/PCM/MP3)

I think mp3 should work

Yeah it’s a limit on both what h264 streams (or mp4 containers) support, which is the streaming technique that Home Assistant seems to use for this. And also what browsers & operating system support. MP3 or AAC should work, but G711 does not, it is incompatible with MP4 containers.

My camera streams G711 audio in its native RTSP streams, and there’s no way to change that from the settings interface (SV3C 1080p, based on some Hikvision hardware).

I found an ffmpeg command that produces working video+audio files for my camera’s streams, modified slightly from this question on Stackexchange (changed codec to pcm_alaw).

ffmpeg -y -re -acodec pcm_alaw -rtsp_transport tcp -i "rtsp://user:[email protected]:554/11" -vcodec copy -af asetrate=22050 -acodec aac -b:a 96k test.mp4

I found no way to include these encoding/transcoding settings in any currently supported video streaming plugins/mechanisms (ONVIF, ffmpeg, …)

Two-way audio is a whole other thing though, haven’t messed with that (I don’t have any use for it)