motion的移植和使用

来源:互联网 发布:网络快车功能 编辑:程序博客网 时间:2024/06/04 19:50
说明:
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

[python] view plain copy
  1. kangear@ubuntu:~/Download/motion-3.2.11.1$ ./configure --prefix=${PWD}/_install --host=arm-linux --without-ffmpeg  
  2. configure: WARNING: If you wanted to set the --build type, don't use --host.  
  3. If a cross compiler is detected then cross compile mode will be used.  
  4. checking for Darwin... no  
  5. checking for *BSD... no  
  6. checking for arm-linux-gcc... arm-linux-gcc  
  7. checking for C compiler default output file name... a.out  
  8. checking whether the C compiler works... yes  
  9. checking whether we are cross compiling... yes  
  10. checking for suffix of executables...   
  11. checking for suffix of object files... o  
  12. checking whether we are using the GNU C compiler... yes  
  13. checking whether arm-linux-gcc accepts -g... yes  
  14. checking for arm-linux-gcc option to accept ISO C89... none needed  
  15. checking threads... yes  
  16. checking for libjpeg-mmx... skipping  
  17. checking for libjpeg...   
  18. checking for jpeg_set_defaults in -ljpeg... yes  
  19. checking for ffmpeg... skipping  
  20. checking for mysql support... testing  
  21. checking autodect mysql headers... yes  
  22. checking autodect mysql libs... not found  
  23. Invalid MySQL directory - unable to find libmysqlclient.a or libmysqlclient.so.  
  24. checking for PostgreSQL... testing  
  25. checking autodect pgsql headers... not found  
  26. Invalid PostgreSQL directory - unable to find libpq-fe.h.  
  27. checking how to run the C preprocessor... arm-linux-gcc -E  
  28. checking for grep that handles long lines and -e... /bin/grep  
  29. checking for egrep... /bin/grep -E  
  30. checking for ANSI C header files... yes  
  31. checking for sys/types.h... yes  
  32. checking for sys/stat.h... yes  
  33. checking for stdlib.h... yes  
  34. checking for string.h... yes  
  35. checking for memory.h... yes  
  36. checking for strings.h... yes  
  37. checking for inttypes.h... yes  
  38. checking for stdint.h... yes  
  39. checking for unistd.h... yes  
  40. checking stdio.h usability... yes  
  41. checking stdio.h presence... yes  
  42. checking for stdio.h... yes  
  43. checking for unistd.h... (cached) yes  
  44. checking for stdint.h... (cached) yes  
  45. checking fcntl.h usability... yes  
  46. checking fcntl.h presence... yes  
  47. checking for fcntl.h... yes  
  48. checking time.h usability... yes  
  49. checking time.h presence... yes  
  50. checking for time.h... yes  
  51. checking signal.h usability... yes  
  52. checking signal.h presence... yes  
  53. checking for signal.h... yes  
  54. checking sys/ioctl.h usability... yes  
  55. checking sys/ioctl.h presence... yes  
  56. checking for sys/ioctl.h... yes  
  57. checking sys/mman.h usability... yes  
  58. checking sys/mman.h presence... yes  
  59. checking for sys/mman.h... yes  
  60. checking linux/videodev.h usability... yes  
  61. checking linux/videodev.h presence... yes  
  62. checking for linux/videodev.h... yes  
  63. checking linux/videodev2.h usability... yes  
  64. checking linux/videodev2.h presence... yes  
  65. checking for linux/videodev2.h... yes  
  66. checking sys/param.h usability... yes  
  67. checking sys/param.h presence... yes  
  68. checking for sys/param.h... yes  
  69. checking for sys/types.h... (cached) yes  
  70. checking for get_current_dir_name... yes  
  71. checking for struct v4l2_buffer... yes  
  72. checking for V42L support... yes  
  73. checking for short... yes  
  74. checking size of short... 2  
  75. checking for int... yes  
  76. checking size of int... 4  
  77. checking for long int... yes  
  78. checking size of long int... 4  
  79. checking for long long... yes  
  80. checking size of long long... 8  
  81. checking for int *... yes  
  82. checking size of int *... 4  
  83. checking for void *... yes  
  84. checking size of void *... 4  
  85. checking for an ANSI C-conforming const... yes  
  86. Detected CPU: Pentium(R) Dual-Core CPU E5800 @ 3.20GHz  
  87. /tmp/cpu_test-8769-14647.c:1: error: bad value (i686) for -march= switch  
  88. No CPU optimizations will be added  
  89. checking for bswap instruction... yes  
  90. configure: creating ./config.status  
  91. config.status: creating thread1.conf  
  92. config.status: creating thread2.conf  
  93. config.status: creating thread3.conf  
  94. config.status: creating thread4.conf  
  95. config.status: creating motion-dist.conf  
  96. config.status: creating motion.init-FreeBSD.sh  
  97. config.status: creating motion.init-Debian  
  98. config.status: creating motion.init-RH  
  99. config.status: creating motion.spec  
  100. config.status: creating Makefile  
  101. config.status: creating config.h  
  102. config.status: config.h is unchanged  
  103.   
  104. *******************************  
  105. Configure status   
  106. motion "3.2.11.1"  
  107. *******************************  
  108.   
  109. OS : Linux  
  110. pthread Support: Yes  
  111. jpeg Support: Yes  
  112. V4L included: Yes  
  113. V4L2 supported: Yes  
  114. FFmpeg Support: No  
  115. MYSQL Support: No  
  116. PostgreSQL Support: No  
  117.   
  118. CFLAGS: -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP   
  119. LIBS: -lm -lpthread -ljpeg  
  120. LDFLAGS:   
  121.   
  122. Install prefix: /home/kangear/Download/motion-3.2.11.1/_install  
  123.   
  124. kangear@ubuntu:~/Download/motion-3.2.11.1$ make  
  125. Welcome to the setup procedure for Motion, the motion detection daemon! If you get  
  126. error messages during this procedure, please report them to the mailing list. The  
  127. Motion Guide contains all information you should need to get Motion up and running.  
  128. Run "make updateguide" to download the latest version of the Motion Guide.  
  129.   
  130. Version: 3.2.11.1  
  131. Platform: Linux (if this is incorrect, please read README.FreeBSD)  
  132.   
  133. Generating dependencies, please wait...  
  134.   
  135. Compiling Motion object files...  
  136. --------------------------------------------------------------------------------  
  137. 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.c  
  138. 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 conf.o conf.c  
  139. 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 draw.o draw.c  
  140. 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 jpegutils.o jpegutils.c  
  141. 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.o video.c  
  142. 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 video2.o video2.c  
  143. video2.c: In function 'v4l2_set_mmap':  
  144. video2.c:422: warning: suggest parentheses around operand of '!' or change '&' to '&&' or '!' to '~'  
  145. 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.c  
  146. 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 netcam.o netcam.c  
  147. 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 netcam_ftp.o netcam_ftp.c  
  148. 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 netcam_jpeg.o netcam_jpeg.c  
  149. 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 netcam_wget.o netcam_wget.c  
  150. 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 track.o track.c  
  151. 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 alg.o alg.c  
  152. 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 event.o event.c  
  153. 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 picture.o picture.c  
  154. 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 rotate.o rotate.c  
  155. 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 webhttpd.o webhttpd.c  
  156. 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 webcam.o webcam.c  
  157. --------------------------------------------------------------------------------  
  158. Motion object files compiled.  
  159.   
  160. Linking Motion...  
  161. --------------------------------------------------------------------------------  
  162. 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   
  163. --------------------------------------------------------------------------------  
  164. Motion has been linked.  
  165.   
  166. Build complete, run "make install" to install Motion!  
  167.   
  168. kangear@ubuntu:~/Download/motion-3.2.11.1$ make install  
  169. Installing files...  
  170. --------------------------------------------------------------------------------  
  171. mkdir -p /home/kangear/Download/motion-3.2.11.1/_install/bin  
  172. mkdir -p /home/kangear/Download/motion-3.2.11.1/_install/share/man/man1  
  173. mkdir -p /home/kangear/Download/motion-3.2.11.1/_install/etc  
  174. mkdir -p /home/kangear/Download/motion-3.2.11.1/_install/share/doc/motion-"3.2.11.1"  
  175. mkdir -p /home/kangear/Download/motion-3.2.11.1/_install/share/motion-"3.2.11.1"/examples  
  176. install motion.1 /home/kangear/Download/motion-3.2.11.1/_install/share/man/man1  
  177. install CHANGELOG COPYING CREDITS INSTALL README motion_guide.html /home/kangear/Download/motion-3.2.11.1/_install/share/doc/motion-"3.2.11.1"  
  178. 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"/examples  
  179. install motion-dist.conf /home/kangear/Download/motion-3.2.11.1/_install/etc  
  180. for prog in motion; \  
  181. do \  
  182. (install $prog /home/kangear/Download/motion-3.2.11.1/_install/bin ); \  
  183. done  
  184. --------------------------------------------------------------------------------  
  185. Install complete! The default configuration file, motion-dist.conf, has been  
  186. installed 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.conf  
  187. for Motion to find it. More configuration examples as well as init scripts  
  188. can be found in /home/kangear/Download/motion-3.2.11.1/_install/share/motion-3.2.11.1/examples.  
  189.   
  190. kangear@ubuntu:~/Download/motion-3.2.11.1$ ls _install/bin/  
  191. motion  
  192. kangear@ubuntu:~/Download/motion-3.2.11.1$  

原创粉丝点击