Make Your Own Baby Night Vision Video Monitor…Again

2 08 2010

So, a while back, I posted about how to hack your own baby monitor. However, it was all fairly easy and didn’t require that much geekery. This time, however, I have gone all out and have produced what I think is a neat little set-up.

I am using a small thin-client PC, an HP T5700 with only a 750Mhz Transmeta Crusoe CPU and 512MB Ram. My PC is low-power and silent (perfect as it is running in our bedroom). I am also using a cheapo Nightvision Webcam from eBay (make sure it is true nightvision and not just some LEDs that you can turn on and off – the description needs to  say that the webcam uses IR LEDs and that they are “invisible to the human eye”) with a combined microphone.

To stream the video from the webcam, I use the rather excellent motion via sudo apt-get install motion. You’ll need to mess with the settings in motion.conf to activate the webcam server and to allow access from users other than localhost, for reference, here is mine. Then, all you need do is set motion running at boot, there is startup script included with motion when you install it, but I am pretty sure that is borked, so I just added “motion” to my /etc/rc.local file. Thus, to view the video, I simply browse to the http://IPADDRESSOFPC:8081, which is easily opened in VLC.

To stream the audio from the microphone on the webcam turned out to be a much more difficult process, as I detailed in the post prior to this one. Suffice to say, FFmpeg came to my rescue, so I simply run the command:

ffmpeg -f oss -i /dev/dsp -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp://234.5.5.5:1234

at boot and my microphone is miraculously streamed to rtp://234.5.5.5:1234, which I can open in VLC (if you are using Linux, you have to use the most recent version of VLC, i.e. 1.1.1, previous versions don’t play well with rtp streams on Linux).

I use the following simple script on my laptop to view both streams, so I can see and hear our lovely daughter, even when she is sound asleep in a dark room:

#!/bin/bash
echo "starting vlc"
VPID=( $(ps -e | grep vlc | awk '{print $1;}'))
if [ $? = 1 ];then
echo "error getting vlc PID, exiting"
exit
fi
while [ -n "$VPID" ];do
kill $VPID
VPID=( $(ps -e | grep vlc | awk '{print $1;}'))
done
cvlc http://192.168.1.5:8081 &
PID1=$?

echo video status $PID1
if [ "$PID1" == "1" ];then
echo "error starting vlc video"
exit
fi
vlc rtp://234.5.5.5:1234 --equalizer-bands="0,0,15,15,15,-20,0,0,0,0" &
PID2=$?

echo audio status $PID2
if [ "$PID2" == "1" ];then
echo "error starting vlc audio"
exit
fi
exit

This set-up has worked perfectly for the last week and even my wife appreciates my geeky skills on this one! Plus, I have a very small WiFi router (a La Fonera2) which makes the system completely portable, as the video feed can be viewed on pretty much any device. This now frees my IP webcams for the job they are much better suited for, home security. The end result are videos of this quality (to be clear, this is a freezeframe from the video feed, taken in a pitch black room):

So, why do all this? Well, for one, it can only up your geekery skills 😉 But also, motion has some cool features, that, for example, let you take regular photos, allowing you to make cool time-lapse videos of your baby as she grows and develops (or sleeps through one night – man they move a lot). motion also has built-in motion detection (that is its main job) so I am sure you can configure it in such a way to act as an early warning system if the baby stops moving (I am thinking the horror that is cot-death here, but I have yet to fully look in to getting this to work yet). Also, if have a spare PC lying around that you can put aside for this, it means that in the future you can use that PC for other jobs as your baby gets older. I am planning to, for example, get a cheap touch screen monitor off eBay, to allow me to turn it into an interactive activity centre for our daughter, to help her learn numbers and the alphabet (there are already some great tools in Ubuntu for just this purpose, but I am learning Python and hope to program my own bespoke software for the job). You could add some speakers and use the PC to play soothing music to your baby to help her sleep or even go all out and hook up some kinda remote-controlled mobile. The options are endless and hopefully it’ll mean that once your baby is all grown up, she wont think of you as her embarrassing geeky mum / dad, but her “makes-really cool stuff for me to play with” mum / dad…. 😉

Advertisements

Actions

Information

9 responses

3 08 2010
Digital Baby Video Monitor – The Perks Of Utilizing Baby Video Monitors | Baby Shower Site

[…] Make Your Own Baby Night Vision Video Monitor…Again | prupert […]

3 08 2010
Digital Baby Video Monitor – Taking Care Of Your Baby Utilizing Video Baby Monitors | Baby Shower Site

[…] Make Your Own Baby Night Vision Video Monitor…Again | prupert […]

7 08 2010
prupert

The video feed can be opened in any web browser, so video would work fine. Not so sure about audio, maybe via QuickTime player?

7 08 2010
Noah

This is really cool. I’d like to try and build a setup like this…..
I don’t have as much geekery knowledge as you, but you’ve given me hope.

Can you tell me exactly which camera you bought? Do they need to sit that close? Ie. Attached to the crib

7 08 2010
Noah

My bad. I see you linked right to the camera… That’s really cheap!

I wonder if there would be a way to monitor from the
iPad…

16 05 2011
Cedric

I am very interested in your solution but the link to Ebay is not available.
Could you recommend me a type of cheap Ebay camera ?
Thank you !

4 04 2012
Digital Video Baby Monitors

Digital Video Baby Monitors…

An outstanding share! I have just forwarded this onto a co-worker who has been doing a little research on this. And he actually bought me dinner due to the fact that I stumbled upon it for him… lol. So allow me to reword this…. Thanks for the meal!…

29 08 2013
Eric (@erictitter2452)

Wow, 3 years after you posted this and I came across it. I’m trying to do the same audio thing (audio only) on a small linux computer with a combo webcam/microphone USB device.

I’m unfamiliar with the rtp stream command for ffmpeg. You used “rtp://234.5.5.5:1234”. What kind of IP address is that? If your network is setup for 192.168.x.x, isn’t this outside the subnet?

Also, does “/dev/dsp” always point to the audio input device? In this case, the microphone portion of the combo mic/webcam usb device?

29 08 2013
prupert

Hiya Eric. I don’t think it matters what subnet you are on for rtp based streams. If you just plug that into VLC, it picks up the stream no probs.

/dev/dsp doesn’t always work – it “usually” points to your microphone, but it very much depends on how the particular variant of linux you are using assigns audio devices and also the physical makeup of the audio device. Sometimes you have to specify the sub-device (so it might be /dev/dsp1), but /dev/dsp should default to the, err, default!

Regardless of what solution i used, if you are looking for long term, real-time audio streaming, i found the audio usually drifted out of sync after a day or so. Simply restarting whatever you are using to listen to the stream helps here.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s