forked from Motion-Project/motion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmotion_guide.html
4353 lines (4049 loc) · 184 KB
/
motion_guide.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<h1><a name="Motion_Guide_One_Large_Document."></a> Motion Guide </h1>
<p></p>
This version of the Guide is made for inclusion in the Motion download package for off line reading.
<p></p>
<p></p>
<a name="foswikiTOC"></a>
<ul>
<li> <a href="#Motion_Guide"> Motion Guide </a></li>
<ul>
<li> <a href="#Motion_Overview"> Overview </a></li>
<ul>
<li> <a href="#What_is_Motion"> What is Motion? </a></li>
<li> <a href="#How_do_I_get_Motion_and_what_does_it_cost"> How do I get Motion and what does it cost? </a></li>
<li> <a href="#Maintenance_and_Support"> Maintenance and Support </a></li>
<li> <a href="#Which_version_to_download_and_use"> Which version to download and use? </a></li>
<li> <a href="#What_features_does_Motion_have"> What features does Motion have? </a></li>
<li> <a href="#FreeBSD"> FreeBSD </a></li>
<li> <a href="#MacOSX"> MacOSX </a></li>
<li> <a href="#Documentation"> Documentation </a></li>
<li> <a href="#Supported_Hardware"> Supported Hardware </a></li>
</ul>
<li> <a href="#Known_Problems"> Known Problems </a></li>
</ul>
<li> <a href="#Installation_on_Ubuntu_Debian"> Installation on Ubuntu and Debian </a></li>
<li> <a href="#Build_and_install_from_sources"> How to build Motion from the source code. </a></li>
<ul>
<li> <a href="#Preparation_For_Building"> Preparation For Building </a></li>
<li> <a href="#Configure_Script"> Configure Script </a></li>
<li> <a href="#Make"> Make </a></li>
<ul>
<li> <a href="#Make_Install"> Make Install </a></li>
<li> <a href="#Un_Install"> Un-install </a></li>
<li> <a href="#Additional_Make_Options"> Additional Make Options </a></li>
</ul>
<li> <a href="#Upgrading_From_Older_Version"> Upgrading From Older Version </a></li>
<li> <a href="#Running_Motion"> Running Motion </a>
</ul>
<li> <a href="#Important_Definitions"> Important Definitions </a></li>
<li> <a href="#The_Config_Files"> The Config Files </a></li>
<li> <a href="#Command_Line_Options"> Command Line Options </a></li>
<li> <a href="#Signals_Sent"> Signals (sent with e.g. kill command) </a></li>
<li> <a href="#Error_Logging"> Error Logging </a></li>
<li> <a href="#Basic_Setup"> The Basic Setup </a></li>
<li> <a href="#Configuration_Options"> Configuration Options </a></li>
<p></p>
<p></p>
</ul>
<h2><a name="Motion_Overview"></a> Overview </h2>
<ul>
<p></p>
<h3><a name="What_is_Motion"></a> What is Motion? </h3>
<p></p>
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.
<p></p>
The program is written in C and was made for the Linux operating system. Recent revisions have also made it available for BSD.
<p></p>
Motion is a command line based tool with only limited support for configuration via a http interface.
The many configuration options are set via the command line or configuration files.
<p></p>
The output from motion can be:
<p></p>
<ul>
<li> jpg files</li>
<li> ppm format files</li>
<li> movie video sequences</li>
</ul>
<p></p>
<h3><a name="How_do_I_get_Motion_and_what_does_it_cost"></a> How do I get Motion and what does it cost? </h3>
<p></p>
Motion is an open source type of project. It does not cost anything. Motion is published
under the <a href="http://www.gnu.org/licenses/gpl.html" rel="nofollow" target="_top">GNU GENERAL PUBLIC LICENSE</a> (GPL) version 2 or later. It may be a bit difficult to understand all the details of the license text (especially if your first language is not English). It means that you can get the program, install it and use it freely. You do not have to pay anything and you do not have to register anywhere or ask the author or publisher for permission. The GPL gives you both rights and some very reasonable duties when it comes to copying, distribution and modification of the program. So in very general terms you do not have to worry about licensing as a normal hobby user. 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. For more information about free software and the GPL, I encourage you to study the very interesting documents about the subject available the of the Free Software Foundation pages about the <a href="http://www.gnu.org/philosophy/philosophy.html" rel="nofollow" target="_top">Philosophy of the GNU Project</a>.
<p></p>
<h3><a name="Maintenance_and_Support"></a> Maintenance and Support </h3>
<p></p>
Both Motion and the Motion Guide are written by people that do all this as a hobby and without asking for any payments or donations. We have a life other than developing Motion and its documentation. This means that bugfixes and updates to this guide are done as our time and families allow it. You are however encouraged to participate and contribute in a very active <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MailingList">mailing list</a>. It is a list with a very "positive attitude" and with many contributors that propose features, post patches, discuss problems and patiently answer newbie questions with a very positive spirit. Expect 1-10 emails per day.
<p></p>
To get motion direct your browser to the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome" class="foswikiCurrentWebHomeLink">Motion Homepage</a>.
<p></p>
On the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/DownloadFiles">Download Files</a> page you will find
links to the latest stable version both as sources and binaries for some of the most popular Linux distributions.
You will also find links to development versions. Snapshot releases are special test releases that are normally
stable. Every day a <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionDailySourceSnap">Motion Daily Source Snap</a> is created from the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionSubversion">Motion Subversion</a>
<p></p>
Motion was originally written by Jeroen Vreeken and later Folkert van Heusden continued as a
lead programmer with Kenneth Lavrsen responsible for Motion Guide, website and releases on Sourceforge.
<p></p>
From version 3.1.12 Motion is now project managed entirely by Kenneth Lavrsen, and the project now shift
towards being developed by many contributers.
<p></p>
For support we encourage you to join the mailing list instead of writing to Jeroen, Folkert or Kenneth directly.
Newbies and stupid questions are welcome on the list. Contributions in the form of patches are also very welcome
on the mailing list.
<p></p>
<h3><a name="Which_version_to_download_and_use"></a> Which version to download and use? </h3>
<p></p>
Versions 3.2.12 is the current official version released in June 2010. The trunk of the SVN represents the official
development branch of Motion. Additional independent development forks exist on Github that contain additional bug
fixes, enhanced features and updated documentation.
This guide is based upon the features and options included in the source code with which it is distributed.
It was re-written in September 2015 to reflect the changes and options in the code at that time.
The majority of the new options and changed names represent differences between the official 3.2.12 version
and the SVN trunk and as a result this guide will generally apply to the code in the trunk as well. There may
however be some options and features included in this guide that are not incorporated into the trunk source code.
Users are encouraged to evaluate the pros and cons for themselves of using any particular source.
<p></p>
Since 3.2.12 many options have been renamed in the development branches to make setting up Motion easier.
<p></p>
Motion is included in Debian and Ubuntu while RPM users can find the binary package for 3.2.12 on the Motion Sourceforge file download page.
<p></p>
<h3><a name="What_features_does_Motion_have"></a> What features does Motion have? </h3>
<p></p>
See more description at the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome" class="foswikiCurrentWebHomeLink">Motion Homepage</a>.
<ul>
<li> Taking snapshots of movement</li>
<li> Watch multiple video devices at the same time</li>
<li> Watch multiple inputs on one capture card at the same time</li>
<li> Live streaming webcam </li>
<li> Real time creation of movies using libraries from ffmpeg</li>
<li> Take automated snapshots on regular intervals</li>
<li> Take automated snapshots at irregular intervals using cron</li>
<li> Executing external program when a particular event occurs</li>
<li> Motion tracking</li>
<li> Feed events to an MySQL, PostgreSQL or SQLite3 database.</li>
<li> Feed video back to a video4linux loopback for real time viewing</li>
<li> Control via simple web interface.</li>
<li> Automatic noise and threshold control</li>
<li> Ability to control the pan/tilt of a tracking camera.</li>
<li> Highly configurable display of text on images.</li>
<li> Highly configurable definition of path and file names of the stored images and movies.</li>
</ul>
<p></p>
<h3><a name="FreeBSD"></a> FreeBSD </h3>
<p></p>
Motion is originally developed for Linux and it is still mainly developed and supported for this platform. Thanks to contributions of Angel Carpintero, Motion now builds on BSD platforms. These platforms however have had only limited testing.
<p></p>
<h3><a name="MacOSX"></a> MacOSX </h3>
<p></p>
Starting with Motion version 3.2.4, it is now possible to build Motion under MacOSX thanks to Angel Carpintero. The features included are similar to BSD platforms and have had limited testing.
<p></p>
<h3><a name="Documentation"></a> Documentation </h3>
<p></p>
You have the following sources of information:
<p></p>
<ul>
<li> This Motion Guide</li>
<li> The <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/FrequentlyAskedQuestions">Frequently Asked Questions</a></li>
<li> The author of the program has written a description of the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionTechnology">technology behind motion</a>.</li>
<li> The man page. After installation simply type 'man motion' into a terminal screen.</li>
<li> The default motion.conf file (motion-dist.conf) that comes with the package.</li>
</ul>
<p></p>
<h3><a name="Supported_Hardware"></a> Supported Hardware </h3>
<p></p>
Motion supports video input from two kinds of sources.
<p></p>
Standard video4linux devices (e.g. /dev/video0) and network cameras. Motion has no drivers for cameras.
Installing or configuring the camera itself is outside the scope of this document. Generally, if the device works with
other common video player software, it will work with Motion (and vice versa). As a result, it is
often convenient to first get the device working with other software and then use those connection options with Motion.
<p></p>
<p></p>
</ul>
<h2><a name="Known_Problems"></a> Known Problems</a> </h2>
<ul>
<p></p>
See also the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/FrequentlyAskedQuestions">Frequently Asked Questions</a> and <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/BugReports">Bug Reports</a> for known open bugs.
<p></p>
<strong>Kernel 2.6 and pwc.</strong> Note that for kernel 2.6 there is a new release of the Philips WebCam (pwc) drivers 10.0.X. It is recommended to install this. At the time of this being written the 2.6.12+ kernels have a version of pwc built-in but it is a crippled version which can only support very small picture size. You can however download the latest source code of the pwc driver (at this time 10.0.11) and build it without having to rebuild your kernel. But you will need to have either the kernel sources or a special kernel-header package installed to compile it. See <a href="http://www.lavrsen.dk/twiki/bin/viewPWC/InstallationOfPWC">Installation of PWC</a> page which is also hosted in this wiki.
<p></p>
If you use use a <strong>Logitech Quickcam Orbit or Sphere</strong> using the driver pwc/pwcx and kernel 2.6.X you should replace the file in the Motion sources called pwc-ioctl.h with the one that comes with the your pwc version. Motion is shipped with 3 versions of pwc-ioctl.h-VERSION. Rename the one that fits your major pwc version number best to pwc-ioctl.h (after renaming the current to something else). There has been some small adjustments in the API that requires that you have the right header file.
<p></p>
<p></p>
</ul>
<h2><a name="Installation_on_Ubuntu_Debian"></a> <strong>Installation on Ubuntu and Debian</strong> </h2>
<ul>
<p></p>
Motion is part of the Ubuntu and Debian repositories.
<p></p>
Open up a terminal window and type:
<p></p>
<strong>sudo apt-get install motion</strong>
<p></p>
Before we start configuring Motion, we need to copy the config file to our Home folder so that the master copy won't be affected. Open a terminal and copy the configuration file to your Home folder with following commands:
<p></p>
<strong>mkdir .motion</strong>
<p></p>
(Note: This will create a hidden folder <em>.motion</em> in your Home directory.)
<p></p>
<strong>sudo cp /etc/motion/motion.conf ~/.motion/motion.conf</strong>
<p></p>
(Note: This command will copy the original motion configuration file to its location.)
<p></p>
Now can open the configuration file for editing:
<p></p>
<strong>sudo nano ~/.motion/motion.conf</strong>
<p></p>
After you you have made all the appropriate adjustments to the configuration file, close it.
Then start motion in the terminal simply by typing:
<p></p>
<strong>motion</strong>
<p></p>
<p></p>
</ul>
<h2><a name="Build_and_install_from_sources"></a> How to build Motion from source code</a></h2>
<ul>
<p></p>
While Motion is included in the apt packages for Ubuntu and Debian, it can also be built from the source code.
Source code is located in multiple locations depending upon the needs of the user
<ul>
<li>SourceForge (official release)</li>
<li>SVN(official release and maintainer development trunk) </li>
<li>Github(Latest fixes, enhancements and documents from community) </li>
</ul>
<p></p>
<h3><a name="Preparation_For_Building"></a> <a Preparation For Building</a> </h3>
<ul>
<p></p>
<p></p>
In order to build Motion from source, many shared libraries must be installed.
The particular libraries needed will vary depending upon the features desired.
<p></p>
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.
<p></p>
Open a terminal and run the following commands to install the packages.
<p></p>
Ubuntu / Debian Packages
<ul>
<li>Required</li>
<ul>
<p></p>
<code><strong>sudo apt-get install autoconf automake build-essential pkgconf libtool libzip-dev libjpeg62 libjpeg62-dev</strong></code>
<p></p>
</ul>
<p></p>
<li>Optional Packages</li>
<ul>
<li>FFMpeg Functionality(Required for creating movies, using network cameras, etc. SEE NOTE BELOW!)</li>
<ul>
<p></p>
<code><strong>sudo apt-get install libav-tools libavformat-dev libavcodec-dev libavutil-dev libswscale-dev</strong></code>
<p></p>
<strong>OR (DO NOT RUN BOTH OF THESE COMMANDS!)</strong>
<p></p>
<code><strong>sudo apt-get install ffmpeg libavformat-ffmpeg-dev libavcodec-ffmpeg-dev libavutil-ffmpeg-dev libswscale-ffmpeg-dev</strong></code>
<p></p>
</ul>
<li>MySQL database functionality</li>
<ul>
<p></p>
<code><strong>sudo apt-get install mysql-server libmysqlclient-dev</strong></code>
<p></p>
</ul>
<li>PostgreSQL database functionality</li>
<ul>
<p></p>
<code><strong>sudo apt-get install postgresql libpq-dev</strong></code>
<p></p>
</ul>
<li>SQLite3 database functionality</li>
<ul>
<p></p>
<code><strong>sudo apt-get install sqlite3</strong></code>
<p></p>
</ul>
<li>JPEG Turbo</li>
<ul>
<p></p>
<code><strong>sudo apt-get install libjpeg-turbo8 libjpeg-turbo8-dev</strong></code>
<p></p>
</ul>
<li>SDL</li>
<ul>
<p></p>
<code><strong>sudo apt-get install libsdl1.2-dev</strong></code>
<p></p>
</ul>
</ul>
Important ffmpeg/libav note: Only ONE of the set of packages indicated above are needed by Motion. The set of
packages and whether they are Libav or ffmpeg is a user selection and possibly dependent upon which is
available in the Ubuntu/Debian repositories. The source code with the latest fixes will work with either Libav or
ffmpeg. Older source code may compile better using one or the other. It is important to note that many repositories
do NOT include both Libav and ffmpeg. They will only have one or the other. The default for the configure is to
require that ffmpeg or Libav are installed. Use the configure option to compile without the ffmpeg / libav functionality.
</ul>
<p></p>
<p></p>
openSUSE Packages
<ul>
<li>Required</li>
<ul>
<p></p>
<code><strong>sudo zypper install autoconf automake libtool </strong></code>
<p></p>
<code><strong>sudo zypper install --type pattern devel_basis </strong></code>
<p></p>
<code><strong>sudo zypper install libjpeg8-devel </strong></code>
<p></p>
<code><strong>sudo zypper install -t pattern devel_C_C++ </strong></code>
<p></p>
</ul>
<p></p>
<li>Optional Packages</li>
<ul>
<li>FFMpeg Functionality(Required for creating movies, using network cameras, etc. SEE NOTE BELOW!)</li>
<ul>
<p></p>
<code><strong>sudo zypper ar -f -n packman-essentials http://packman.inode.at/suse/openSUSE_13.1/Essentials/ packman-essentials</strong></code>
<p></p>
<code><strong>sudo zypper ar -f -n packman-multimedia http://packman.inode.at/suse/openSUSE_13.1/Multimedia/ packman-multimedia</strong></code>
<p></p>
<code><strong>sudo zypper install libffmpeg-devel</strong></code>
<p></p>
</ul>
<li>MySQL database functionality</li>
<ul>
<p></p>
<code><strong>Not known by author</strong></code>
<p></p>
</ul>
<li>PostgreSQL database functionality</li>
<ul>
<p></p>
<code><strong>Not known by author</strong></code>
<p></p>
</ul>
<li>SQLite3 database functionality</li>
<ul>
<p></p>
<code><strong>Not known by author</strong></code>
<p></p>
</ul>
</ul>
Important ffmpeg note: The ffmpeg libraries indicated above are provided by a external repository. This may
change in the future. Validate that the repository is still valid when doing the install on openSUSE systems.
The default for the configure is to require that ffmpeg or Libav are installed. Use the configure option to
compile without the ffmpeg / libav functionality.
</ul>
<p></p>
<p></p>
</ul>
<h3><a name="Configure_Script"></a> Configure Script</a> </h3>
<ul>
Motion uses a set tools called the "autotools" in order to generate the required scripts in order to
compile and install Motion. The next step after gathering all of the required and desired libraries is to
have the autotools create a configure script. To do this open a terminal and change to the directory with
the source code and type
<p></p>
<code><strong>autoreconf </strong></code>
<p></p>
If the 'configure' file exists and contains a valid script, the tool will return immediately since no additional work
needs to be completed. If the script needs updating, then it will take a moment to return. Once it has been executed,
a file called 'configure' will exist in the directory. Note that if the command is run as
<p></p>
<code><strong>autoreconf -f</strong></code>
<p></p>
The -f parameter instructs it to force a new configure file to be created. This can be preferable in certain
situations so that the configure script gets updated with the correct version number.
Once the 'configure' file is created, we can execute it. What the script does is interrogate the system and look
for all the needed items in order to compile Motion. In this process it looks to determine which optional components
have been installed on the system and if found sets flags to indicate for them to be included. If a particular library
is required by Motion and is not found, the configure script will issue an error. The error means that the library was
not found because it was either not installed or that it was installed into a location that the script could not find.
With the Motion configure script, once it has ended it also lists out all of the optional components that were located.
Note that if you KNOW that a particular component is installed yet the configure script reports it as not installed, then
it may be necessary to use one or more of the configure options described below to tell the script where to find
the particular component.
<p></p>
To run the configure your current directory must be the motion directory. You type
<p></p>
<code>./configure</code>
<p></p>
You can add the parameter <code>./configure --help</code> to get help on the different switches.
<p></p>
When the configure script finishes you should validate that the options desired
were correctly identified by the configure. In particular, the ffmpeg option is occasionally not
found even if it is actually installed. Various users have indicated this to be a particular
problem with the PI. If using a PI and have this issue, you can use the following option
<p></p>
<code>./configure --with-ffmpeg=/usr/lib/arm-linux-gnueabihf</code>
<p></p>
For a long term option, you can edit the file
<code>$HOME/.bashrc</code>
and within it place the following two lines at the end
<code>PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf:$PKG_CONFIG_PATH</code>
<code>export PKG_CONFIG_PATH</code>
<p></p>
The long term option will however only become effective the next time you get into the terminal shell.
<p></p>
<table border="1" class="fixed" >
<colgroup>
<col width="200px">
<col width="500px">
<col width="700px">
</colgroup>
<tbody>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > Options</td>
<td bgcolor="#edf4f9" word-wrap:break-word > Description <br> Defaults for the options are specified in brackets [ ]</td>
<td bgcolor="#edf4f9" word-wrap:break-word > Editors comment </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > -h, --help </td>
<td bgcolor="#edf4f9" word-wrap:break-word > display this help and exit</td>
<td bgcolor="#edf4f9" word-wrap:break-word > </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --help=short</td>
<td bgcolor="#edf4f9" word-wrap:break-word > display options specific to this package </td>
<td bgcolor="#edf4f9" word-wrap:break-word > This command shows the options special to motion. Recommended</td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --help=recursive </td>
<td bgcolor="#edf4f9" word-wrap:break-word > display the short help of all the included packages </td>
<td bgcolor="#edf4f9" word-wrap:break-word > </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word >-V, --version </td>
<td bgcolor="#edf4f9" word-wrap:break-word > display version information and exit</td>
<td bgcolor="#edf4f9" word-wrap:break-word > Provides the version number of the source code and autotools </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > -q, --quiet, --silent </td>
<td bgcolor="#edf4f9" word-wrap:break-word > do not print `checking...' messages </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Illustrates only the results of the script. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --cache-file=FILE </td>
<td bgcolor="#edf4f9" word-wrap:break-word > cache test results in FILE. [disabled] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > No function</td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > -C, --config-cach </td>
<td bgcolor="#edf4f9" word-wrap:break-word > alias for `--cache-file=config.cache' </td>
<td bgcolor="#edf4f9" word-wrap:break-word > No function </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > -n, --no-create</td>
<td bgcolor="#edf4f9" word-wrap:break-word > do not create output files </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Used for testing if other switches produce error - without writing anything to the disk </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --srcdir=DIR</td>
<td bgcolor="#edf4f9" word-wrap:break-word > find the sources in DIR. [configure dir or `..'] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > DIR is a directory path. Editor recommends having the current directory being the motion installation directory and not using this switch. Then it defaults to the same directory as where the configure script is which is the current directory. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > Installation directories:</td>
<th bgcolor="#edf4f9" word-wrap:break-word > </th>
<th bgcolor="#edf4f9" word-wrap:break-word > </th>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --prefix=PREFIX </td>
<td bgcolor="#edf4f9" word-wrap:break-word > install architecture-independent files in PREFIX <br /> [/usr/local]</td>
<td bgcolor="#edf4f9" word-wrap:break-word > The default /usr/local means that <br><br> The executable binary "motion" is installed in /usr/local/bin <br> The manual page in /usr/local/man/man1 <br>The document files in /usr/local/docs/motion-version<br>The configuration file in /usr/local/etc <br>The example config files in /usr/local/examples/motion-version <br><br> The editor recommends keeping this default setting. <br /> If you are experimenting with many parallel versions it may be interesting to set the PREFIX to e.g. /usr/local/motion and then add /usr/local/motion/bin to your search path (or simply cd /usr/local/motion/bin before execution). <br /> This way you can change version just by changing the symbolic link in /usr/local/motion as suggested earlier in this guide. <br /> If you are installing the software on a machine where you have no access to the /usr/local but have write access to a home directory, then you should change this to point to a directory within your home tree. <br /> Example: --prefix=$HOME </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --exec-prefix=EPREFIX </td>
<td bgcolor="#edf4f9" word-wrap:break-word > install architecture-dependent files in EPREFIX <br /> [PREFIX] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > If you set this it only defines an alternative installation directory for the executable binary. <br /> Note: The executable binary will be placed in a directory "bin" below the directory specified by this option <br /> Editor recommends leaving this as default (i.e. not setting it). </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --bindir=DIR</td>
<td bgcolor="#edf4f9" word-wrap:break-word > user executables [EPREFIX/bin] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > With this option you can control exactly in which directory the executable binary is installed. The previous option automatically adds the bin directory. Here you are in fill control. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --sbindir=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > System admin executables [EPREFIX/sbin] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Not used by motion. Ignore it. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --libexecdir=DIR</td>
<td bgcolor="#edf4f9" word-wrap:break-word > program executables [EPREFIX/libexec] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Not used by motion. Ignore it.</td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --datadir=DIR</td>
<td bgcolor="#edf4f9" word-wrap:break-word > read-only architecture-independent data [PREFIX/share] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Not used by motion. Ignore it.</td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --sysconfdir=DIR</td>
<td bgcolor="#edf4f9" word-wrap:break-word > read-only single-machine data [PREFIX/etc] </td>
<td bgcolor="#edf4f9" word-wrap:break-word >
This is where motion both installs the default configuration file and also where it later searches for it. <br />
Motion searches for the configuration file "motion.conf" in the following order:
<br />
<UL> <br /> 1. Current directory from where motion was invoked
<br /> 2. $HOME/.motion
<br /> 3. The sysconfig directory set by this switch. If not defined the default is /usr/local/etc/ <br />
</UL> <br /> Editor recommends leaving this at default. Be careful if you run "make install" again.
This will overwrite the motion-dist.conf file that you may have edited.
</td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --sharedstatedir=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > modifiable architecture-independent data [PREFIX/com] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Not used by motion. Ignore it. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --localstatedir=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > modifiable single-machine data [PREFIX/var] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Not used by motion. Ignore it. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --libdir=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > object code libraries [EPREFIX/lib]</td>
<td bgcolor="#edf4f9" word-wrap:break-word > Not used by motion. Ignore it. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --includedir=DIR</td>
<td bgcolor="#edf4f9" word-wrap:break-word > C header files [PREFIX/include] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Not used by motion. Ignore it.</td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --oldincludedir=DIR</td>
<td bgcolor="#edf4f9" word-wrap:break-word > C header files for non-gcc [/usr/include] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Not used by motion. Ignore it. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --infodir=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > info documentation [PREFIX/info] </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Not used by motion. Ignore it. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --mandir=DIR</td>
<td bgcolor="#edf4f9" word-wrap:break-word > man documentation [PREFIX/man]</td>
<td bgcolor="#edf4f9" word-wrap:break-word > Editor recommends the default.</td>
</tr>
<tr>
<th bgcolor="#edf4f9" word-wrap:break-word > Optional Packages: </th>
<th bgcolor="#edf4f9" word-wrap:break-word > </th>
<th bgcolor="#edf4f9" word-wrap:break-word > </th>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --with-linuxthreads </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Use linuxthreads in BSD instead of native phtreads </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Only relevant for BSD. In Linux we always use this per default. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --with-pwcbsd </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Use pwcbsd based webcams ( only BSD ) </td>
<td bgcolor="#edf4f9" word-wrap:break-word > This option allow to build motion to support V4L/V4L2 in BSD. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --without-bktr </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Exclude to use bktr subsystem , that usually useful for devices as network cameras </td>
<td bgcolor="#edf4f9" word-wrap:break-word > ONLY used in *BSD </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --without-v4l </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Exclude using v4l (video4linux) subsystem. Makes Motion so it only supports network cameras. </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Can be used if you do not need support and maybe lack some of the libraries for it. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --with-jpeg-mmx=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Specify the prefix for the install path for jpeg-mmx for optimized jpeg handling (optional). If this is not specified motion will try to find the library /usr/lib/libjpeg-mmx.a /usr/local/lib/libjpeg-mmx.a. </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Considered experimental </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --with-ffmpeg=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Specify the path for the directory prefix in which the
library and headers are installed .<br /> If not specified configure will search in /usr/ and /usr/local/ </td>
<td bgcolor="#edf4f9" word-wrap:break-word > DIR is the directory PREFIX in which the ffmpeg shared libraries
and their headers are installed. <br /> If you install ffmpeg from sources and use the default directories or
if ffmpeg is installed as a binary package (RPM or deb) you may not need to specify the directory prefix.
Configure should find the libraries automatically. If you installed ffmpeg from sources and specified a
different --prefix when building ffmpeg you must use the same value for the DIR ( --with-ffmpeg=DIR)
or export that location to be included in the PKG_CONFIG_PATH
The option of --with-ffmpeg is the default for Motion. If the required libraries are not located, the
configure script will stop at the ffmpeg section and report which libraries need to be installed.
Once the required libraries are installed, run the script again. As noted previously, make sure
to install the -dev versions.
For more information on FFmpeg see the documentation for the FFmpeg project. <br /> </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --without-ffmpeg </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Do not compile with ffmpeg </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Use this if you do not want to compile with ffmpeg. If ffmpeg is not installed you must specify this option for Motion to build without ffmpeg. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --with-mysql-lib=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Lib directory of MySQL </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Normally, configure will scan all possible default installation paths for MySQL libs. When its fail, use this command to tell configure where MySQL libs installation root directory is. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --with-mysql-include=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Include directory with headers for MySQL </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Normally, configure will scan all possible default installation paths for MySQL include. When its fail, use this command to tell configure where MySQL include installation directory is. This is the directory with the MySQL header files. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --without-mysql </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Do not compile with MySQL support </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Use this if you do not want to include MySQL support in the package. <br /> This can also be useful if you get compilation errors related to MySQL and you actually do not need the feature anyway. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --with-pgsql-lib=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Normally, configure will scan all possible default installation paths for pgsql libs. When it fails, use <br /> this command to tell configure where pgsql libs installation root directory is. </td>
<td bgcolor="#edf4f9" word-wrap:break-word > </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --with-pgsql-include=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Normally, configure will scan all possible default installation paths for pgsql include. When it fails, use this command to tell configure where pgsql include installation root directory is. </td>
<td bgcolor="#edf4f9" word-wrap:break-word > </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --without-pgsql </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Do not compile with PostgreSQL support </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Use this if you do not want to include PostgreSQL support in the package. <br /> This can also be useful if you get compilation errors related to PostgreSQL and you actually do not need the feature anyway. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --without-sqlite3 </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Disable sqlite3 support in motion. </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Use this if you do not want to include SQLite3 support in the package. <br /> This can also be useful if you get compilation errors related to SQLite4 and you actually do not need the feature anyway. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --without-optimizecpu </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Exclude autodetecting platform and cpu type. This will disable the compilation of gcc optimizing code by platform and cpu. </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Use this if the optimization causes problems. Typically if you build on some non X386 compatible CPU. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --without-sdl </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Compile without sdl support.</td>
<td bgcolor="#edf4f9" word-wrap:break-word > </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --with-jpeg-turbo=DIR </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Specify the prefix for the install path for jpeg-turbo for optimized jpeg handling (optional).</td>
<td bgcolor="#edf4f9" word-wrap:break-word > </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > --with-developer-flags </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Add additional warning flags for the compiler. </td>
<td bgcolor="#edf4f9" word-wrap:break-word > This option is for developers only. It produces a flood of warnings that helps the developer to write more robust code. These warnings are normally harmless but can sometimes be a latent defect. </td>
</tr>
</tbody>
</table>
<p></p>
<p></p>
</ul>
<h3><a name="Make"></a> Make </h3>
<ul>
Once the configure script has successfully finished and indicates all options desired, a 'makefile' is created.
The makefile builds the Motion program and links in all of the required libraries. To run the makefile, type
<p></p>
<code>make</code>
<p></p>
The makefile will go through each of the files and compile it. Depending upon the source code obtained, there may be many
warnings or possibly none.
<p></p>
If the notifications indicate many many undefined references, then it is most likely that
an additional library needs to be added in via the configure switches. Many of these additional libraries are related
to the version of ffmpeg and how it was built or installed. The following is a sample of some of the extra libraries
that may need to be added.
<p></p>
<code>
-lavformat -lswscale -lavcodec -lavutil -lfdk-aac -lswresample -lm -lopus -lz -lva -lvpx -lx264 -lmp3lame -lbz2 -ldl -lvorbisenc -lvorbis -ltheoraenc -ltheoradec
</code>
<p></p>
<p></p>
Once the makefile has completed correctly, it will report 'build complete'.
<p></p>
<strong>ALERT!</strong>
<p></p>
If you have run <code>make</code> before, you should run a <code>make clean</code> before
running <code>make</code> again. This cleans out all the object files that were
generated the previous time you ran <code>make</code>. If you do not run <code>make clean</code> 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 <code>make clean</code> first the ffmpeg feature does not get compiled into the Motion binary.
<p></p>
First time you build motion run <code>./configure</code>, <code>make</code>, <code>make install</code>.
If you need to build it again (to run with different configure options) run <code>./configure</code>,
<code>make clean</code>, <code>make</code>, <code>make install</code>.
<p></p>
<h3><a name="Make_Install"></a> Make Install </h3>
<code>make install</code> copies and installs all the files that were generated during the compilation/linking
that <code>make</code> did.
<p></p>
Creates the directories (if they do not already exist)(path shown are the defaults):
<ul>
<li>/usr/local/bin</li>
<li>usr/local/man/man1</li>
<li>/usr/local/etc</li>
<li>/usr/local/share/doc/motion-<code>version</code></li>
<li>/usr/local/share/doc/examples/motion-<code>version</code></li>
</ul>
<p></p>
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)
<ul>
<li> Executable binary "motion" to /usr/local/bin</li>
<li> Manual page "motion.1" to /usr/local/man/man1</li>
<li> Document files "CHANGELOG, COPYING, CREDITS, INSTALL, and README to /usr/local/share/doc/motion-<code>version</code></li>
<li> Example configuration files "*.conf" to /usr/local/share/doc/examples/motion-<code>version</code></li>
<li> Configuration file "motion-dist.conf" to /usr/local/etc</li>
</ul>
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.
<p></p>
<h3><a name="Un_Install"></a> Un-install </h3>
From the motion base installation directory you simply run <code>make uninstall</code>
<p></p>
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.
<p></p>
<h3><a name="Additional_Make_Options"></a> Additional Make Options </h3>
The make command can be run with several options. <code>make</code>, <code>make install</code> and <code>make uninstall</code> has already been described above.
<p></p>
<dl>
<dt> <strong>make clean</strong> </dt>
<dd> 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 <code>make clean</code> before you run <code>make</code> if you change the configuration (like adding features such as ffmpeg) and rebuild motion.</dd>
</dl>
<p></p>
<dl>
<dt> <strong>make distclean</strong> </dt>
<dd> deletes the files: config.status, config.log, config.cache, Makefile, and motion.spec.</dd>
</dl>
<p></p>
<dl>
<dt> <strong>make updateguide</strong> </dt>
<dd> fetches the copy of this guide from the web page and puts it in your motion source directory. Note that the pictures are not downloaded.</dd>
</dl>
<p></p>
<dl>
<dt> <strong>make dist</strong> </dt>
<dd> performs make clean, make distclean and make updateguide in one single operation.</dd>
</dl>
<p></p>
<p></p>
</ul>
<h3><a name="Upgrading_From_Older_Version"></a> Upgrading From Older Version </h3>
<ul>
If you are upgrading from an older version of Motion you should note that many many options have been rename, added or removed.
The author recommends that you start by copying the configuration files from the older version to a safe location for reference only.
Then start with a clean copy of the new motion-dist.conf installed and make changes to it.
<p></p>
<p></p>
</ul>
<h3><a name="Running_Motion"></a> Running Motion </h3>
<ul>
<p></p>
<p></p>
</ul>
</ul>
<h2><a name="Important_Definitions"></a> Important Definitions </h2>
<ul>
<p></p>
Motion is invoked from the command line. It has no GUI. 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
options.
<p></p>
A few important definitions.
<ul>
<li> A snapshot is a picture taken at regular intervals independently of any movement in the picture.</li>
<li> 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.</li>
<li> A "normal" image is the real image taken by the camera with text overlayed.</li>
</ul>
<p></p>
<p></p>
</ul>
<h2><a name="ConfigFiles"></a> <a name="The_Config_Files"></a> The Configuration Files </h2>
<ul>
<p></p>
If Motion was invoked with command line option <code>-c pathname</code> 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.
<p></p>
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:
<p></p>
<ol>
<li> Current directory from where motion was invoked</li>
<li> Then in a directory called '.motion' in the current users home directory (shell environment variable $HOME). E.g. /home/goofy/.motion/motion.conf</li>
<li> The directory defined by the --sysconfdir=DIR when running .configure during installation of Motion<br />(If this option was not defined the default is /usr/local/etc/motion)</li>
</ol>
If you have write access to /usr/local/etc/motion then the editor recommends having only one motion.conf file
in the default /usr/local/etc/motion directory.
<p></p>
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/motion directory.
<p></p>
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.
<p></p>
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 <strong>one thread config file per camera</strong> besides the motion.conf file.
<p></p>
So if you have for example two cameras you need motion.conf <strong>and two</strong> thread config files. Total of <strong>3</strong> config files.
<p></p>
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).
<p></p>
An option that is unique to a camera must be defined in each thread file.
<p></p>
<em>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</em>
<p></p>
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.
<p></p>
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.
<p></p>
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
<p></p>
<p></p>
thread0.conf:<p></p> videodevice /dev/video0<p></p> stream_port 8081
<p></p>
<p></p>
<p></p>
thread1.conf:<p></p> videodevice /dev/video1<p></p> stream_port 8082
<p></p>
<p></p>
<p></p>
Motion reads its configuration parameters in the following sequence. If the same
parameter exists more than one place <strong>the last one read wins</strong>
<ol>
<li> Motion reads the configuration file motion.conf from the beginning of the file going down line by line.</li>
<li> If the option "thread" is defined in motion.conf, the thread configuration file(s) is/(are) read.</li>
<li> 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.</li>
<li> Motion reads the command line option again overruling any previously defined options.</li>
</ol>
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.
<p></p>
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: stream_auth_method, webcontrol_* , daemon, and thread.
<p></p>
If motion is built without specific features such as ffmpeg, mysql etc it will ignore the options that belongs to these features.
<p></p>
If you run the http control command <a href="http://host:port/0/config/writeyes" rel="nofollow" target="_top">http://host:port/0/config/writeyes</a>, 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.
<p></p>
<p></p>
</ul>
<h2><a name="Command_Line_Options"></a> Command Line Options </h2>
<ul>
<p></p>
SYNOPSIS
<pre>
motion [ -hbnsm ] [ -c config file path ] [ -d level ] [ -k level ] [ -p process_id_file ] [ -l log_file ]
</pre>
<p></p>
<ul>
<li>-c : Full path and filename of config file.</li>
<li>-h : Show help screen</li>
<li>-b : Run in daemon mode</li>
<li>-n : Run in non-daemon mode</li>
<li>-s : Run in setup mode. Also forces non-daemon mode.</li>
<li>-d : Run with message log level 1 - 9</li>
<li>-k : Run with message log type 1 - 9</li>
<li>-l : Full path and file name for log file</li>
<li>-p : Full path and file name for the process id file</li>
<li>-m : Start in pause mode</li>
</ul>
<p></p>
<p></p>
</ul>
<h2><a name="Signals_Sent"></a> Signals (sent with e.g. kill command) </h2>
<ul>
<p></p>
A signal can be sent from the command line by typing e.g. <code>kill -s SIGHUP pid</code>, where the last parameter is the process ID which you get by typing <code>ps -ef ¦ grep motion</code>. The PID is the first on the list which is the parent process for the threads.
Motion responds to the following signals:
<p></p>
<table border="1" class="fixed" >
<colgroup>
<col width="250px">
<col width="250px">
<col width="250px">
</colgroup>
<thead>
<tr>
<th bgcolor="#edf4f9" word-wrap:break-word > Signal </th>
<th bgcolor="#edf4f9" word-wrap:break-word > Description </th>
<th bgcolor="#edf4f9" word-wrap:break-word > Editors comment </th>
</tr>
</thead>
<tbody>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > SIGHUP </td>
<td bgcolor="#edf4f9" word-wrap:break-word > The config file will be reread. </td>
<td bgcolor="#edf4f9" word-wrap:break-word > This is a very useful signal when you experiment with settings in the config file. </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > SIGTERM </td>
<td bgcolor="#edf4f9" word-wrap:break-word > If needed motion will create an movie file of the last event and exit </td>
<td bgcolor="#edf4f9" word-wrap:break-word > </td>
</tr>
<tr>
<td bgcolor="#edf4f9" word-wrap:break-word > SIGUSR1 </td>
<td bgcolor="#edf4f9" word-wrap:break-word > Motion will create an movie file of the current event. </td>
<td bgcolor="#edf4f9" word-wrap:break-word > </td>
</tr>
</tbody>
</table>
<p></p>
<p></p>
</ul>
<h2><a name="Error_Logging"></a> Error Logging </h2>
<ul>
<p></p>
Motion reports errors to the console when it runs in non-daemon mode. And it outputs
even more information when run in setup mode.
<p></p>
Error logging has been implemented so that errors during daemon (background) mode are logged in the syslog or to the user
specified log file.
<p></p>
The log is in most Linux systems the file <code>/var/log/messages</code> (e.g. RedHat/Fedora)
or <code>/var/log/syslog</code> and <code>/var/log/user.log</code> (e.g. Debian).
<p></p>
<p></p>
</ul>
<h2><a name="Basic_Setup"></a> Basic Setup </h2>
<ul>
<p></p>
Before you can start using Motion you need to know some basics about your camera.
Either you have a camera connected directly to your computer. In this case it is a video4linux type of camera.
Or you connect to a network camera using a normal web URL.
<p></p>
For video4linux devices, the camera must be installed per the requirements of the camera. It is
out of the scope of this document to tell you how to do this and it depends on which type of camera. Once
the camera is installed it will have the device name(s) of /dev/video0, /dev/video1, /dev/video2...
<p></p>
FreeBSD has a different naming of devices. When you build Motion for FreeBSD the default device name is /dev/bktr0.
Under FreeBSD a TV card has a special device for controlling the tuner (e.g. /dev/tuner0). The option tunerdevice
is only valid when Motion is built and running under FreeBSD. For Linux do not include this option in the config
file (remove or comment out).
<p></p>
<strong>USB cameras</strong> take a lot of bandwidth. A USB camera connected to a USB 2 port or hub consumes virtually
all the bandwidth that the port can handle. Even with a small framesize and low framerate you should not expect to have
more than one camera per USB controller. If you need more than 1 USB camera it is possible to add extra USB PCI cards
to your computer. It is also possible that your computer has more than one controller for different USB slots. For
example, if the computer has six USB ports, the three on the left may be on controller A versus the three on the right
may be on controller B. In this situation, connecting two cameras to ports only on the left would not work due to
excessive bandwidth. However connecting one camera to port on the right and the other to the port on the left
may work since they are on different controllers.
Motion permits the use of video cards that have discreet input channels. Since USB cameras do not have input channels,
the option <code>input</code> must be set to the value -1 for USB cameras.
<p></p>
<strong>Network cameras</strong> are set up via the netcam_url parameter. The latest versions of Motion support
rtsp format which many cameras now stream. The URL connection string to enter is specific to the camera and is
usually provided by the manufacturer. The connection string is the same as what would be used by other
video playing software such as VLC. If the camera does not stream via RTSP and instead uses a MJPEG, then Motion
can also view that format. See the option <code>netcam_url</code> for additional options.
<p></p>
<strong>Composite video cards</strong> are normally made with a chip called BT878 (older cards have a BT848). They
all use the Linux driver called 'bttv'.
<p></p>
There are cards with more then one video input but still only one BT878 chip. They have a video multiplexer which
input is selected with the config option <code>input</code>. Input channel numbers start at 0
(which is why the value -1 and not 0 disables input selection). There are video capture cards available
with 4 or 8 inputs but only one chip. They present themselves as one single video device and
you select input using the 'input' option. If you define e.g. 4 thread config files with the
same videodevice name but different input numbers Motion automatically
goes into round robin mode.
<p></p>
Many TV tuner cards have the input channels: TV Tuner = 0, Standard composite video = 1, S-VHS = 3.
Others have TV=0, composite video 1= 1, composite video = 2, S-VHS = 3.