by permitivity » Sun Sep 01, 2013 12:32 am
Finally got something that works. Kind of cross posting from another one of my threads, but others might be interested in a pogoplug baby monitor. This uses ffmpeg and a usb webcam with built in microphone.
This is the command:
$this->bbcode_second_pass_quote('', '
')ffmpeg -re -f alsa -i plughw:0 -acodec mp2 -ab 192000 -ar 48000 -ac 1 -filter 'bandpass=f=1000:csg=0:width_type=q:w=.806' -f rtp
rtp://224.1.2.3:1234Using ffmpeg, you start a multicast rtp session. The -ab and -ar flags are bitrate and sampling rate, respectively. Because these webcam microphones have quite a bit of noise, use the filter parameters to filter out the low frequency buzz or high frequency squeech. More about filters can be found on this webpage. Worth playing with to clean up audio.
http://ffmpeg.org/ffmpeg-filters.html#bandpassOn the client device, connect to
rtp://224.1.2.3:1234. This is the address for the multicast resource, not the IP address of the Pogoplug. I'm using an Android phone running VLC to listen to the stream. Still searching for a better app on the client side. I think you can also use another pogoplug with a USB sound card to output the sound to a speaker. Something like "ffplay
rtp://224.1.2.3:1234". I'll try that later.
The ffmpeg process uses about 30% CPU, and the bandwidth needed is about 200 kbps (kilobits). The client device should buffer the stream to make the audio smoother. On wireless, there's some skipping if you don't put in a couple seconds buffer.
I thought making this start on boot would be easy. Saw this trick done by Qui's Pogoplug tutorial with Motion. If someone can help me figure it out, please post.
To make the pogoplug run at startup, create a .service file like this (thanks to moonman for fixing this for me):
$this->bbcode_second_pass_quote('', '
')nano /etc/systemd/system/baby_monitor.service
Paste this into the baby_monitor.service text file.
ExecStart=/usr/bin/ffmpeg -re -f alsa -i plughw:0 -acodec mp2 -ab 192000 -ar 48000 -ac 1 -filter 'bandpass=f=1000:csg=0:width_type=q:w=.806' -f rtp rtp://224.1.2.3:1234