【翻译】动态图像监测开源代码 motion 学习-----Motion Guide - Installation(motion的安装指南)


【翻译】动态图像监测开源代码 motion 学习-----Motion Guide - Installation(motion的安装指南)


说在前面:

我没有经历过专业的翻译培训,也没有丰富的翻译经验,之所以会对Motion这个开源项目的手册进行简单的意思解释,一是因为我要用Motion,二是我对它感兴趣,三是刚好再熟悉一下英语。只是作为以后应用的一个参考,肯定存在很多不足之处,因此,仅供参考!

motion源码地址  http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome

原文地址 点击打开链接

Motion Guide - Installation(motion的安装指南)

This topic consists of the following(子内容) subtopics:MotionOverviewKnownProblemsInstallOverview,PrepareInstallConfigureScriptMakeInstall,UpgradingFromOlderVersionErrorLogging.


What is Motion?(motion简介)

Motion is a program that monitors the video signal from one or more cameras and is able to detect if a significant part of the picture has changed. Or in other words, it can detect motion.
The program is written in C and is made for the Linux operating system.

Motion is a command line based tool. It has absolutely no graphical user interface. Everything is setup either via the command line or via a set of configuration files (simple ASCII files that can be edited by any ASCII editor).

The output from motion can be(输出内容):

  • jpg files
  • ppm format files
  • mpeg video sequences

How do I get Motion and what does it cost?

(使用motion的权利和限制,如果作为爱好研究使用,是完全免费的,

如果做修改并有商业用途,则需要详细阅读GPL和许可。)

If you want to use Motion in a commercial product, if you want to distribute either modified or original versions of Motion - for free or for a fee, you should read the license carefully.

Which version to download and use?

Versions 3.2.X are the current version. There is at the moment no development branch. The versions 3.1.X ended at 3.1.20 and there will be no more 3.1.X releases. If you use use a version older than 3.2.X you are encouraged to update.

What features does Motion have?(motion的特性,由下面内容可知motion很强大)

See more description at the Motion Homepage.
  • Taking snapshots of movement
  • Watch multiple video devices at the same time(同时支持多个视频设备)
  • Watch multiple inputs on one capture card at the same time
  • Live streaming webcam (using multipart/x-mixed-replace)
  • Real time creation of mpeg movies using libraries from ffmpeg
  • Take automated snapshots on regular intervals
  • Take automated snapshots at irregular intervals using cron
  • Executing external program when detecting movement
  • Execute external program at the beginning of an event of several motion detections.
  • Execute external program at the end of an event of several motion detections.
  • Execute external program when a picture is saved.
  • Execute external program when a movie mpeg is created (opened)
  • Execite external program when a movie mpeg ends (closed)
  • Motion tracking
  • Feed events to an MySQL or PostgreSQL database.
  • Feed video back to a video4linux loopback for real time viewing
  • Web interface using Motion Related Projectssuch as motion.cgiKenneths Webcam PackageKevins WebpageX-Motion and many more.
  • User configurable and user defined on screen display.
  • Control via simple web interface.
  • Automatic noise and threshold control
  • Ability to control the pan/tilt of a Logitech Sphere (or Orbit) camera
  • Highly configurable display of text on images.
  • High configurable definition of path and file names of the stored images and films.

You can find more information and links at the Motion Homepage.


Supported Hardware(硬件支持)


Input devices: Here we are thinking about the cameras.

Motion supports video input from two kinds of sources.

Standard video4linux devices (e.g. /dev/video0). Motion has no drivers for cameras. Installing the camera itself is outside the scope of this document. But here are some nice links.


Known Problems(其他需要知道的问题)


See also the Frequently Asked Questions and Bug Reports for known open bugs.
Camera picture dimensions must be multiple of 16 Dimentions of camera image must have both height and width that are a multiple of 16. Thís is normally not a problem. All standard sizes like 640, 480, 352, 320, 288, 240, ...etc are multiples of 16. But if you intend to monitor a network camera which is saving jpeg images you may have to pay attention to the dimensions of the picture.

ffmpeg_filename has changed name to movie_filename The 3.2.5 release contains a motion_guide and man page in which it was forgotten to change ffmpeg_filename to movie_filename. Please note that the option that defines the filenames for mpeg movies is now called movie_filename. This change is made because we may soon implement alternatives to ffmpeg and then ffmpeg_filename will be a bad name. This is fixed in release 3.2.5.1.

error: `time_current_frame' undeclared (first use in this function) A bug in 3.2.5 and 3.2.5.1 where a bugfix related to snapshot feature has created a new bug when you compile Motion without ffmpeg libs installed. This is fixed in 3.2.6.


How do I install Motion?(motion的安装细节)


Motion is mainly distributed as source files that you must compile yourself. There is also an RPM made on Fedora Core 3. And Debian packages are available for selected versions.

The short overview of the steps to install Motion from sources.
  • Preparation: Motion uses a number of shared libraries that must be installed on your computer before you can build Motion. The needed shared libraries depends on the features you wish to use. Features network camera, ffmpeg, MySQL and PostgreSQL needs specific shared libraries installed. See preparation section for more information.

  • Download the motion source files (distributed as tar'ed and compressed files). Place the file in a place of your own choice.

  • Untar and uncompress the file to the place you want the program installed. Editor recommends placing the motion source file directory in /usr/local. If you do not have write access to the /usr/local directory (you are under the mercy of an ignorant system administrator with a severe case of paranoia) - you can install the program in a directory in your home directory. You will then need to read the next section about how to configure before you compile the program. Below is shown the exact commands using version 3.2.X installed in /usr/local as an example (replace /path/to with the actual placement of the tar.gz file).
  • cd /usr/local
    tar -xvzf /path/to/motion-3.2.X.tar.gz
    
  • You will now have created a directory called motion-3.2.X. You can rename it to motion (mv motion-3.1.X motion). I recommend creating a symbolic link to the current version. This way you can more easily experiment with different version simply by changing the link.
  • ln -s motion-3.2.X motion
    
  • Now change to the new directory
  • cd motion
    
  • Run configure. You can start with the defaults. If you need to modify the installation parameters you can read the next section.
  • ./configure
    
  • Build the code
  • make
    
  • Install the code, manual page, etc
  • make install
    
  • In /etc/motion/etc you will find a file called motion-dist.conf. If it is the first time you install Motion - rename this file to motion.conf and edit as a minimum the settings: videodevice,inputnormfrequencywidthheight andtarget_dir. That should get you going.

  • Run the program. To enable more features you must modify the config file.
  • motion
    



Preparation For Install(依赖哪些库文件)


Before you start you may need to install a number of shared libraries that Motion uses. If they are missing the feature will simply normally not be included. Most of these libraries can be found on the CDs of your distribution. A few will have to be downloaded from the Internet. Note that when you install software using pre-compiled binaries (Redhat type RPMs, Debian debs etc) you normally only get what is needed to run the programs themselves. In order to compile other programs from source that uses these pre-compiled libraries you also need to installed the development packages. These are normally called the same name as the package suffixed by -devel or -dev. These development packages contains the header files (xxx.h) that Motion needs to build with the shared libraries. If you build a library from sources you already have these header files. It is recommended to simply install the pre-compiled binary packages and their development brothers.


Configure Script(脚本配置)


Configure is script that you run to setup the build environment for the C-compiler. It generates the "Makefile" which the program "make" uses to compile and install the software.

To run configure your current directory must be the motion directory. You type

./configure

You can add the parameter ./configure --help to get help on the different switches.

Make

When you run make, all the C-source files are automatically compiled and linked. Just look out for error messages.

Make uses a file called "Makefile" which is generated by the "configure" script you just ran. If you have special needs you can manually edit this file. Next time you run configure a new Makefile will be generated and your changes are lost.

ALERT! Attention!

If you have run make before, you should run a make clean before running make again. This cleans out all the object files that were generated the previous time you ran make. If you do not run make clean first before you rebuild Motion you may not get the additional feature included. For example: If you built Motion without ffmpeg support and then add it later - and rebuild Motion without running make clean first - the ffmpeg feature does not get compiled into the Motion binary.

First time you build motion run ./configuremake,make install. If you need to build it again (to run with different configure options) run ./configure,make cleanmakemake install.


Make Install(安装)


simply copies all the nice files that were generated during the compilation/linking that make did.

Makes the directories (if they do not already exist)(path shown are the defaults): /usr/local/bin, usr/local/man/man1, /usr/local/etc, /usr/local/share/doc/motion-3.2.X, and /usr/local/share/doc/examples/motion-3.2.X.

Copies the following files from the base motion directory (assuming the default PREFIX /usr/local was used when running configure - otherwise adjust to the actuals you chose)
  • Executable binary "motion" to /usr/local/bin
  • Manual page "motion.1" to /usr/local/man/man1
  • Document files "CHANGELOG, COPYING, CREDITS, INSTALL, and README to /usr/local/share/doc/motion-3.2.X
  • Example configuration files "*.conf" to /usr/local/share/doc/examples/motion-3.2.X
  • Configuration file "motion-dist.conf" to /usr/local/etc
Note that the any existing files are overwritten. The default config file motion-dist.conf is named like this so that you do not get your working motion.conf file overwritten when you upgrade Motion.



Un-install(卸载)

From the motion base installation directory you simply run make uninstall

And delete the base installation directory in /usr/local and any link pointing to it. If you have forgotten where you installed it or someone else did it for you, simply search for the files and directories starting with motion. If the filenames and the directories match the names described in the "Make Install" section of this document, you can safely delete them.



Additional Make Options(make的其他选项)

The make command can be run with several options.makemake install and make uninstall has already been described above.

make clean
deletes all the binary files (object files) and the motion binary generated by make. It also deletes temporary files and any jpg files that motion has saved in the motion source directory. It is very important to always run make clean before you run make if you change the configuration (like adding features such as ffmpeg) and rebuild motion.

make distclean
deletes the files: config.status, config.log, config.cache, Makefile, and motion.spec.

make updateguide
fetches a fresh new copy of this guide and place it in your motion source directory. Note that the pictures are not downloaded.

make dist
performs make clean, make distclean and make updateguide in one single operation.


Error Logging(错误日志)


Motion reports errors to the console when it runs in non-daemon mode. And it outputs even more information when run in setup mode.

Error logging has been implemented so that errors during daemon (background) mode are logged in the syslog.

The syslog is in most Linux systems the file/var/log/messages (e.g. RedHat/Fedora) or/var/log/syslog and /var/log/user.log (e.g. Debian).


Ubuntu中错误记录在/var/log/syslog中。
其实在Ubuntu中motion的安装很方便,只需root权限下执行下面命令:
apt-get install motion
然后进行配置即可。详见我的另一篇文章 点击打开链接


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值