您的位置:首页 > 产品设计 > UI/UE

【翻译】动态图像监测开源代码 motion 学习-----Motion Guide - Getting It Running(让motion动起来)

2014-05-07 14:17 513 查看
【翻译】动态图像监测开源代码 motion 学习-----Motion Guide - Getting It Running(让motion动起来)

说在前面:

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

原文连接 点击打开链接


Motion Guide - Getting It Running(让motion动起来)

This topic consists of the following subtopics:RunningMotionConfigFiles, CommandLineOptions,ConfigFileOptions, SignalsKill, ErrorLogging.


Running Motion(运行motion)


Important Definitions

Motion is invoked from the command line. It has no GUI. (motion用命令行调用,不支持图形用户界面)。Everything is controlled from config files. (用配置文件进行所有控制)。From
version 3.2 the command line is only used to define location of config file and a few special runtime modes (setup and non-daemon).

A few important definitions.

A snapshot is a picture taken at regular intervals independently of any movement in the picture.
A "motion" image/mpeg shows the pixels that have actually changed during the last frames. These pictures are not very useful for normal presentation to the public but they are quite useful
for testing and tuning and making mask files as you can see exactly where motion sees something moving. Motion is shown in greytones. If labelling is enabled the largest area is marked as blue. Smart mask is shown in red.
A "normal" image is the real image taken by the camera with text overlayed.


The Config Files(配置文件)

If Motion was invoked with command line option
-c
pathname
Motion will expect the config file to be as specified. When you specify the config file on the command line with -c you can call it anything.

If you do not specify -c or the filename you give Motion does not exist, Motion will search for the configuration file called 'motion.conf' in the
following order:
(如果你不指定配置文件的路径,则按照下面的方式寻找配置文件motion.conf)

Current directory from where motion was invoked
Then in a directory called '.motion' in the current users home directory (shell environment variable $HOME). E.g. /home/goofy/.motion/motion.conf
The directory defined by the --sysconfdir=DIR when running .configure during installation of Motion

(If this option was not defined the default is /usr/local/etc/)

If you have write access to /usr/local/etc then the editor recommends having only one motion.conf file in the default /usr/local/etc/ directory.

Motion has a configuration file in the distribution package called motion-dist.conf. When you run 'make install' this file gets copied to the /usr/local/etc
directory.

The configuration file needs to be renamed from motion-dist.conf to motion.conf. The original file is called motion-dist.conf so that your perfectly
working motion.conf file does not accidentally get overwritten when you re-install or upgrade to a newer version of Motion.(把motion-dist.conf 重命名为motion.conf)
If you have more than one camera you should not try and invoke Motion more times. Motion is made to work with more than one camera in a very elegant way and the way to do it is
to create a number of thread config files. Motion will then create an extra thread of itself for each camera. If you only have one camera you only need the motion.conf file. The minute you have two or more cameras you must have one
thread config file per camera besides the motion.conf file.(同时有多个视频设备时,每个摄像头需要有一个线程配置文件)
So
if you have for example two cameras you need motion.conf and two thread config
files. Total of 3config files.(也就是说,假如你有两个cameras,那么你需要一个motion.conf
配置文件和两个线程配置文件。一共三个文件。)

An
option that is common to all cameras can be placed in motion.conf. (You can also put all parameters in the thread files but that makes a lot of editing when you change a common thing).

An
option that is unique to a camera must be defined in each thread file.

It is often seen that people copy the entire motion.conf into the thread config files and change a few options. This works but it not recommended because it is more difficult
to maintain and overview. Keep all the common options in motion.conf and the few unique only in the thread config files.(不推荐这段话里面的线程配置文件实现方式)

The
first camera is defined in the first thread file called from motion.conf. The 2nd camera is defined in the 2nd thread file called from motion.conf etc.

Any option defined in motion.conf will be used for all cameras except for the cameras in which the same option is defined in a thread config file.

To make it clear, the thread files format and syntax is the same as motion.conf. An example of what you might want in a thread file as follows:
assume you have two cameras, attached to one system. Create files thread0.conf and thread1.conf. At the end of motion.conf, uncomment out the lines that refer to them. The full contents of the thread files can be as simple as(两个摄像头时,其线程配置文件内容简单示例如下)

thread0.conf:

videodevice /dev/video0

stream_port 8081

thread1.conf:

videodevice /dev/video1

stream_port 8082

Motion reads its configuration parameters in the following sequence. If the same parameter exists more than one place the
last one read wins.(motion运行时读取配置文件的顺序方式)

Motion reads the configuration file motion.conf from the beginning of the file going down line by line.
If the option "thread" is defined in motion.conf, the thread configuration file(s) is/(are) read.
Motion continues reading the rest of the motion.conf file. Any options from here will overrule the same option previously defines in a thread config file.
Motion reads the command line option again overruling any previously defined options.

So always call the thread config files in the end of the motion.conf file. If you define options in motion.conf AFTER the thread file calls, the
same options in the thread files will never be used. So always put the thread file call at the end of motion.conf.(永远把对线程文件调用放在motion.conf的最后)。

Nearly
all config options can be unique for a specific camera and placed in a thread config file. There are a few options that must be in motion.conf and cannot be in a thread config file: control_authentication,control_html_output, control_localhost, control_port,daemon,
and thread.(必须定义在配置文件motion.conf
中的项目)

If
motion is built without specific features such as ffmpeg, mysql etc it will ignore the options that belongs to these features. You do not have to remove them or comment them out.(如果建立motion时没有用到ffmpeg,
mysql 等功能特性,motion将自动忽略这些特性选项。不必手动删除或者把它们注释掉。)

If
you run the http control commandhttp://host:port/0/config/writeyes,
motion will overwrite motion.conf and all the thread.conf files by autogenerated config files neatly formatted and only with the features included that Motion was built with. If you later re-build Motion with more features or upgrade to a new version, you
can use your old config files, run the motion.conf.write command, and you will have new config files with the new options included all set to their default values. This makes upgrading very easy to do.(当重建motion或者进行了版本升级,可以运行motion.conf.write
命令,用之前的配置文件配置新的配置文件,而新配置文件中的新特性则采用默认值。这使得升级变得很容易。)


Command Line Options(命令行选项)


In
Motion 3.2.1 and forward most command line options have been removed and replaced them by an option to specify location to motion.conf and a few options related to setting up motion. There are now only few command line options left and they are basically all
new.

SYNOPSIS

motion [ -hns ] [ -c config file path ] [ -d level ]  [ -p process_id_file ]

具体选项见 点击打开链接


Config File Options(配置文件选项)

These are the options that can be used in the config file.

All number values are integer numbers (no decimals allowed). Boolean options can be on or off.(所有的数字均为整数,不允许小数。布尔选项可以是on或者off)

Some configuration options are only used if Motion is built
on a system that has the matching software libraries installed (MySQL, PostgreSQL and FFMPEG).(有些配置是专门用在匹配的软件上的,具体可看链接 点击打开链接

EDIT:

Lots of config options have changed! In the latest source,
most of the below ffmpeg options don't work, along with a few other options. By default a source install will put a config file with correct options in /usr/local/etc/motion-dist.conf. You can also try looking in motion-dist.conf.in in the source directory.
The config options listed below will still work for older versions of motion, such as the debian package, but will not work with the latest source.

Linked below is a motion config file which works with the current motion source as of 23 Apr 2014.


Options in Alphabetical Order.(选项按字母表排序)

The table below lists all the Motion options in alphabetical order. Click on the option name to see a longer description of each.

具体见链接点击打开链接 往下翻就能找到


Signals (sent with e.g. kill command)(信号)

A signal can be sent from the command line by typing e.g.
kill
-s SIGHUP pid
, where the last parameter is the process ID which you get by typing
ps
-ef ¦ grep motion
. The PID is the first on the list which is the parent process for the threads.(向进程发送信号,获得进程信号,这是daemon为on) 。

Motion responds to the following signals:(motion接收到对应信号后的动作是 点击打开链接


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).

-- KennethLavrsen -
13 Apr 2005
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐