Python Forum

Full Version: Accessing IP Cam Audio In Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[I'm not sure if this should be here or in the Networking forum.]

I need to get sound samples from a microphone that is attached to an IP Camera I have on my network. (I don't need to record. I just need to take a sample so I can determine dB level. Elevated dB levels indicate an event is taking place for the app I'm writing. To be clear - I don't want to check sound levels continuously. I only want to check the sound level when I've determined - via other means - that an event is taking place. When that occurs I want to use the sound level as a confirming data point that the event I'm looking for is actually taking place.)

I know the camera's audio is working - I can get the sound using an rtsp connection when using either iSpy or VLC.

Where I'm stuck is that the two Python sound modules I've found (PyAUdio and sounddevice) all seem to assume the sound inputs are local to the machine running the code - such as the computer's microphone jack. They assume either that or that the sound is being read from a local .wav file.

I need to either 1/ establish a connection with the remote audio source at the system level so the system thinks that audio is coming in via the local microphone jack or 2/ make Python/[PyAudio or sounddevice] see that remote audio stream as the input that is to be read from.

Any pointers? I feel kind of stuck. I've Googled and Googled and Googled and, if there are examples out there, I haven't yet found the right search terms to uncover them.

Thanks.

Jim
Did you ever find a solution to this? I am trying to do something like this for an IP microphone which has an RTSP server on it. I have found possible workarounds, (maybe aiortc, or wrapping ffmpeg/vlc commands in python code) but no easy plug and play library in python.