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-ffmpeg
configure: 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... no
checking for *BSD... no
checking for arm-linux-gcc... arm-linux-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gcc accepts -g... yes
checking for arm-linux-gcc option to accept ISO C89... none needed
checking threads... yes
checking for libjpeg-mmx... skipping
checking for libjpeg... 
checking for jpeg_set_defaults in -ljpeg... yes
checking for ffmpeg... skipping
checking for mysql support... testing
checking autodect mysql headers... yes
checking autodect mysql libs... not found
Invalid MySQL directory - unable to find libmysqlclient.a or libmysqlclient.so.
checking for PostgreSQL... testing
checking autodect pgsql headers... not found
Invalid PostgreSQL directory - unable to find libpq-fe.h.
checking how to run the C preprocessor... arm-linux-gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking for unistd.h... (cached) yes
checking for stdint.h... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking linux/videodev.h usability... yes
checking linux/videodev.h presence... yes
checking for linux/videodev.h... yes
checking linux/videodev2.h usability... yes
checking linux/videodev2.h presence... yes
checking for linux/videodev2.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking for sys/types.h... (cached) yes
checking for get_current_dir_name... yes
checking for struct v4l2_buffer... yes
checking for V42L support... yes
checking for short... yes
checking size of short... 2
checking for int... yes
checking size of int... 4
checking for long int... yes
checking size of long int... 4
checking for long long... yes
checking size of long long... 8
checking for int *... yes
checking size of int *... 4
checking for void *... yes
checking size of void *... 4
checking for an ANSI C-conforming const... yes
Detected CPU: Pentium(R) Dual-Core CPU E5800 @ 3.20GHz
/tmp/cpu_test-8769-14647.c:1: error: bad value (i686) for -march= switch
No CPU optimizations will be added
checking for bswap instruction... yes
configure: creating ./config.status
config.status: creating thread1.conf
config.status: creating thread2.conf
config.status: creating thread3.conf
config.status: creating thread4.conf
config.status: creating motion-dist.conf
config.status: creating motion.init-FreeBSD.sh
config.status: creating motion.init-Debian
config.status: creating motion.init-RH
config.status: creating motion.spec
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged

*******************************
Configure status 
motion "3.2.11.1"
*******************************

OS : Linux
pthread Support: Yes
jpeg Support: Yes
V4L included: Yes
V4L2 supported: Yes
FFmpeg Support: No
MYSQL Support: No
PostgreSQL Support: No

CFLAGS: -g -O2 -D_REENTRANT -DMOTION_V4L2 -DTYPE_32BIT="int" -DHAVE_BSWAP 
LIBS: -lm -lpthread -ljpeg
LDFLAGS: 

Install prefix: /home/kangear/Download/motion-3.2.11.1/_install

kangear@ubuntu:~/Download/motion-3.2.11.1$ make
Welcome to the setup procedure for Motion, the motion detection daemon! If you get
error messages during this procedure, please report them to the mailing list. The
Motion 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.1
Platform: 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.c
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
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
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
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
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
video2.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.c
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
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
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
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
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
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
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
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
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
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
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
--------------------------------------------------------------------------------
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 install
Installing files...
--------------------------------------------------------------------------------
mkdir -p /home/kangear/Download/motion-3.2.11.1/_install/bin
mkdir -p /home/kangear/Download/motion-3.2.11.1/_install/share/man/man1
mkdir -p /home/kangear/Download/motion-3.2.11.1/_install/etc
mkdir -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"/examples
install motion.1 /home/kangear/Download/motion-3.2.11.1/_install/share/man/man1
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"
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
install motion-dist.conf /home/kangear/Download/motion-3.2.11.1/_install/etc
for 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 been
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
for Motion to find it. More configuration examples as well as init scripts
can 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/
motion
kangear@ubuntu:~/Download/motion-3.2.11.1$



  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 18
    评论
评论 18
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

袁保康

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值