Using IPCam + mplayer + Debian How to

Hardware Config


  1. IP Cam (Number of cam you need)
    (rtsp protocol support, the product will show that it can be viewed thru 3G phone, I haven't try other brand, I have no idea whether normal IP cam support or not)

  2. Homeplug (1 + no ofIP Cam connected)
    Although I have a wireless router, I concern about using too many wireless devices MAY cause potential harm to my new baby. Therefore, I prefer to use wired or homeplug for home network. The advantage of homeplug is more flexible. You can put your IP Cam anywhere at your home after setup.

  3. Router
    Although hubs or switch are also the choices, compare btw the price with router, I choose a router that I can turn off the wireless function.

  4. Linux Box
    I assume that you have proper setup.



After you can view the IP cam thru your network. You can now install your mplayer.

Details please visit here install mplayer

Writing a script to start and stop the recording.


#!/bin/bash

cd ~/livingroom
if [ "$1" == "start" ]; then
/usr/bin/mencoder rtsp://192.168.10.11/live.sdp -oac lavc -ovc lavc -lavcopts vcodec=msmpeg4 -o `date +%y%m%d`.avi >/dev/null 2>&1 &
fi
if [ "$1" == "stop" ]; then
/bin/kill -9 $(ps aux | grep jeff | grep mencoder | grep -v 'grep mencoder' | awk '{print $2}')
/usr/bin/mencoder `date +%y%m%d`.avi -oac lavc -ovc xvid -xvidencopts bitrate=128 -o `date +%y%m%d`-xvid.avi
fi


For 5 hours video, the file size is around 1.7G. That's why I need to change the format of the file.

Start the recording

./code.sh start




Stop the recording

./code.sh stop

Comments

Popular Posts