Python Access To IP Cam Audio

Joined
Jul 7, 2016
Messages
4
Reaction score
0
I want to sample in Python (not record) audio from a Foscam (FI9805P) camera I have on my network. I've tested the audio setup overall using iSpy and VLC (i.e. I know the audio is working and available via rtsp.) For the solution I'm building I just need to take some samples of audio over a short period of time so I can determine dB level. A relatively elevated dB level tells me an event is taking place. That's all I'm looking to confirm: elevated or normal dB levels.

The Python modules that seem to be the most popular for sound are PyAudio and sounddevice. All the documentation and examples I've found are for sound devices that are directly attached to the hardware running Python.

I need to either 1/ make that remote audio stream appear to the local machine as if it is local or 2/ in Python connect to that audio device and connect the stream to either PyAudo or sounddevice.

Does anyone have any experience or suggestions for how to do this?

Thanks!

Jim
 

tangent

IPCT Contributor
Joined
May 12, 2016
Messages
4,423
Reaction score
3,658
You probably need to use something like ffmpeg. Honestly though I'd get better cameras, many of which can alert to loud noise on their own
 
Joined
Jul 7, 2016
Messages
4
Reaction score
0
Thanks.

I know there is software out there (e.g. iSpy) that will alert on sound. However I'm not trying to alert on sound, I'm wanting to use sound as a verification/secondary data point for other non-sound analysis that is taking place.

The overall problem I'm addressing is the detection of passing freight trains and their direction of travel. I have written a Python program that uses OpenCV to do this. Overall it's working very well, however there are some situations at night where accuracy goes down. When the visual analysis thinks it has a train - or I'm close to thinking there is a train, I want to use sound as a final data/confirmation point.

I really don't want to have sound data coming from a separately running program. I'd like to keep this sound confirmation capability in the same program as the current OpenCV program.
 
Top