linux ubuntu web cam usb cam motion detection image shot
linux ubuntu web cam usb cam motion detection image shot
2011-12-20 10:47:11
WEB CAM APP.
motion
command line tool for detection, output jpeg or ppm or mpeg.
firefox open http://localhost:8080/
For "[1] mjpegtoyuv420p: Corrupt image ... continue" problem,
@oo:~$ LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so motion -n
run ok but once. because edit motion.conf. more careful to setup conf.
copy from /etc/
Only To:
target_dir /home/wei/Image/motion (存檔位置)
width 1184
height 656
quality 100
影片預設為swf
ffmpeg_video_codec msmpeg4
圖片設定
#output_normal on : 有變動就存。
#output_normal first : First picture of an event is saved
#output_normal best : 只存最大動作的圖。
#output_normal center : 只存一個動作中的中位。
執行指令:
~$ LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so motion -n -c
/home/wei/.motion/motion.conf
guvcview
Camorama webcam viewer
瀏覽、修改及儲存來自網路測影機的影像。
攝影機監視器
同上。
Kamoso
Take any picture with your web cam.
VLC
vlc v4l2:///dev/video0
===========================================================
target_dir /home/wei/Image/motion (存檔位置) 是固定的,所以要改用script
啟動並且依照時間產生存放的資料夾會有困難。
在script中建立變動的時間資料夾的連結,讓motion.conf固定去連結。
# tmp is fixed dir name in motion.conf. Need -T to link dir.#
LN="ln -sf -T $Home/$NowDir $Home/tmp"
echo `$LN`
===========================================================
#!/bin/bash
##
## Run motion at different dir each time.
##
Home="/home/wei/Image/motion"
LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so
export LD_PRELOAD
MotionCommand="motion -c /home/wei/.motion/motion.conf -n"
#MotionCommand="LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so motion -c
/home/wei/.motion/motion.conf -n"
NowDir=`date +%F_%H_%M`
echo $NowDir
echo `pwd`
#cd /home/wei
#echo `pwd`
cd $Home
echo `pwd`
mkdir $NowDir
# tmp is fixed dir name in motion.conf. Need -T to link dir.#
LN="ln -sf -T $Home/$NowDir $Home/tmp"
echo `$LN`
#cd $NowDir
#echo `pwd`
## Run
$MotionCommand