I am currently using picam software to stream audio and video from Raspberry Pi using a NOIR camera and a microphone. One way audio and video is working fine. I need a two way audio connection but picam only establishes one way . Any ideas on how to establish two way audio without disturbing the video streaming that is happening?
If you want to live stream audio from a transmitter to a receiver, then you can use avtools. You can also use avtools to stream your video+audio.
The simplest approach is to use rtp (real time protocol). One example is to use ffmpeg or avconv like so ...
First install avtools from the command line (open a terminal and type the following) :
sudo apt-get install libav-tools
Next, we have to create the rtp stream on the transmitter, which needs to know the receiver's IP address so that it can blindly stream audio data to it.
avconv -f alsa -ac 2 -ar 48000 -i hw:0,0 -acodec mp2 -f rtp rtp://targetIP:port
Here the target IP is the static IP of the receiver. You could use anything reasonable for the port, such as 1234.
To playback you need to use a player, such as VLC or other. Here is an example using avplay :
avplay -i rtp://127.0.0.1:port
So for example if your receiver has the IP address 192.168.0.10 then you would use this on the transmitter :
avconv -f alsa -ac 2 -ar 48000 -i hw:0,0 -acodec mp2 -f rtp rtp://192.168.0.10:1234
Then on the receiver you would use :
avplay -i rtp://127.0.0.1:1234