motion的移植和使用

来源:互联网 发布:淘宝店名起名大全2016 编辑:程序博客网 时间:2024/05/16 04:32
说明:
motion主页:http://www.lavrsen.dk/foswiki/bin/view/Motion
motion下载地址:http://sourceforge.net/projects/motion/files/motion%20-%203.2/

系统: Ubuntu 12.10
开发板:mini2440
linux: 2.6.32
交叉工具链:4.4.3
motion版本:3.2.11.1


对于PC版本的直接apt-get install motion就可以的具体的使用方法参见这里。
本文主要记录一下ARM版本的编译使用:
1.去上边说明的motion下载地址下载3.2.11.1版本
2.配置命令:./configure  --prefix=${PWD}/_install  --host=arm-linux --without-ffmpeg




3.接下来就是make  和 make install了。




4.make install后会在_install/bin/目录下产生motion可执行文件,拷贝到开发板上/root/motion目录下,并在同目录中建motion.conf内容如下:
# Minimal motion example config file provided by the
# Debian motion package - for basic webcam operation.
#
# You most certainly want to investigate
# /usr/share/doc/motion/examples/motion-dist.conf.gz
# for further configuration options. Also, refer to the
# motion man page and /usr/share/doc/motion/motion_guide.html
# for detailed information on configuration options.

 

daemon off

quiet on

locate on

 

# You may very well need to change this (check with 'dmesg'
# after plugging in your webcam).

videodevice /dev/video0

 

# Image size in pixels (valid range is camera dependent).

width 320

height 240

 

framerate 25

quality 85

auto_brightness off

 

# General threshold level and noise threshold
# level (for distinguishing between noise and motion).

threshold_tune off

threshold 4500

noise_level 64


# Initial brightness, contrast, hue (NTSC), and saturation.
# 0 = disabled (valid range 0-255).

brightness 0

contrast 0

saturation 0

hue 0


# Encode movies in real-time (install ffmpeg before enabling).

ffmpeg_cap_new on

 
# Codec to be used by ffmpeg for the video compression.
# Supported formats: mpeg4, msmpeg4.

ffmpeg_video_codec msmpeg4

 

# Target base directory for pictures and films (you may need
# to change this (or change its permissions) depending on
# which system user runs motion).

target_dir /root/motion/snapshots

 
# Define a port number (e.g. 8000) to enable the mini-http server.

# 0 = disabled.

webcam_port 8081

 
# Set to 'off' to allow anybody (not just localhost) to view the
# webcam via the mini-http server (http://hostname:port).

webcam_localhost off

 
snapshot_interval 1

snapshot_filename snapshot

 
webcam_quality 50

webcam_maxrate 8

#on_event_start /root/motion/on_motion_detected

#on_event_end /root/motion/on_motion_end

gap 10

5.运行./motion -c motion.conf


6.用chrome浏览器实时监控(360极速,世界之窗测试不可以)



7.Motion编译不过的解决方法

a.以上记录所有的版本全部已经给出arm-linux-gcc请采用这个版本。

b.关于桌面系统,我觉得关系不大,但是我采用的是ubuntu 12.10

c.如果出现的是MySQL的问题说明检测的是PC上有这个MySQL库,而在交叉编译时并没有导致配置和编译出不同的结果,解决方法有两个:1.卸载PC上的MySQL数据库2.编译配置的时候强制禁制使用MySQL库添加--without-mysql。会主动跳过MySQL的:checking for mysql support... skipped

kangear@ubuntu:~/Download/motion-3.2.11.1$ ./configure --prefix=${PWD}/_install --host=arm-linux --without-ffmpegconfigure: WARNING: If you wanted to set the --build type, don't use --host.If a cross compiler is detected then cross compile mode will be used.checking for Darwin... nochecking for *BSD... nochecking for arm-linux-gcc... arm-linux-gccchecking for C compiler default output file name... a.outchecking whether the C compiler works... yeschecking whether we are cross compiling... yeschecking for suffix of executables... checking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether arm-linux-gcc accepts -g... yeschecking for arm-linux-gcc option to accept ISO C89... none neededchecking threads... yeschecking for libjpeg-mmx... skippingchecking for libjpeg... checking for jpeg_set_defaults in -ljpeg... yeschecking for ffmpeg... skippingchecking for mysql support... testingchecking autodect mysql headers... yeschecking autodect mysql libs... not foundInvalid MySQL directory - unable to find libmysqlclient.a or libmysqlclient.so.checking for PostgreSQL... testingchecking autodect pgsql headers... not foundInvalid PostgreSQL directory - unable to find libpq-fe.h.checking how to run the C preprocessor... arm-linux-gcc -Echecking for grep that handles long lines and -e... /bin/grepchecking for egrep... /bin/grep -Echecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking stdio.h usability... yeschecking stdio.h presence... yeschecking for stdio.h... yeschecking for unistd.h... (cached) yeschecking for stdint.h... (cached) yeschecking fcntl.h usability... yeschecking fcntl.h presence... yeschecking for fcntl.h... yeschecking time.h usability... yeschecking time.h presence... yeschecking for time.h... yeschecking signal.h usability... yeschecking signal.h presence... yeschecking for signal.h... yeschecking sys/ioctl.h usability... yeschecking sys/ioctl.h presence... yeschecking for sys/ioctl.h... yeschecking sys/mman.h usability... yeschecking sys/mman.h presence... yeschecking for sys/mman.h... yeschecking linux/videodev.h usability... yeschecking linux/videodev.h presence... yeschecking for linux/videodev.h... yeschecking linux/videodev2.h usability... yeschecking linux/videodev2.h presence... yeschecking for linux/videodev2.h... yeschecking sys/param.h usability... yeschecking sys/param.h presence... yeschecking for sys/param.h... yeschecking for sys/types.h... (cached) yeschecking for get_current_dir_name... yeschecking for struct v4l2_buffer... yeschecking for V42L support... yeschecking for short... yeschecking size of short... 2checking for int... yeschecking size of int... 4checking for long int... yeschecking size of long int... 4checking for long long... yeschecking size of long long... 8checking for int *... yeschecking size of int *... 4checking for void *... yeschecking size of void *... 4checking for an ANSI C-conforming const... yesDetected CPU: Pentium(R) Dual-Core CPU E5800 @ 3.20GHz/tmp/cpu_test-8769-14647.c:1: error: bad value (i686) for -march= switchNo CPU optimizations will be addedchecking for bswap instruction... yesconfigure: creating ./config.statusconfig.status: creating thread1.confconfig.status: creating thread2.confconfig.status: creating thread3.confconfig.status: creating thread4.confconfig.status: creating motion-dist.confconfig.status: creating motion.init-FreeBSD.shconfig.status: creating motion.init-Debianconfig.status: creating motion.init-RHconfig.status: creating motion.specconfig.status: creating Makefileconfig.status: creating config.hconfig.status: config.h is unchanged*******************************Configure status motion "3.2.11.1"*******************************OS : Linuxpthread Support: Yesjpeg Support: YesV4L included: YesV4L2 supported: YesFFmpeg Support: NoMYSQL Support: NoPostgreSQL Support: NoCFLAGS: -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP LIBS: -lm -lpthread -ljpegLDFLAGS: Install prefix: /home/kangear/Download/motion-3.2.11.1/_installkangear@ubuntu:~/Download/motion-3.2.11.1$ makeWelcome to the setup procedure for Motion, the motion detection daemon! If you geterror messages during this procedure, please report them to the mailing list. TheMotion Guide contains all information you should need to get Motion up and running.Run "make updateguide" to download the latest version of the Motion Guide.Version: 3.2.11.1Platform: Linux (if this is incorrect, please read README.FreeBSD)Generating dependencies, please wait...Compiling Motion object files...--------------------------------------------------------------------------------arm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o motion.o motion.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o conf.o conf.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o draw.o draw.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o jpegutils.o jpegutils.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o video.o video.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o video2.o video2.cvideo2.c: In function 'v4l2_set_mmap':video2.c:422: warning: suggest parentheses around operand of '!' or change '&' to '&&' or '!' to '~'arm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o video_common.o video_common.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o netcam.o netcam.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o netcam_ftp.o netcam_ftp.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o netcam_jpeg.o netcam_jpeg.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o netcam_wget.o netcam_wget.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o track.o track.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o alg.o alg.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o event.o event.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o picture.o picture.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o rotate.o rotate.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o webhttpd.o webhttpd.carm-linux-gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall -DVERSION=\""3.2.11.1"\" -Dsysconfdir=\"/home/kangear/Download/motion-3.2.11.1/_install/etc\" -c -o webcam.o webcam.c--------------------------------------------------------------------------------Motion object files compiled.Linking Motion...--------------------------------------------------------------------------------arm-linux-gcc -o motion motion.o conf.o draw.o jpegutils.o video.o video2.o video_common.o netcam.o netcam_ftp.o netcam_jpeg.o netcam_wget.o track.o alg.o event.o picture.o rotate.o webhttpd.o webcam.o -lm -lpthread -ljpeg --------------------------------------------------------------------------------Motion has been linked.Build complete, run "make install" to install Motion!kangear@ubuntu:~/Download/motion-3.2.11.1$ make installInstalling files...--------------------------------------------------------------------------------mkdir -p /home/kangear/Download/motion-3.2.11.1/_install/binmkdir -p /home/kangear/Download/motion-3.2.11.1/_install/share/man/man1mkdir -p /home/kangear/Download/motion-3.2.11.1/_install/etcmkdir -p /home/kangear/Download/motion-3.2.11.1/_install/share/doc/motion-"3.2.11.1"mkdir -p /home/kangear/Download/motion-3.2.11.1/_install/share/motion-"3.2.11.1"/examplesinstall motion.1 /home/kangear/Download/motion-3.2.11.1/_install/share/man/man1install CHANGELOG COPYING CREDITS INSTALL README motion_guide.html /home/kangear/Download/motion-3.2.11.1/_install/share/doc/motion-"3.2.11.1"install *.conf motion.init-Debian motion.init-RH motion.init-FreeBSD.sh /home/kangear/Download/motion-3.2.11.1/_install/share/motion-"3.2.11.1"/examplesinstall motion-dist.conf /home/kangear/Download/motion-3.2.11.1/_install/etcfor prog in motion; \do \(install $prog /home/kangear/Download/motion-3.2.11.1/_install/bin ); \done--------------------------------------------------------------------------------Install complete! The default configuration file, motion-dist.conf, has beeninstalled to /home/kangear/Download/motion-3.2.11.1/_install/etc. You need to rename/copy it to /home/kangear/Download/motion-3.2.11.1/_install/etc/motion.conffor Motion to find it. More configuration examples as well as init scriptscan be found in /home/kangear/Download/motion-3.2.11.1/_install/share/motion-3.2.11.1/examples.kangear@ubuntu:~/Download/motion-3.2.11.1$ ls _install/bin/motionkangear@ubuntu:~/Download/motion-3.2.11.1$



原创粉丝点击