This project allows you to stream audio from your microphone to an ONVIF-compatible IP camera using RTP (Real-time Transport Protocol). It sets up the camera to enable audio output and handles audio capture, encoding, and transmission in real-time.
Before running this script, ensure you have the following prerequisites installed:
requests
onvif-zeep
pyaudio
numpy
msvcrt
(Windows only, used for keyboard input detection)You can install the necessary packages using pip
:
pip install requests onvif-zeep pyaudio numpy
Update the following configuration variables in the script as per your setup:
host
: IP address of the ONVIF camera.port
: Port number for the ONVIF camera (usually 80).username
: Username for the camera.password
: Password for the camera.client_ip
: IP address of the client machine from which you are running the script.python audio_streaming_to_onvif_camera.py
msvcrt
module for detecting keyboard input, which is specific to Windows. Modify this part if running on a different operating system.time.sleep(0.02)
) if necessary to match the audio capture rate and transmission timing.