I have also faced this issue a while ago, so I am posting two solutions that worked for me.
The first solution is if you want only audio streaming.
- Step 1: Installing ffmpeg.
Do not use the package ffmpeg from the Raspbian repository apt-get as it says it is obsolete.
The right way:
cd /usr/src
sudo git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
- Step 2: Compiling ffmpeg.
Now,
sudo ./configure && sudo make && sudo make install
Go for a break it will take some time!
You can use some other codecs too, I have used mp2 as it reduces cpu usage by a good amount.
arecord -f cd -D plughw:1,0 | ffmpeg -re -i - -acodec mp2 -ab 32k -ac 1 -f rtp rtp://224.1.2.3:7000
Note: This ip address is a type of multicast address ([224-239].x.y.z). So don't target it to a particular network device on your lan.
- Step 4: Listening Output.
Open Vlc on computer connected to the same network.
Go to media -> network stream -> enter the ip, here rtp://224.1.2.3:7000
The second solution is if you want both audio and video recording at the same time.
- Follow Step 1 and 2. (Remember to be in the right directory)
- Step3: Start Recording.
This is changed as ffmpeg provides full multimedia streaming.
ffmpeg -f alsa -ac 1 -i hw:1 -ar 44100 -f mpegts udp://10.10.0.96:1234
- Step 4: Listening Output.
Open Vlc on computer connected to the same network.
Go to media -> network stream -> enter the ip, here udp://@:1234
arecord -f cd -D plughw:0 -d 10 a.wav