File: motion_guide.html

package info (click to toggle)
motion 3.2.9-7
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,912 kB
  • ctags: 1,533
  • sloc: ansic: 14,340; sh: 724; makefile: 216
file content (3542 lines) | stat: -rw-r--r-- 357,072 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
<h1><a name="Motion_Guide_One_Large_Document"></a><a name="_Motion_Guide_One_Large_Document"></a>  Motion Guide - One Large Document. </h1>
This version of the Guide is made for inclusion in the Motion download package for off line reading.
<p />
If you read this document from the distribution package of Motion or from some not up to date mirror you should know that the URL for the always up to date version is <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuide" target="_top">http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuide</a>. If you are already on the new TWiki based Motion site clicking the link just mentioned will lead you to the index page for the Motion Guide documents.
<hr />
This topic consists of the following subtopics:
<a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionOverview" class="twikiLink">MotionOverview</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/KnownProblems" class="twikiLink">KnownProblems</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/InstallOverview" class="twikiLink">InstallOverview</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/PrepareInstall" class="twikiLink">PrepareInstall</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigureScript" class="twikiLink">ConfigureScript</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MakeInstall" class="twikiLink">MakeInstall</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/UpgradingFromOlderVersion" class="twikiLink">UpgradingFromOlderVersion</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/RunningMotionConfigFiles" class="twikiLink">RunningMotionConfigFiles</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/CommandLineOptions" class="twikiLink">CommandLineOptions</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigFileOptions" class="twikiLink">ConfigFileOptions</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/SignalsKill" class="twikiLink">SignalsKill</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ErrorLogging" class="twikiLink">ErrorLogging</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/CaptureDeviceOptions" class="twikiLink">CaptureDeviceOptions</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionDetectionSettings" class="twikiLink">MotionDetectionSettings</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ImageFileOutput" class="twikiLink">ImageFileOutput</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/TuningMotion" class="twikiLink">TuningMotion</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MpegFilmsFFmpeg" class="twikiLink">MpegFilmsFFmpeg</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/SnapshotsWebCam" class="twikiLink">SnapshotsWebCam</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/TextFeatures" class="twikiLink">TextFeatures</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/AdvancedFilenames" class="twikiLink">AdvancedFilenames</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">ConversionSpecifiers</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/WebcamServer" class="twikiLink">WebcamServer</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/RemoteControlHttp" class="twikiLink">RemoteControlHttp</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ExternalCommands" class="twikiLink">ExternalCommands</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/TrackingControl" class="twikiLink">TrackingControl</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/UsingDatabases" class="twikiLink">UsingDatabases</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/LoopbackDevice" class="twikiLink">LoopbackDevice</a>.
<hr />
<p />
<div class="twikiToc"> <ul>
<li> <a href="#Motion_Guide_Installation"> Motion Guide - Installation</a> <ul>
<li> <a href="#Motion_Overview"> Motion Overview</a> <ul>
<li> <a href="#What_is_Motion"> What is Motion?</a>
</li> <li> <a href="#How_do_I_get_Motion_and_what_doe"> 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_us"> 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> <li> <a href="#Known_Problems"> Known Problems</a>
</li> <li> <a href="#How_do_I_install_Motion"> How do I install Motion?</a>
</li> <li> <a href="#Preparation_For_Install"> Preparation For Install</a>
</li> <li> <a href="#Configure_Script"> Configure Script</a>
</li> <li> <a href="#Make"> Make</a> <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> <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></ul> 
</li> <li> <a href="#Command_Line_Options"> Command Line Options</a>
</li> <li> <a href="#Config_File_Options"> Config File Options</a> <ul>
<li> <a href="#Options_in_Alphabetical_Order"> Options in Alphabetical Order.</a>
</li></ul> 
</li> <li> <a href="#Signals_sent_with_e_g_kill_comma"> Signals (sent with e.g. kill command)</a>
</li> <li> <a href="#Error_Logging"> Error Logging</a>
</li></ul> 
</li> <li> <a href="#Motion_Guide_Basic_Features"> Motion Guide - Basic Features</a> <ul>
<li> <a href="#Capture_Device_Options_The_Basic"> Capture Device Options - The Basic Setup</a>
</li> <li> <a href="#video4linux_V4L_devices"> video4linux (V4L) devices</a> <ul>
<li> <a href="#auto_brightness"> auto_brightness</a>
</li> <li> <a href="#brightness"> brightness</a>
</li> <li> <a href="#contrast"> contrast</a>
</li> <li> <a href="#framerate"> framerate</a>
</li> <li> <a href="#frequency"> frequency</a>
</li> <li> <a href="#height"> height </a>
</li> <li> <a href="#hue"> hue</a>
</li> <li> <a href="#input"> input </a>
</li> <li> <a href="#minimum_frame_time"> minimum_frame_time</a>
</li> <li> <a href="#norm"> norm</a>
</li> <li> <a href="#rotate"> rotate</a>
</li> <li> <a href="#saturation"> saturation</a>
</li> <li> <a href="#tunerdevice"> tunerdevice</a>
</li> <li> <a href="#videodevice"> videodevice</a>
</li> <li> <a href="#width"> width</a>
</li></ul> 
</li> <li> <a href="#Network_Cameras"> Network Cameras</a> <ul>
<li> <a href="#netcam_proxy"> netcam_proxy</a>
</li> <li> <a href="#netcam_url"> netcam_url</a>
</li> <li> <a href="#netcam_userpass"> netcam_userpass</a>
</li></ul> 
</li> <li> <a href="#Round_Robin_feature"> Round Robin feature</a> <ul>
<li> <a href="#roundrobin_frames"> roundrobin_frames</a>
</li> <li> <a href="#roundrobin_skip"> roundrobin_skip</a>
</li> <li> <a href="#switchfilter"> switchfilter</a>
</li></ul> 
</li> <li> <a href="#Motion_Detection_Settings"> Motion Detection Settings</a> <ul>
<li> <a href="#despeckle"> despeckle</a>
</li> <li> <a href="#gap"> gap</a>
</li> <li> <a href="#lightswitch"> lightswitch </a>
</li> <li> <a href="#low_cpu"> low_cpu</a>
</li> <li> <a href="#mask_file"> mask_file</a>
</li> <li> <a href="#max_mpeg_time"> max_mpeg_time</a>
</li> <li> <a href="#minimum_gap"> minimum_gap</a>
</li> <li> <a href="#minimum_motion_frames"> minimum_motion_frames</a>
</li> <li> <a href="#night_compensate"> night_compensate</a>
</li> <li> <a href="#noise_level"> noise_level</a>
</li> <li> <a href="#noise_tune"> noise_tune</a>
</li> <li> <a href="#output_all"> output_all</a>
</li> <li> <a href="#post_capture"> post_capture</a>
</li> <li> <a href="#pre_capture"> pre_capture</a>
</li> <li> <a href="#smart_mask_speed"> smart_mask_speed</a>
</li> <li> <a href="#threshold"> threshold</a>
</li> <li> <a href="#threshold_tune"> threshold_tune</a>
</li></ul> 
</li> <li> <a href="#Image_File_Output"> Image File Output</a> <ul>
<li> <a href="#output_motion"> output_motion</a>
</li> <li> <a href="#output_normal"> output_normal</a>
</li> <li> <a href="#ppm"> ppm</a>
</li> <li> <a href="#quality"> quality</a>
</li></ul> 
</li> <li> <a href="#Tuning_Motion"> Tuning Motion</a>
</li> <li> <a href="#Generating_MPEG_films_with_ffmpe"> Generating MPEG films with ffmpeg</a> <ul>
<li> <a href="#ffmpeg_bps"> ffmpeg_bps</a>
</li> <li> <a href="#ffmpeg_cap_motion"> ffmpeg_cap_motion</a>
</li> <li> <a href="#ffmpeg_cap_new"> ffmpeg_cap_new</a>
</li> <li> <a href="#ffmpeg_deinterlace"> ffmpeg_deinterlace</a>
</li> <li> <a href="#ffmpeg_timelapse"> ffmpeg_timelapse</a>
</li> <li> <a href="#ffmpeg_timelapse_mode"> ffmpeg_timelapse_mode</a>
</li> <li> <a href="#ffmpeg_variable_bitrate"> ffmpeg_variable_bitrate</a>
</li> <li> <a href="#ffmpeg_video_codec"> ffmpeg_video_codec</a>
</li></ul> 
</li> <li> <a href="#Snapshots_The_Traditional_Period"> Snapshots - The Traditional Periodic Web Camera</a> <ul>
<li> <a href="#snapshot_interval"> snapshot_interval</a>
</li></ul> 
</li> <li> <a href="#Text_Features"> Text Features</a> <ul>
<li> <a href="#locate"> locate</a>
</li> <li> <a href="#text_changes"> text_changes</a>
</li> <li> <a href="#text_double"> text_double</a>
</li> <li> <a href="#text_event"> text_event</a>
</li> <li> <a href="#text_left"> text_left</a>
</li> <li> <a href="#text_right"> text_right</a>
</li></ul> 
</li> <li> <a href="#Advanced_Filenames"> Advanced Filenames</a> <ul>
<li> <a href="#ffmpeg_filename_now_called_movie"> ffmpeg_filename (now called movie_filename)</a>
</li> <li> <a href="#jpeg_filename"> jpeg_filename</a>
</li> <li> <a href="#movie_filename"> movie_filename</a>
</li> <li> <a href="#snapshot_filename"> snapshot_filename</a>
</li> <li> <a href="#target_dir"> target_dir</a>
</li> <li> <a href="#timelapse_filename"> timelapse_filename</a>
</li></ul> 
</li> <li> <a href="#Conversion_Specifiers_for_Advanc"> Conversion Specifiers for Advanced Filename and Text Features</a>
</li> <li> <a href="#Webcam_Server"> Webcam Server</a> <ul>
<li> <a href="#webcam_limit"> webcam_limit</a>
</li> <li> <a href="#webcam_localhost"> webcam_localhost</a>
</li> <li> <a href="#webcam_maxrate"> webcam_maxrate</a>
</li> <li> <a href="#webcam_motion"> webcam_motion</a>
</li> <li> <a href="#webcam_port"> webcam_port</a>
</li> <li> <a href="#webcam_quality"> webcam_quality</a>
</li></ul> 
</li> <li> <a href="#Remote_Control_with_http"> Remote Control with http</a> <ul>
<li> <a href="#control_authentication"> control_authentication</a>
</li> <li> <a href="#control_html_output"> control_html_output</a>
</li> <li> <a href="#control_localhost"> control_localhost</a>
</li> <li> <a href="#control_port"> control_port</a>
</li></ul> 
</li> <li> <a href="#External_Commands"> External Commands</a> <ul>
<li> <a href="#on_event_end"> on_event_end</a>
</li> <li> <a href="#on_event_start"> on_event_start</a>
</li> <li> <a href="#on_motion_detected"> on_motion_detected</a>
</li> <li> <a href="#on_movie_end"> on_movie_end</a>
</li> <li> <a href="#on_movie_start"> on_movie_start</a>
</li> <li> <a href="#on_picture_save"> on_picture_save</a>
</li> <li> <a href="#quiet"> quiet</a>
</li> <li> <a href="#What_happened_to_mail_and_sms"> What happened to mail and sms?</a> <ul>
<li> <a href="#Sending_email_at_start_of_event"> Sending email at start of event</a>
</li> <li> <a href="#Sending_SMS_at_start_of_event"> Sending SMS at start of event</a>
</li></ul> 
</li></ul> 
</li></ul> 
</li> <li> <a href="#Motion_Guide_Special_Features"> Motion Guide - Special Features</a> <ul>
<li> <a href="#Tracking_Control"> Tracking Control</a> <ul>
<li> <a href="#Tracking_Feature_with_Logitech_Q"> Tracking Feature with Logitech Quickcam Sphere/Orbit</a>
</li> <li> <a href="#track_auto"> track_auto</a>
</li> <li> <a href="#track_iomojo_id"> track_iomojo_id</a>
</li> <li> <a href="#track_maxx"> track_maxx</a>
</li> <li> <a href="#track_maxy"> track_maxy</a>
</li> <li> <a href="#track_motorx"> track_motorx</a>
</li> <li> <a href="#track_motory"> track_motory</a>
</li> <li> <a href="#track_move_wait"> track_move_wait</a>
</li> <li> <a href="#track_port"> track_port</a>
</li> <li> <a href="#track_speed"> track_speed</a>
</li> <li> <a href="#track_step_angle_x"> track_step_angle_x</a>
</li> <li> <a href="#track_step_angle_y"> track_step_angle_y</a>
</li> <li> <a href="#track_stepsize"> track_stepsize</a>
</li> <li> <a href="#track_type"> track_type</a>
</li></ul> 
</li> <li> <a href="#Using_Databases"> Using Databases</a> <ul>
<li> <a href="#sql_log_image"> sql_log_image</a>
</li> <li> <a href="#sql_log_mpeg"> sql_log_mpeg</a>
</li> <li> <a href="#sql_log_snapshot"> sql_log_snapshot</a>
</li> <li> <a href="#sql_log_timelapse"> sql_log_timelapse</a>
</li> <li> <a href="#sql_query"> sql_query</a>
</li></ul> 
</li> <li> <a href="#MySQL"> MySQL</a> <ul>
<li> <a href="#mysql_db"> mysql_db</a>
</li> <li> <a href="#mysql_host"> mysql_host</a>
</li> <li> <a href="#mysql_password"> mysql_password</a>
</li> <li> <a href="#mysql_user"> mysql_user</a>
</li></ul> 
</li> <li> <a href="#PostgreSQL"> PostgreSQL</a> <ul>
<li> <a href="#pgsql_db"> pgsql_db</a>
</li> <li> <a href="#pgsql_host"> pgsql_host</a>
</li> <li> <a href="#pgsql_password"> pgsql_password</a>
</li> <li> <a href="#pgsql_port"> pgsql_port</a>
</li> <li> <a href="#pgsql_user"> pgsql_user</a>
</li></ul> 
</li> <li> <a href="#Video4Linux_Loopback_Device"> Video4Linux Loopback Device</a> <ul>
<li> <a href="#motion_video_pipe"> motion_video_pipe</a>
</li> <li> <a href="#video_pipe"> video_pipe</a>
</li></ul> 
</li></ul> 
</li></ul> 
</div>
<p />
<h1><a name="Motion_Guide_Installation"></a> Motion Guide - Installation </h1>
<p />
<h2><a name="Motion_Overview"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionOverview" class="twikiLink">Motion Overview</a> </h2>
<p />
<h3><a name="What_is_Motion"></a><a name="What_is_Motion_"></a> What is Motion? </h3>
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 />
The program is written in C and is made for the Linux operating system.
<p />
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).
<p />
The output from motion can be:
<p /> <ul>
<li> jpg files 
</li> <li> ppm format files 
</li> <li> mpeg video sequences
</li></ul> 
<p />
<h3><a name="How_do_I_get_Motion_and_what_doe"></a> How do I get Motion and what does it cost? </h3>
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 />
<h3><a name="Maintenance_and_Support"></a> Maintenance and Support </h3>
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" class="twikiLink">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 />
To get motion direct your browser to the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome" class="twikiCurrentWebHomeLink twikiLink">Motion Homepage</a>.
<p />
On the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/DownloadFiles" class="twikiLink">Download Files</a> page you will find a 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 very stable. Every day a <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionDailySourceSnap" class="twikiLink">Motion Daily Source Snap</a> is created from the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionSubversion" class="twikiLink">Motion Subversion</a> 
<p />
Motion was originally written by Jeroen Vreeken who still actively participates in the development of Motion and later Folkert van Heusden continued as a lead programmer with Kenneth Lavrsen responsible for Motion Guide, website and releases on Sourceforge.
<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 />
For support we encourage you to join the mailing list instead of writing to Jeroen, Folkert or Kenneth directly. We are all very active on the mailing list and by using the mailing list much more users will have benefit of the answers. Newbies and stupid questions are welcome on the list. Contributions in the form of patches are also very welcome on the mailing list.
<p />
<h3><a name="Which_version_to_download_and_us"></a> Which version to download and use? </h3>
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.
<p />
Since 3.1.13 quite many options have been renamed to make setting up Motion easier. From 3.1.17-18 some unfinished features have been removed. The Berkeley mpeg feature is now removed because the ffmpeg feature is now mature and much better working. At version 3.1.18 a new network camera feature was introduced replacing the old cURL based netcam code and introducing support of mjpeg streaming cameras. However this new code was quite difficult to get stable. During the development of 3.2.2 the network camera code was totally rewritten again learning from our experience and now finally it seems to be stable. 
<p />
Since 3.2.3 Debian users can find binary packages on the Motion Sourceforge file download page. You can find Debian versions of Motion in different Debian repositories but they are all out of date and hardly ever get updated.
<p />
<h3><a name="What_features_does_Motion_have"></a><a name="What_features_does_Motion_have_"></a> What features does Motion have? </h3>
See more description at the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome" class="twikiCurrentWebHomeLink twikiLink">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 (using multipart/x-mixed-replace) 
</li> <li> Real time creation of mpeg 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 detecting movement
</li> <li> Execute external program at the beginning of an event of several motion detections.
</li> <li> Execute external program at the end of an event of several motion detections. 
</li> <li> Execute external program when a picture is saved.
</li> <li> Execute external program when a movie mpeg is created (opened)
</li> <li> Execite external program when a movie mpeg ends (closed) 
</li> <li> Motion tracking 
</li> <li> Feed events to an MySQL or PostgreSQL database. 
</li> <li> Feed video back to a video4linux loopback for real time viewing 
</li> <li> Web interface using <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/RelatedProjects" class="twikiLink">Motion Related Projects</a> such as <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionCGI" class="twikiLink">motion.cgi</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/KennethsWebcamPackage" class="twikiLink">Kenneths Webcam Package</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/KevinsWebpage" class="twikiLink">Kevins Webpage</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/XMotionTool" class="twikiLink">X-Motion</a> and many more.
</li> <li> User configurable and user defined on screen display.
</li> <li> Control via simple web interface.
</li> <li> Automatic noise and threshold control
</li> <li> Ability to control the pan/tilt of a Logitech Sphere (or Orbit) camera
</li> <li> Highly configurable display of text on images.
</li> <li> High configurable definition of path and file names of the stored images and films.
</li></ul> 
<p />
You can find more information and links at the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome" target="_top">Motion Homepage</a>.
<p />
<h3><a name="FreeBSD"></a><a name="_FreeBSD"></a> FreeBSD </h3>
<p />
Motion is originally developed for Linux and it is still mainly developed and supported for this platform. From version 3.1.15 an experimental port has been made by Angel Carpintero. Not all features of Motion are supported at this time and it still needs a lot of test time on different hardware. Angel is very interested in feedback. Join the Motion Mailing List and give your feedback there. Patches for bugfixes and for enabling the missing features are very welcome. The rest of this guide is still mainly targeted for Linux users. Follow this topic to <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/FreeBSD" target="_top">Install FreeBSD</a>.
<p />
<h3><a name="MacOSX"></a><a name="_MacOSX"></a> MacOSX </h3>
<p />
From Motion version 3.2.4 it is now also possible to build and install Motion under <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MacOSX" class="twikiLink">MacOSX</a>. Feature set it the same as for FreeBSD. See the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MacOSX" class="twikiLink">MacOSX</a> topic for specific help how to install Motion and its dependencies on <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MacOSX" class="twikiLink">MacOSX</a>. Again this port has been contributed by Angel Carpintero.
<p />
<h3><a name="Documentation"></a> Documentation </h3>
You have the following sources of information:
<p /> <ul>
<li> This <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuide" class="twikiLink">Motion Guide</a>.
</li> <li> The <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/FrequentlyAskedQuestions" class="twikiLink">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" class="twikiLink">technology behind motion</a>.
</li> <li> The man page. After installation simply write man motion
</li> <li> The default motion.conf file (motion-dist.conf) that comes with the package.
</li></ul> 
<p />
<h3><a name="Supported_Hardware"></a> Supported Hardware </h3>
Input devices: Here we are thinking about the cameras.
<p />
Motion supports video input from two kinds of sources.
<p />
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. <ul>
<li> <a href="http://www.saillard.org/pwc/" rel="nofollow" target="_top">Driver for USB Philips cameras (and more)</a> This driver is a fork of the old pcw(x) driver which got kicked out of the kernel. (see: <a href="http://www.smcc.demon.nl/webcam/" rel="nofollow" target="_top">http://www.smcc.demon.nl/webcam/</a>). See also the new <a href="http://www.lavrsen.dk/twiki/bin/view/PWC/WebHome" class="twikiLink">PWC Documentation Site</a> which is hosted in this wiki.
</li> <li> <a href="http://bytesex.org/bttv/index.html" rel="nofollow" target="_top">BTTV Driver</a> (capture cards). Part of many distributions now.
</li> <li> <a href="http://alpha.dyndns.org/ov511/" rel="nofollow" target="_top">OV511</a> based USB cameras are supported as standard by newer Kernels.
</li> <li> <a href="http://spca50x.sourceforge.net/spca50x.php" rel="nofollow" target="_top">kernel driver for USB cameras based on Sunplus spca50</a>
</li> <li> <a href="http://rivatv.sourceforge.net/" rel="nofollow" target="_top">rivatv.sourceforge.net</a> Driver for tv/composite/svideo input with most Nvidia based video cards.
</li></ul> 
Network cameras (which are actually cameras with a built in web server that can be connected directory to your network). <ul>
<li> <a href="http://www.axis.com/" rel="nofollow" target="_top">Axis Communications</a>
</li></ul> 
<p />
<p />
<h2><a name="Known_Problems"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/KnownProblems" class="twikiLink">Known Problems</a> </h2>
See also the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/FrequentlyAskedQuestions" class="twikiLink">Frequently Asked Questions</a> and <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/BugReports" class="twikiLink">Bug Reports</a> for known open bugs.
<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 cripled 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/view/PWC/InstallationOfPWC" class="twikiLink">Installation of PWC</a> page which is also hosted in this wiki.
<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 />
<strong>Camera picture dimensions must be multiple of 16</strong>
Dimentions of camera image must have both height and width that are a multiple of 16. Ths 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.
<p />
<strong>ffmpeg_filename has changed name to movie_filename</strong>
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.
<p />
<strong>error: `time_current_frame' undeclared (first use in this function)</strong>
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.
<p />
<p />
<h2><a name="How_do_I_install_Motion"></a><a name="How_do_I_install_Motion_"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/InstallOverview" class="twikiLink">How do I install Motion</a>? </h2>
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.
<p />
The short overview of the steps to install Motion from sources. <ul>
<li> <strong>Preparation</strong>: 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.
</li></ul> 
<p /> <ul>
<li> <strong>Download</strong> the motion source files (distributed as tar'ed and compressed files). Place the file in a place of your own choice.
</li></ul> 
<p /> <ul>
<li> <strong>Untar and uncompress</strong> 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).
</li></ul> 
<UL>
<pre>
cd /usr/local
tar -xvzf /path/to/motion-3.2.X.tar.gz
</pre>
</UL> <ul>
<li> 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.
</li></ul> 
<UL>
<pre>
ln -s motion-3.2.X motion
</pre>
</UL> <ul>
<li> Now change to the new directory
</li></ul> 
<UL>
<pre>
cd motion
</pre>
</UL> <ul>
<li> Run configure. You can start with the defaults. If you need to modify the installation parameters you can read the next section.
</li></ul> 
<UL>
<pre>
./configure
</pre>
</UL> <ul>
<li> Build the code
</li></ul> 
<UL>
<pre>
make
</pre>
</UL> <ul>
<li> Install the code, manual page, etc
</li></ul> 
<UL>
<pre>
make install
</pre>
</UL> <ul>
<li> 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 <strong>motion.conf</strong> and edit as a minimum the settings: <strong>videodevice</strong>, <strong>input</strong>, <strong>norm</strong>, <strong>frequency</strong>, <strong>width</strong>, <strong>height</strong> and <strong>target_dir</strong>. That should get you going.
</li></ul> 
<p /> <ul>
<li> Run the program. To enable more features you must modify the config file.
</li></ul> 
<UL>
<pre>
motion
</pre>
</UL>
<p />
<p />
<h2><a name="Preparation_For_Install"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/PrepareInstall" class="twikiLink">Preparation For Install</a> </h2>
<p />
Note: If you're using SuSE 9.2, you might want to <strong>ADDITIONALLY</strong> have a look at <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/SuSE92Prep" class="twikiLink">Compiling on SuSE 9.2</a>. As mentioned on that page as well, <em>you will still need to read the instructions here as well</em>.
<p />
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.
<p />
This is a list of shared libraries used by Motion and the RPM packages that provides them.
<p />
Motion will always need these libraries to be built and work 
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=0;table=1;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Library</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=1;table=1;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">RPM Packages</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=2;table=1;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Debian Packages</a> </th></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> libm, libresolv, libdl, libpthread, libc, ld-linux, libcrypt, and libnsl </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> glibc and glibc-devel </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> libc6 , libc6-dev ,libglib1.2 </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> libjpeg </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> libjpeg and libjpeg-devel </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> libjpeg62 and libjpeg62-dev ( optional libjpeg-mmx-dev ) </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol twikiLast"> libz </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> zlib and zlib-devel </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> zlib1g and zlib1g-dev </td></tr>
</table>
<p />
For generating mpeg films with <strong>ffmpeg</strong> you need this library:<br>
(See also the section <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MpegFilmsFFmpeg" class="twikiLink">Generating MPEG films with ffmpeg</a> for how to install ffmpeg and libavformat/libavcodec)<br>
<em>Motion must be installed with revision 0.4.8 or 0.4.9pre1 of ffmpeg. Motion will also work with later CVS snapshots of ffmpeg but the API of the ffmpeg libraries changes all the time and without warning. If you have problems compiling Motion or with running an RPM of Motion you may try with an older CVS snapshot of ffmpeg. The Motion developers will like to know when ffmpeg changes and breaks Motion so we can fix it. Please file a bug report then with the exact date of the ffmpeg CVS version you have trouble with.</em>
<p />
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=0;table=2;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Library</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=1;table=2;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">RPM Packages</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=2;table=2;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Debian Packages</a> </th></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol twikiLast"> libavcodec, libavformat </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> ffmpeg and ffmpeg-devel or install from source </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> libavcodec-dev  libavcodec0d libavformat-dev libavformat0d (*) </td></tr>
</table>
<p />
<strong>Debian</strong> has not provided deb packages for ffmpeg due patent issues. However this is about to change so checkout for availability of newer versions of debian ffmpeg debs. You can build yourself from source or from <a href="http://debian-multimedia.org/" rel="nofollow" target="_top">Christian Marillat website</a> or apt repository. 
<pre>
deb http://www.debian-multimedia.org stable main # ( etch )
deb http://www.debian-multimedia.org testing main # ( lenny )
deb http://www.debian-multimedia.org unstable main # ( sid )

</pre>
Add the suitable line to your /etc/apt/sources.list and run this: 
<pre>
apt-get update ; apt-get -y install libavcodec-dev libavcodec0d libavformat-dev libavformat0d
</pre>
<p />
For logging in <strong>MySQL</strong> you need this library:
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=0;table=3;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Library</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=1;table=3;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">RPM Packages</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=2;table=3;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Debian Packages</a> </th></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol twikiLast"> libmysqlclient </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> mysql and mysql-devel </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> libmysqlclient15-off and libmysqlclient15-dev </td></tr>
</table>
<p />
For logging in <strong>PostgreSQL</strong> you need this library:
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=0;table=4;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Library</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=1;table=4;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">RPM Packages</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=2;table=4;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Debian Packages</a> </th></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol twikiLast"> libpq </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> postgresql-libs and postgresql-devel </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> libpq-dev and libpq4 </td></tr>
</table>
<p />
<p />
<h2><a name="Configure_Script"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigureScript" class="twikiLink">Configure Script</a> </h2>
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.
<p />
To run configure your current directory must be the motion directory. You type
<p />
<code>./configure</code>
<p />
You can add the parameter <code>./configure --help</code> to get help on the different switches.
<p />
This is walk through of the options.
<p />
 
<a name="edittable1"></a>
<div class="editTable"><form name="edittable1" action="http://www.lavrsen.dk/twiki/bin/viewauth/Motion/ConfigureScript#edittable1" method="post">
<input type="hidden" name="ettablenr" value="1" />
<input type="hidden" name="etedit" value="on" />
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><th width="160" bgcolor="#6b7f93" align="left" valign="top" style="width:160;text-align:left;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <span style="color:#ffffff"> <strong> Option </strong> </span> </th><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" maxcols="0"> <span style="color:#ffffff"> <strong> Description<br />Defaults for the options<br /> are specified in brackets [ ] </strong> </span> </th><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" maxcols="0"> <span style="color:#ffffff"> <strong> Editors comment </strong> </span> </th></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> -h, --help </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> display this help and exit </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --help=short </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> display options specific to this package </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> This command shows the options special to motion. Recommended </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --help=recursive </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> display the short help of all the included packages </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> -V, --version </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> display version information and exit </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Gives no useful information </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> -q, --quiet, --silent </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> do not print `checking...' messages </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Not very useful. Output to screen is only a few lines anyway. </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --cache-file=FILE </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> cache test results in FILE. [disabled] </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> No function </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> -C, --config-cach </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> alias for `--cache-file=config.cache' </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> No function </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> -n, --no-create </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> do not create output files </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Used for testing if other switches produce error - without writing anything to the disk </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --srcdir=DIR </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> find the sources in DIR. [configure dir or `..'] </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> 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 class="twikiTableEven"><th width="160" bgcolor="#6b7f93" align="left" valign="top" style="width:160;text-align:left;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <span style="color:#ffffff"> <strong> Installation directories: </strong> </span> </th><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" maxcols="0"> <span style="color:#ffffff"> <strong> &nbsp; </strong> </span> </th><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" maxcols="0"> <span style="color:#ffffff"> <strong> &nbsp; </strong> </span> </th></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --prefix=PREFIX </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> install architecture-independent files in PREFIX<br />[/usr/local] </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> The default /usr/local means that the executable binary "motion" is installed in /usr/local/bin, the manual page in /usr/local/man/man1, the document files in /usr/local/docs/motion-version, configuration file in /usr/local/etc, and some examples config files in /usr/local/examples/motion-versionEditor 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 class="twikiTableEven"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --exec-prefix=EPREFIX </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> install architecture-dependent files in EPREFIX<br />[PREFIX] </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> 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 class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --bindir=DIR </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> user executables [EPREFIX/bin] </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> 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 class="twikiTableEven"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --sbindir=DIR </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> System admin executables [EPREFIX/sbin] </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Not used by motion. Ignore it. </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --libexecdir=DIR </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> program executables [EPREFIX/libexec] </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Not used by motion. Ignore it. </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --datadir=DIR </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> read-only architecture-independent data [PREFIX/share] </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Not used by motion. Ignore it. </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --sysconfdir=DIR </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> read-only single-machine data [PREFIX/etc] </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> 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.conf file that you have edited and experimented with for hours. Make sure to keep a copy in a safe place. Alternatively, copy the working file to the motion base install directory. Then make install will simply copy the same file back again. </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --sharedstatedir=DIR </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> modifiable architecture-independent data [PREFIX/com] </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Not used by motion. Ignore it. </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --localstatedir=DIR </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> modifiable single-machine data [PREFIX/var] </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Not used by motion. Ignore it. </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --libdir=DIR </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> object code libraries [EPREFIX/lib] </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Not used by motion. Ignore it. </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --includedir=DIR </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> C header files [PREFIX/include] </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Not used by motion. Ignore it. </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --oldincludedir=DIR </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> C header files for non-gcc [/usr/include] </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Not used by motion. Ignore it. </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --infodir=DIR </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> info documentation [PREFIX/info] </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Not used by motion. Ignore it. </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --mandir=DIR </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> man documentation [PREFIX/man] </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Editor recommends the default. </td></tr>
<tr class="twikiTableOdd"><th width="160" bgcolor="#6b7f93" align="left" valign="top" style="width:160;text-align:left;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <span style="color:#ffffff"> <strong> Optional Packages: </strong> </span> </th><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" maxcols="0"> <span style="color:#ffffff"> <strong> &nbsp; </strong> </span> </th><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" maxcols="0"> <span style="color:#ffffff"> <strong> &nbsp; </strong> </span> </th></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --with-ffmpeg=DIR </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> 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="#ffffff" valign="top" style="vertical-align:top;"> 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 do not need to specify the directory prefix. Configure will 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).<br />For more information on FFmpeg see the <a href="http://ffmpeg.sourceforge.net/" rel="nofollow" target="_top">FFmpeg project home page</a>.<br />FFmpeg is a package that enables streamed video mpeg signal from your web camera to a browser.<br />Editor recommends installing ffmpeg from source and in the directory /usr/local/ffmpeg and build ffmpeg with ./configure --enable-shared.<br />This places libraries in /usr/local/lib and headers in /usr/local/include. </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --without-ffmpeg </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Do not compile with ffmpeg </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Use this if you do not want to compile with ffmpeg. If ffmpeg is not installed you do not need to specify that Motion must build without ffmpeg. </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --with-mysql-lib=DIR </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Lib directory of MySQL </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> 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 class="twikiTableOdd"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --with-mysql-include=DIR </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Include directory with headers for MySQL </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> 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 class="twikiTableEven"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --without-mysql </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Do not compile with MySQL support </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> 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 class="twikiTableOdd"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --with-pgsql=DIR </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Include PostgreSQL support.  DIR is the PostgreSQL base install directory, defaults to /usr/local/pgsql.<br />Set DIR to "shared" to build as a dynamic library, or "shared,DIR"  to build as a dynamic library and still specify DIR. </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Default is that make searches in the normal installation directories of most distributions.<br />See section later about PostgreSQL about potential problem during compilation. There is an easy workaround for it. </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --without-pgsql </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Do not compile with PostgreSQL support </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> 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 class="twikiTableOdd"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --without-v4l </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Exclude using v4l (video4linux) subsystem. Makes Motion so it only supports network cameras. </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Can be used if you do not need <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/V4L" class="twikiLink">V4L</a> support and maybe lack some of the libraries for it. </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --with-linuxthreads </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Use linuxthreads in BSD instead of native phtreads </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Only relevant for BSD. In Linux we always use this per default. </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --without-bktr </td><td bgcolor="#edf4f9" align="right" valign="top" style="vertical-align:top;"> Exclude to use bktr subsystem , that usually useful for devices as network cameras </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> ONLY used in *BSD </td></tr>
<tr class="twikiTableEven"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --with-jpeg-mmx=DIR </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> 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="#ffffff" valign="top" style="vertical-align:top;"> Considered experimental </td></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#edf4f9" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol"> --without-optimizecpu </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Exclude autodetecting platform and cpu type. This will disable the compilation of gcc optimizing code by platform and cpu. </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Use this if the optimization causes problems. Typically if you build on some non X386 compatible CPU. </td></tr>
<tr class="twikiTableEven"><th width="160" bgcolor="#6b7f93" align="left" valign="top" style="width:160;text-align:left;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <span style="color:#ffffff"> <strong> Developers options </strong> </span> </th><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" maxcols="0"> <span style="color:#ffffff"> <strong> &nbsp; </strong> </span> </th><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" maxcols="0"> <span style="color:#ffffff"> <strong> &nbsp; </strong> </span> </th></tr>
<tr class="twikiTableOdd"><td width="160" bgcolor="#ffffff" valign="top" style="width:160;vertical-align:top;" class="twikiFirstCol twikiLast"> --with-developer-flags </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> Add additional warning flags for the compiler. </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> 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.<br />For more information about these flags, see <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/CompileWithDeveloperFlags" class="twikiLink">CompileWithDeveloperFlags</a> </td></tr>
</table>
<input type="hidden" name="etrows"   value="40" />
<input class="editTableEditImageButton" type="image" src="http://www.lavrsen.dk/twiki/pub/TWiki/EditTablePlugin/edittable.gif" alt="Edit this table" /></form>
</div><!-- /editTable -->
<p />
<h2><a name="Make"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MakeInstall" class="twikiLink">Make</a> </h2>
When you run make, all the C-source files are automatically compiled and linked. Just look out for error messages.
<p />
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.
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> Attention!
<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 />
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 />
<h3><a name="Make_Install"></a> Make Install </h3>
<code>make install</code> simply copies all the nice files that were generated during the compilation/linking that make did.
<p />
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.
<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-3.2.X
</li> <li> Example configuration files "*.conf" to /usr/local/share/doc/examples/motion-3.2.X
</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 />
<h3><a name="Un_install"></a> Un-install </h3>
From the motion base installation directory you simply run <code>make uninstall</code>
<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 />
<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 /> <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 /> <dl>
<dt> <strong>make distclean</strong> </dt><dd> deletes the files: config.status, config.log, config.cache, Makefile, and motion.spec.
</dd></dl> 
<p /> <dl>
<dt> <strong>make updateguide</strong> </dt><dd> fetches a fresh new copy of this guide and place it in your motion source directory. Note that the pictures are not downloaded.
</dd></dl> 
<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 />
<h2><a name="Upgrading_From_Older_Version"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/UpgradingFromOlderVersion" class="twikiLink">Upgrading From Older Version</a> </h2>
If you are upgrading from motion 3.0.X or from an older version of 3.1.X you should note that many options have been removed from version 3.1.13 and forward and many new have arrived. You still have most of the old features. The options have been changed for two reasons. New more flexible features and to simplify getting started with Motion. With 3.2.1 the changes are significant.
You should also note these major differences. <ul>
<li> The use of thread files has completely changed. Read the section "The Config Files" carefully.
</li> <li> The mask file format has changed. Read the section about "Mask File"
</li> <li> Pre_capture feature introduced in 3.1.12
</li> <li> Advanced filename feature enables very flexible filename definitions (3.1.13)
</li> <li> onffmpegclose options enables running external scripts when mpeg file is closed (3.1.13)
</li> <li> despeckle feature improves motion detection and noise immunity (3.1.13)
</li> <li> Minimum_motion_frames feature prevents short noise events from being saved (3.1.14)
</li> <li> If you use the database features you need to note that from version 3.1.15 and forward the fields have been redefined. Removed are second, minute, hour, day, month and year. Instead these six have been replaced by a real timestamp field called time_stamp. The relatively new field 'type' has been renamed to 'file_type' to avoid reserved SQL words. A new field 'text_left' has been added which stores the text given by the config option text_left. And last a field called 'camera' has been added which stores the thread number.
</li> <li> From 3.1.15 the ffmpeg feature now also supports mpeg4 and msmpeg4. The build process of Motion now use ffmpeg libraries as shared libraries. The --with-libavcodec has been replaced by a --with-ffmpeg which only needed to specify if you are installing ffmpeg from sources in a non-standard location. If you have installed ffmpeg from sources already you will need to rebuild by running (from within the ffmpeg source file root) ./configure --enable-shared followed by make and make install. If you had installed ffmpeg from a binary RPM or deb you probably don't have to do anything.
</li> <li> Rotate feature was introduced in 3.1.15
</li> <li> Berkeley mpeg feature has been removed in 3.1.18 (use ffmpeg - it is much better)
</li> <li> Incomplete prediction feature was removed in 3.1.18. (lack of interest in finishing it)
</li> <li> Smart Mask feature introduced in 3.1.18
</li> <li> output_normal can now also have the value "first" which means only save first jpg from each event (3.1.18)
</li> <li> ffmpeg-0.4.9 is now supported. Motion detection mpegs can no longer be saved as mpeg1 (ffmpeg does not support non-standard framerates in 0.4.9) (3.1.18)
</li> <li> Motion now supports most (not all) mjpeg streaming cameras (3.1.18).
</li> <li> output_normal can now have values "first" or "best". It is used when you need to present a link to an mpeg movie shown as a single jpeg image. "First" saves the first picture frame in the new event. "Best" saves the picture frame with most motion content (most changed pixels) when the event is over. "on" still saves all motion detection picture frames plus pre and post captured images. With "best" you can set jpeg_filename = "preview" and it gets the same filename as the mpeg file but with extension .jpg. Option "locate" can also take the value "preview" which makes it only draw a rectangel on the jpeg but not on the mpeg movie. (3.2.1)
</li> <li> The xmlrpc remote control interface is replaced by a much nicer http remote control interface. (3.2.1)
</li> <li> All the options that calls external programs have been made much more generic. New onxxxx options have been added. Execute, sms and mail have been replaced by the generic on_event_start. (3.2.1)
</li> <li> New setup mode makes setting all the detection options much easier.
</li> <li> netcam now also supports proxies (3.2.2) and ftp (3.2.4)
</li> <li> text on the pictures can be set to double size (3.2.2)
</li> <li> Tracking with Logitech Sphere/Orbit improved (3.2.4)
</li> <li> SQL database feature is now fully configurable so you can control which fields you have in the database.
</li> <li> Many new conversion specifiers have been added which can be used both in filenames, commands, text, and SQL database features (3.2.2-3.2.4)
</li> <li> Stepper motor tracking feature extended to also include a Y axis (3.2.5)
</li> <li> ffmpeg_filename has been renamed to movie_filename to prepare for alternative implementation to mpeg files made with ffmpeg (3.2.5)
</li> <li> New feature: ffmpeg_deinterlace which can de-interlace using the ffmpeg libs (3.2.5)
</li> <li> New feature: minimum_frame_time which enables Motion to run at frame rates below 2. minimum_gap feature was removed since this was useless and the new minimum_frame_time feature replaces it with much better function. (3.2.7)
</li> <li> New feature: process_id_file which writes a PID file when started and removes it when stopped (3.2.7)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/V4L2" class="twikiLink">V4L2</a> support with many new supported palettes : <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/V4L2" class="twikiLink">V4L2</a>_PIX_FMT_SBGGR8, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/V4L2" class="twikiLink">V4L2</a>_PIX_FMT_SN9C10X, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/V4L2" class="twikiLink">V4L2</a>_PIX_FMT_JPEG, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/V4L2" class="twikiLink">V4L2</a>_PIX_FMT_UYVY (3.2.8)
</li> <li> ffmpeg_video_codec allow swf (3.2.8)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/V4L2" class="twikiLink">V4L2</a> fix support for :  <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/V4L2" class="twikiLink">V4L2</a>_PIX_FMT_MJPEG (3.2.9)
</li> <li> ffmpeg_video_codec allow flv and ffv1(3.2.9)
</li></ul> 
<p />
<p />
The table below shows the new options in the left column, and obsolete options in the right column. If the there are options on both sides in a row it means that the options in the left column replaced the options in the right column.
<p />
<a name="edittable1"></a>
<div class="editTable"><form name="edittable1" action="http://www.lavrsen.dk/twiki/bin/viewauth/Motion/UpgradingFromOlderVersion#edittable1" method="post">
<input type="hidden" name="ettablenr" value="1" />
<input type="hidden" name="etedit" value="on" />
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><th width="50%" bgcolor="#6b7f93" align="center" valign="top" style="width:50%;text-align:center;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=0;table=6;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">New Options</a> </th><th width="50%" bgcolor="#6b7f93" align="center" valign="top" style="width:50%;text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=1;table=6;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Obsolete Options</a> </th></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> text_left (3.1.13)<br />text_right (3.1.13)<br />text_changes (3.1.13) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> drawtext_user (3.1.13)<br />drawtext_shots (3.1.13)<br />drawtext_changes (3.1.13) </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> jpeg_filename (3.1.13)<br />ffmpeg_filename (3.1.13)<br />snapshot_filename (3.1.13)<br />timelapse_filename (3.1.13)<br />predict_filename (3.1.13)<br />(predict_filename removed in 3.1.18)<br /> </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> oldlayout (3.1.13)<br />snapshots_overwrite (3.1.13) </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> snapshot_interval (3.1.13) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> snapshots (3.1.13) </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> &nbsp; </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> realmotion (3.1.13) </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> despeckle (3.1.13) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> pre_capture (3.1.12) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> ffmpeg_timelapse (v. 3.1.14) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> ffmpeg_timelaps (renamed v 3.1.14) </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> ffmpeg_timelapse_mode (3.1.14) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> sql_log_image (3.1.14)<br />sql_log_snapshot (3.1.14)<br />sql_log_mpeg (3.1.14)<br />sql_log_timelapse (3.1.14)<br />sql_log_prediction (3.1.14) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> minimum_motion_frames (3.1.14) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> rotate (3.1.15) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> ffmpeg_variable_bitrate (3.1.15)<br />ffmpeg_video_codec (3.1.15) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> &nbsp; </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> berkeley_single_directory (3.1.18)<br />mpeg_encode (3.1.18)<br />mpeg_encode_bin (3.1.18)<br />adjust_rate off (3.1.18)<br />jpg_cleanup (3.1.18) </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> &nbsp; </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> predict_filename (3.1.18)<br />predict_enable (3.1.18)<br />predict_threshold (3.1.18)<br />predict_description (3.1.18)<br />sql_log_prediction (3.1.18) </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> brightness (3.1.18)<br />contrast (3.1.18)<br />saturation (3.1.18)<br />hue (3.1.18) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> smart_mask_speed (3.1.18) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> output_normal<br />valid values are now "on", "off", "first" (3.1.18) and "best" (3.2.1)<br /> </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> setup_mode (3.2.1) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> always_changes (3.2.1) </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> locate<br />valid values are now "on", "off", "preview" (3.2.1) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> jpeg_filename<br />Besides normal path names the value "preview" has speciel meaning together with output_normal = "best" (3.2.1) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> control_html_output (3.2.1) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> on_event_start (3.2.1)<br /> </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> execute (3.2.1)<br />sms (3.2.1)<br />mail (3.2.1) </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> on_event_end (3.2.1)<br /> </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> on_motion_detected (3.2.1)<br /> </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> on_picture_save (3.2.1)<br /> </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> onsave (3.2.1) </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> on_movie_start (3.2.1)<br />on_movie_end (3.2.1)<br /> </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> onmpeg (3.2.1)<br />onffmpegclose (introduced 3.1.13)(renamed to on_movie_end 3.2.1)<br /> </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> netcam_proxy (3.2.2) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> text_double (3.2.2) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> webcam_motion<br />Feature has been heavily improved so it is actually usefull now (3.2.2). </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> netcam_url<br />Now also supports fetching single frame jpeg pictures via ftp using ftp:// syntax (3.2.4) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> track_step_angle_x (3.2.4)<br />track_step_angle_y (3.2.4)<br />Add better configuration of auto tracking with a Logitech Sphere/Orbit camera.<br /> </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> track_move_wait (3.2.4)<br />track_auto (3.2.4)<br />Adds better configuration of auto tracking feature </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> sql_query (3.2.4)<br />Adds full flexibility of defining fields when using the SQL database features. </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> track_maxy (3.2.5)<br />track_motory (3.2.5) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> movie_filename (3.2.5) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> ffmpeg_filename (3.2.5) </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> ffmpeg_deinterlace (3.2.5) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> minimum_frame_time (3.2.7) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> minimum_gap (3.2.7) </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> process_id_file (3.2.7) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> ffmpeg_video_codec allow swf (3.2.8) </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableEven"><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol"> ffmpeg_video_codec allow flv and ffv1 (3.2.9) </td><td width="50%" bgcolor="#edf4f9" valign="top" style="width:50%;vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiFirstCol twikiLast"> &nbsp; </td><td width="50%" bgcolor="#ffffff" valign="top" style="width:50%;vertical-align:top;" class="twikiLast"> night_compensate (3.2.10)<br />low_cpu (3.2.10) </td></tr>
</table>
<input type="hidden" name="etrows"   value="42" />
<input class="editTableEditImageButton" type="image" src="http://www.lavrsen.dk/twiki/pub/TWiki/EditTablePlugin/edittable.gif" alt="Edit this table" /></form>
</div><!-- /editTable -->
<p />
<h2><a name="Running_Motion"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/RunningMotionConfigFiles" class="twikiLink">Running Motion</a> </h2>
<p />
<h3><a name="Important_Definitions"></a> Important Definitions </h3>
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 runtime modes (setup and non-daemon).
<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 read.
</li> <li> A "normal" image is the real image taken by the camera with text overlayed.
</li></ul> 
<p />
<a name="ConfigFiles"></a>
<h3><a name="The_Config_Files"></a> The Config Files </h3>
<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 />
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 /> <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/)
</li></ol> 
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.
<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 directory.
<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 />
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 tread 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 />
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 />
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 />
An option that is unique to a camera must be defined in each thread file.
<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 />
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 />
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 />
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 />
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: <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlAuthentication" class="twikiLink">control_authentication</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlHtmlOutput" class="twikiLink">control_html_output</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlLocalhost" class="twikiLink">control_localhost</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlPort" class="twikiLink">control_port</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionDaemon" class="twikiLink">daemon</a>, and <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionThread" class="twikiLink">thread</a>.
<p />
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.
<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 />
<h2><a name="Command_Line_Options"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/CommandLineOptions" class="twikiLink">Command Line Options</a> </h2>
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> 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.
<p />
SYNOPSIS
<pre>
motion &#91; -hns ] &#91; -c config file path ] &#91; -d level ]  &#91; -p process&#95;id&#95;file ]
</pre>
<p />
<a name="edittable1"></a>
<div class="editTable"><form name="edittable1" action="http://www.lavrsen.dk/twiki/bin/viewauth/Motion/CommandLineOptions#edittable1" method="post">
<input type="hidden" name="ettablenr" value="1" />
<input type="hidden" name="etedit" value="on" />
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><th width="150" bgcolor="#6b7f93" align="left" valign="top" style="width:150;text-align:left;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=0;table=7;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Option</a> </th><th width="250" bgcolor="#6b7f93" align="left" valign="top" style="width:250;text-align:left;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=1;table=7;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Description</a> </th><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=2;table=7;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Editors comment</a> </th></tr>
<tr class="twikiTableOdd"><td width="150" bgcolor="#ffffff" valign="top" style="width:150;vertical-align:top;" class="twikiFirstCol"> -n </td><td width="250" bgcolor="#ffffff" valign="top" style="width:250;vertical-align:top;"> Run in non-daemon mode. </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Instead of running Motion in the background Motion runs in the terminal window writing messages when things happen. If you have problems getting Motion to start or work, run Motion in this mode to get more messages that can help you solve the problem. </td></tr>
<tr class="twikiTableEven"><td width="150" bgcolor="#edf4f9" valign="top" style="width:150;vertical-align:top;" class="twikiFirstCol"> -s </td><td width="250" bgcolor="#edf4f9" valign="top" style="width:250;vertical-align:top;"> Run in setup mode. </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Also forces non-daemon mode </td></tr>
<tr class="twikiTableOdd"><td width="150" bgcolor="#ffffff" valign="top" style="width:150;vertical-align:top;" class="twikiFirstCol"> -c config file path </td><td width="250" bgcolor="#ffffff" valign="top" style="width:250;vertical-align:top;"> Full path and filename of config file. </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> E.g. /home/kurt/motion.conf. Default is /usr/local/etc unless specified differently when building Motion. Many RPMs and debian packages will most likely use /etc or /etc/motion as default </td></tr>
<tr class="twikiTableEven"><td width="150" bgcolor="#edf4f9" valign="top" style="width:150;vertical-align:top;" class="twikiFirstCol"> -h </td><td width="250" bgcolor="#edf4f9" valign="top" style="width:250;vertical-align:top;"> Show help screen. </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td width="150" bgcolor="#ffffff" valign="top" style="width:150;vertical-align:top;" class="twikiFirstCol"> -d level </td><td width="250" bgcolor="#ffffff" valign="top" style="width:250;vertical-align:top;"> Debugging mode </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> This mode is used for developers to enable debug messages. Normal users will not need to use this mode unless a developer request to get additional information in the attempt to resolve a bug. Mainly the netcam code has debugging features. The level defines how much debugging info you get. A high number displays all debugging. </td></tr>
<tr class="twikiTableEven"><td width="150" bgcolor="#edf4f9" valign="top" style="width:150;vertical-align:top;" class="twikiFirstCol twikiLast"> -p process_id_file </td><td width="250" bgcolor="#edf4f9" valign="top" style="width:250;vertical-align:top;" class="twikiLast"> Full path of process ID file </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiLast"> Full path and filename of process id file (PID file). This is optional. If none is given as command line option or in motion.conf (process_id_file) Motion will not create a PID file. </td></tr>
</table>
<input type="hidden" name="etrows"   value="7" />
<input class="editTableEditImageButton" type="image" src="http://www.lavrsen.dk/twiki/pub/TWiki/EditTablePlugin/edittable.gif" alt="Edit this table" /></form>
</div><!-- /editTable -->
<p />
<p />
<h2><a name="Config_File_Options"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigFileOptions" class="twikiLink">Config File Options</a> </h2>
These are the options that can be used in the config file.
<p />
All number values are integer numbers (no decimals allowed). Boolean options can be on or off.
<p />
Some configuration options are only used if Motion is built on a system that has the matching software libraries installed (MySQL, PostgreSQL and FFMPEG).
<p />
MySQL <ul>
<li> mysql_db, mysql_host, mysql_user, mysql_password
</li></ul> 
<p />
PostgreSQL <ul>
<li> pgsql_db, pgsql_host, pgsql_user, pgsql_password, pgsql_port
</li></ul> 
<p />
FFMPEG (libavcodec) <ul>
<li> ffmpeg_cap_new, ffmpeg_cap_motion, ffmpeg_filename, ffmpeg_timelapse, ffmpeg_timelapse_mode, ffmpeg_bps, ffmpeg_variable_bitrate, ffmpeg_video_codec
</li></ul> 
<p />
<h3><a name="Options_in_Alphabetical_Order"></a><a name="Options_in_Alphabetical_Order_"></a> Options in Alphabetical Order. </h3>
<p />
The table below lists all the Motion options in alphabetical order. Click on the option name to see a longer description of each.
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=0;table=8;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Option</a> </th><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=1;table=8;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Range/Values<br />Default</a> </th><th bgcolor="#6b7f93" align="left" valign="top" style="text-align:left;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=2;table=8;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Description</a> </th></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionAutoBrightness" class="twikiLink">auto_brightness</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Let motion regulate the brightness of a video device. Only recommended for cameras without auto brightness </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionBrightness" class="twikiLink">brightness</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 255<br />Default: 0 (disabled) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The brightness level for the video device. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionContrast" class="twikiLink">contrast</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 255<br />Default: 0 (disabled) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> The contrast level for the video device. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlAuthentication" class="twikiLink">control_authentication</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4096 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> To protect HTTP Control by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication. This option must be placed in motion.conf and not in a thread config file. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlHtmlOutput" class="twikiLink">control_html_output</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: on </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Enable HTML in the answer sent back to a browser connecting to the control_port. This option must be placed in motion.conf and not in a thread config file. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlLocalhost" class="twikiLink">control_localhost</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: on </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Limits the http (html) control to the localhost. This option must be placed in motion.conf and not in a thread config file. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlPort" class="twikiLink">control_port</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 65535<br />Default: 0 (disabled) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Sets the port number for the http (html using browser) based remote control. This option must be placed in motion.conf and not in a thread config file. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionDaemon" class="twikiLink">daemon</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Start in daemon (background) mode and release terminal. This option must be placed in motion.conf and not in a thread config file. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionDespeckle" class="twikiLink">despeckle</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: EedDl<br />Default: Not defined </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Despeckle motion image using combinations of (E/e)rode or (D/d)ilate. And ending with optional (l)abeling. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegBps" class="twikiLink">ffmpeg_bps</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 9999999<br />Default: 400000 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Bitrate of mpegs produced by ffmpeg. Bitrate is bits per second. Default: 400000 (400kbps). Higher value mans better quality and larger files. Option requires that ffmpeg libraries are installed. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegCapMotion" class="twikiLink">ffmpeg_cap_motion</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Use ffmpeg libraries to encode motion type mpeg movies where you only see the pixels that changes. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegCapNew" class="twikiLink">ffmpeg_cap_new</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Use ffmpeg libraries to encode mpeg movies in realtime. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegDeinterlace" class="twikiLink">ffmpeg_deinterlace</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Use ffmpeg to deinterlace video. Necessary if you use an analog camera and see horizontal combing on moving objects in video or pictures. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegFilename" class="twikiLink">ffmpeg_filename (now called movie_filename)</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: %v-%Y%m%d%H%M%S </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> File path for motion triggered ffmpeg movies (mpeg) relative to target_dir. This option was renamed to movie_filename in 3.2.5 to enable better integration of alternative movie libraries to the current ffmpeg solution. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegTimelapse" class="twikiLink">ffmpeg_timelapse</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 2147483647<br />Default: 0 (disabled) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Create a timelapse movie saving a picture frame at the interval in seconds set by this parameter. Set it to 0 if not used. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegTimelapseMode" class="twikiLink">ffmpeg_timelapse_mode</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: hourly, daily, weekly-sunday, weekly-monday, monthly, manual<br />Default: daily </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The file rollover mode of the timelapse video. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegVariableBitrate" class="twikiLink">ffmpeg_variable_bitrate</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0, 2 - 31<br />Default: 0 (disabled) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Enables and defines variable bitrate for the ffmpeg encoder. ffmpeg_bps is ignored if variable bitrate is enabled. Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, or the range 2 - 31 where 2 means best quality and 31 is worst. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegVideoCodec" class="twikiLink">ffmpeg_video_codec</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: mpeg1 (ffmpeg-0.4.8 only), mpeg4, msmpeg4, swf, flv, ffv1<br />Default: mpeg4 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Codec to be used by ffmpeg for the video compression. Timelapse mpegs are always made in mpeg1 format independent from this option. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFramerate" class="twikiLink">framerate</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 2 - 100<br />Default: 100 (no limit) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Maximum number of frames to be captured from the camera per second. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFrequency" class="twikiLink">frequency</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 999999<br />Default: 0 (Not set) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The frequency to set the tuner to (kHz). Valid range: per tuner spec, default: 0 (Don't set it) </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionGap" class="twikiLink">gap</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 2147483647<br />Default: 60 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Gap is the seconds of no motion detection that triggers the end of an event. An event is defined as a series of motion images taken within a short timeframe. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionHeight" class="twikiLink">height </a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Device Dependent<br />Default: 288 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The height of each frame in pixels. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionHue" class="twikiLink">hue</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 255<br />Default: 0 (disabled) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> The hue level for the video device. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionInput" class="twikiLink">input </a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 7, 8 = disabled<br />Default: 8 (disabled) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Input channel to use expressed as an integer number starting from 0. Should normally be set to 1 for video/TV cards, and 8 for USB cameras. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionJpegFilename" class="twikiLink">jpeg_filename</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: %v-%Y%m%d%H%M%S-%q </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> File path for motion triggered images (jpeg or ppm) relative to target_dir. Value 'preview' makes a jpeg filename with the same name body as the associated saved mpeg movie file. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionLightswitch" class="twikiLink">lightswitch </a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 100<br />Default: 0 (disabled) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Ignore sudden massive light intensity changes given as a percentage of the picture area that changed intensity. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionLocate" class="twikiLink">locate</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off, preview<br />Default: off </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Locate and draw a box around the moving object. Value 'preview' makes Motion only draw a box on a saved preview jpeg image and not on the saved mpeg movie. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionLowCpu" class="twikiLink">low_cpu</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 100<br />Default: 0 (disabled) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> When this option is not zero motion will be in a low cpu mode while not detecting motion. In low cpu mode Motion reduces the framerate to the value given for this option. Value zero means disabled. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMaskFile" class="twikiLink">mask_file</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> PGM file to use as a sensitivity mask. This picture MUST have the same width and height as the frames being captured and be in binary format. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMaxMpegTime" class="twikiLink">max_mpeg_time</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 (infinite) - 2147483647<br />Default: 3600 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The maximum length of an mpeg movie in seconds. Set this to zero for unlimited length. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMinimumFrameTime" class="twikiLink">minimum_frame_time</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 2147483647<br />Default: 0 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Minimum time in seconds between the capturing picture frames from the camera. Default: 0 = disabled - the capture rate is given by the camera framerate. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMinimumGap" class="twikiLink">minimum_gap</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 2147483647<br />Default: 0 (no minimum) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The minimum time between two shots in seconds. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMinimumMotionFrames" class="twikiLink">minimum_motion_frames</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 1 - 1000s<br />Default: 1 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Picture frames must contain motion at least the specified number of frames in a row before they are detected as true motion. At the default of 1, all motion is detected. Valid range is 1 to thousands, but it is recommended to keep it within 1-5. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMotionVideoPipe" class="twikiLink">motion_video_pipe</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The video4linux video loopback input device for motion images. If a particular pipe is to be used then use the device filename of this pipe, if a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe. Default: not set </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMovieFilename" class="twikiLink">movie_filename</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: %v-%Y%m%d%H%M%S </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> File path for motion triggered ffmpeg movies (mpeg) relative to target_dir. This was previously called ffmpeg_filename. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMysqlDb" class="twikiLink">mysql_db</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Name of the MySQL database. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMysqlHost" class="twikiLink">mysql_host</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: localhost </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> IP address or domain name for the MySQL server. Use "localhost" if motion and MySQL runs on the same server. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMysqlPassword" class="twikiLink">mysql_password</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The MySQL password. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMysqlUser" class="twikiLink">mysql_user</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> The MySQL user name. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNetcamProxy" class="twikiLink">netcam_proxy</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> URL to use for a netcam proxy server, if required. The syntax is <a href="http://myproxy:portnumber" rel="nofollow" target="_top">http://myproxy:portnumber</a> </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNetcamUrl" class="twikiLink">netcam_url</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Specify an url to a downloadable jpeg file or raw mjpeg stream to use as input device. Such as an AXIS 2100 network camera. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNetcamUserpass" class="twikiLink">netcam_userpass</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> For network cameras protected by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNightCompensate" class="twikiLink">night_compensate</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> When this option is set the noise threshold will be lowered if the picture is dark. This will improve the sensitivity in dark places. However it might also increase the number of false alarms since most cameras also increase light sensitivity with their AGC (Automatic Gain Control) and this will increase noise. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNoiseLevel" class="twikiLink">noise_level</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 1 - 255<br />Default: 32 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The noise level is used as a threshold for distinguishing between noise and motion. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNoiseTune" class="twikiLink">noise_tune</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: on </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Activates the automatic tuning of noise level. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNorm" class="twikiLink">norm</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour)<br />Default: 0 (PAL) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Select the norm of the video device. Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL) </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnEventEnd" class="twikiLink">on_event_end</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Command to be executed when an event ends after a period of no motion. The period of no motion is defined by option gap. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> and spaces as part of the command. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnEventStart" class="twikiLink">on_event_start</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Command to be executed when an event starts. An event starts at first motion detected after a period of no motion defined by gap. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">ConversionSpecifiers</a> and spaces as part of the command. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnMotionDetected" class="twikiLink">on_motion_detected</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Command to be executed when a motion frame is detected. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> and spaces as part of the command. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnMovieEnd" class="twikiLink">on_movie_end</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Command to be executed when an ffmpeg movie is closed at the end of an event. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> and spaces as part of the command. Use %f for passing filename (with full path) to the command. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnMovieStart" class="twikiLink">on_movie_start</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Command to be executed when an mpeg movie is created. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> and spaces as part of the command. Use %f for passing filename (with full path) to the command. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnPictureSave" class="twikiLink">on_picture_save</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Command to be executed when an image is saved. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> and spaces as part of the command. Use %f for passing filename (with full path) to the command. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOutputAll" class="twikiLink">output_all</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Picture are saved continuously as if motion was detected all the time. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOutputMotion" class="twikiLink">output_motion</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Output pictures with only the moving object. This feature generates the special motion type movies where you only see the pixels that changes as a graytone image. If labelling is enabled you see the largest area in blue. Smartmask is shown in red. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOutputNormal" class="twikiLink">output_normal</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off, first, best<br />Default: on </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Normal image is an image that is stored when motion is detected. It is the same image that was taken by the camera. I.e. not a motion image like defined by output_motion. Default is that normal images are stored. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPgsqlDb" class="twikiLink">pgsql_db</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Name of the PostgreSQL database. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPgsqlHost" class="twikiLink">pgsql_host</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: localhost </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> IP address or domain name for the PostgreSQL server. Use "localhost" if motion and PostgreSQL runs on the same server. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPgsqlPassword" class="twikiLink">pgsql_password</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The PostgreSQL password. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPgsqlPort" class="twikiLink">pgsql_port</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 65535<br />Default: 5432 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> The PostgreSQL server port number. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPgsqlUser" class="twikiLink">pgsql_user</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The PostgreSQL user name. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPostCapture" class="twikiLink">post_capture</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 2147483647 <br />Default: 0 (disabled) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Specifies the number of frames to be captured after motion has been detected. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPpm" class="twikiLink">ppm</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Output ppm images instead of jpeg. This uses less CPU time, but causes a LOT of hard disk I/O, and it is generally slower than jpeg. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPreCapture" class="twikiLink">pre_capture</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 100s<br />Default: 0 (disabled) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Specifies the number of previous frames to be outputted at motion detection. Recommended range: 0 to 5, default=0. Do not use large values! Large values will cause Motion to skip video frames and cause unsmooth mpegs. To smooth mpegs use larger values of post_capture instead. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionProcessIdFile" class="twikiLink">process_id_file</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> File to store the process ID, also called pid file. Recommended value when used: /var/run/motion.pid </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionQuality" class="twikiLink">quality</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 1 - 100<br />Default: 75 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> The quality for the jpeg images in percent. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionQuiet" class="twikiLink">quiet</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Be quiet, don't output beeps when detecting motion. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionRotate" class="twikiLink">rotate</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0, 90, 180, 270<br />Default: 0 (not rotated) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Rotate image the given number of degrees. The rotation affects all saved images as well as mpeg movies. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionRoundrobinFrames" class="twikiLink">roundrobin_frames</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 1 - 2147483647<br />Default: 1 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Specifies the number of frames to capture before switching inputs, this way also slow switching (e.g. every second) is possible. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionRoundrobinSkip" class="twikiLink">roundrobin_skip</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 1 - 2147483647<br />Default: 1 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Specifies the number of frames to skip after a switch. (1 if you are feeling lucky, 2 if you want to be safe). </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSaturation" class="twikiLink">saturation</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 255<br />Default: 0 (disabled) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The colour saturation level for the video device. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSetupMode" class="twikiLink">setup_mode</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Run Motion in setup mode. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSmartMaskSpeed" class="twikiLink">smart_mask_speed</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 10<br />Default: 0 (disabled) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Slugginess of the smart mask. Default is 0 = DISABLED. 1 is slow, 10 is fast. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSnapshotFilename" class="twikiLink">snapshot_filename</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: %v-%Y%m%d%H%M%S-snapshot </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> File path for snapshots (jpeg or ppm) relative to target_dir. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSnapshotInterval" class="twikiLink">snapshot_interval</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 2147483647<br />Default: 0 (disabled) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Make automated snapshots every 'snapshot_interval' seconds. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlLogImage" class="twikiLink">sql_log_image</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: on </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Log to the database when creating motion triggered image file. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlLogMpeg" class="twikiLink">sql_log_mpeg</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Log to the database when creating motion triggered mpeg file. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlLogSnapshot" class="twikiLink">sql_log_snapshot</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: on </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Log to the database when creating a snapshot image file. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlLogTimelapse" class="twikiLink">sql_log_timelapse</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Log to the database when creating timelapse mpeg file </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlQuery" class="twikiLink">sql_query</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> SQL query string that is sent to the database. The values for each field are given by using <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">convertion specifiers</a> </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSwitchfilter" class="twikiLink">switchfilter</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Turns the switch filter on or off. The filter can distinguish between most switching noise and real motion. With this you can even set roundrobin_skip to 1 without generating much false detection. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTargetDir" class="twikiLink">target_dir</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined = current working directory </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Target directory for picture and movie files. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTextChanges" class="twikiLink">text_changes</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Turns the text showing changed pixels on/off. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTextDouble" class="twikiLink">text_double</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Draw characters at twice normal size on images. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTextEvent" class="twikiLink">text_event</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: %Y%m%d%H%M%S </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> This option defines the value of the speciel event conversion specifier %C. You can use any conversion specifier in this option except %C. Date and time values are from the timestamp of the first image in the current event. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTextLeft" class="twikiLink">text_left</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> User defined text overlayed on each in the lower left corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # &lt; &gt; \ , . : - + _ \n and <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> (codes starting by a %). </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTextRight" class="twikiLink">text_right</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: %Y-%m-%d\n%T </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> User defined text overlayed on each in the lower right corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # &lt; &gt; , . : - + _ \n and <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> (codes starting by a %). Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionThread" class="twikiLink">thread</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Specifies full path and filename for a thread config file. Each camera needs a thread config file containing the options that are unique to the camera. If you only have one camera you do not need thread config files. If you have two or more cameras you need one thread config file for each camera in addition to motion.conf. This option must be placed in motion.conf and not in a thread config file. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionThreshold" class="twikiLink">threshold</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 1 - 2147483647<br />Default: 1500 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Threshold for declaring motion. The threshold is the number of changed pixels counted after noise filtering, masking, despeckle, and labelling. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionThresholdTune" class="twikiLink">threshold_tune</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Activates the automatic tuning of threshold level. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTimelapseFilename" class="twikiLink">timelapse_filename</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: %v-%Y%m%d-timelapse </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> File path for timelapse mpegs relative to target_dir (ffmpeg only). </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackAuto" class="twikiLink">track_auto</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Enable auto tracking </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackIomojoId" class="twikiLink">track_iomojo_id</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 2147483647<br />Default: 0 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Use this option if you have an iomojo smilecam connected to the serial port instead of a general stepper motor controller. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackMaxx" class="twikiLink">track_maxx</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 2147483647<br />Default: 0 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> The maximum position for servo x. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackMaxy" class="twikiLink">track_maxy</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 2147483647<br />Default: 0 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The maximum position for servo y. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackMotorx" class="twikiLink">track_motorx</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: -1 - 2147483647<br />Default: -1 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> The motor number that is used for controlling the x-axis. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackMotory" class="twikiLink">track_motory</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: -1 - 2147483647<br />Default: -1 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The motor number that is used for controlling the y-axis. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackMoveWait" class="twikiLink">track_move_wait</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 2147483647<br />Default: 10 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Delay during which tracking is disabled after auto tracking has moved the camera. Delay is defined as number of picture frames. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackPort" class="twikiLink">track_port</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> This is the device name of the serial port to which the stepper motor interface is connected. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackSpeed" class="twikiLink">track_speed</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 255<br />Default: 255 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Speed to set the motor to. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackStepAngleX" class="twikiLink">track_step_angle_x</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0-90<br />Default: 10 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Angle in degrees the camera moves per step on the X-axis with auto tracking. Currently only used with pwc type cameras. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackStepAngleY" class="twikiLink">track_step_angle_y</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0-40<br />Default: 10 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Angle in degrees the camera moves per step on the Y-axis with auto tracking. Currently only used with pwc type cameras. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackStepsize" class="twikiLink">track_stepsize</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 0 - 255<br />Default: 40 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Number of steps to make. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackType" class="twikiLink">track_type</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 (none), 1 (stepper), 2 (iomojo), 3 (pwc), 4 (generic), 5 (uvcvideo)<br />Default: 0 (None) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Type of tracker. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTunerdevice" class="twikiLink">tunerdevice</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: /dev/tuner0 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The tuner device used for controlling the tuner in a tuner card. This option is only used when Motion is compiled for <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/FreeBSD" class="twikiLink">FreeBSD</a>. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionVideoPipe" class="twikiLink">video_pipe</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: Not defined </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> The video4linux video loopback input device for normal images. If a particular pipe is to be used then use the device filename of this pipe. If a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionVideodevice" class="twikiLink">videodevice</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: Max 4095 characters<br />Default: /dev/video0 (<a href="http://www.lavrsen.dk/twiki/bin/view/Motion/FreeBSD" class="twikiLink">FreeBSD</a>: /dev/bktr0) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> The video device to be used for capturing. Default for Linux is /dev/video0. for <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/FreeBSD" class="twikiLink">FreeBSD</a> the default is /dev/bktr0. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamLimit" class="twikiLink">webcam_limit</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 2147483647<br />Default: 0 (unlimited) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Limit the number of frames to number frames. After 'webcam_limit' number of frames the connection will be closed by motion. The value 0 means unlimited. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamLocalhost" class="twikiLink">webcam_localhost</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: on </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Limits the access to the webcam to the localhost. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamMaxrate" class="twikiLink">webcam_maxrate</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 1 - 100<br />Default: 1 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Limit the framerate of the webcam in frames per second. Default is 1. Set the value to 100 for practically unlimited. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamMotion" class="twikiLink">webcam_motion</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: on, off<br />Default: off </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> If set to 'on' Motion sends slows down the webcam stream to 1 picture per second when no motion is detected. When motion is detected the stream runs as defined by webcam_maxrate. When 'off' the webcam stream always runs as defined by webcam_maxrate. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamPort" class="twikiLink">webcam_port</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Values: 0 - 65535<br />Default: 0 (disabled) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> TCP port on which motion will listen for incoming connects with its webcam server. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamQuality" class="twikiLink">webcam_quality</a> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Values: 1 - 100<br />Default: 50 </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Quality setting in percent for the mjpeg picture frames transferred over the webcam connection. Keep it low to restrict needed bandwidth. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol twikiLast"> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWidth" class="twikiLink">width</a> </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> Values: Device Dependent<br />Default: 352 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> The width in pixels of each frame. Valid range is camera dependent. </td></tr>
</table>
<p />
<p />
<h2><a name="Signals_sent_with_e_g_kill_comma"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/SignalsKill" class="twikiLink">Signals (sent with e.g. kill command)</a> </h2>
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 &brvbar; 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 />
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=0;table=9;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Signal</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=1;table=9;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Description</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=2;table=9;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Editors comment</a> </th></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> SIGHUP </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> The config file will be reread. </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> This is a very useful signal when you experiment with settings in the config file. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> SIGTERM </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> If needed motion will create an mpeg file of the last event and exit </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> &nbsp; </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol twikiLast"> SIGUSR1 </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> Motion will create an mpeg file of the current event. </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiLast"> &nbsp; </td></tr>
</table>
<p />
<p />
<h2><a name="Error_Logging"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ErrorLogging" class="twikiLink">Error Logging</a> </h2>
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 />
Error logging has been implemented so that errors during daemon (background) mode are logged in the syslog.
<p />
The syslog 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 />
<h1><a name="Motion_Guide_Basic_Features"></a> Motion Guide - Basic Features </h1>
<p />
<h2><a name="Capture_Device_Options_The_Basic"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/CaptureDeviceOptions" class="twikiLink">Capture Device Options - The Basic Setup</a> </h2>
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 />
<h2><a name="video4linux_V4L_devices"></a> video4linux (<a href="http://www.lavrsen.dk/twiki/bin/view/Motion/V4L" class="twikiLink">V4L</a>) devices </h2>
You need to install your camera with the right driver. It is out of scope of this document to tell you how to do this and it depends on which type of camera. 
<p />
Once installed the camera(s) will have the device names /dev/video0, /dev/video1, /dev/video2...
<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 />
<strong>USB cameras</strong> take a lot of bandwidth. A USB camera connected to a USB 1.1 port or hub consumes all the bandwidth. Even with a small framesize and low framerate you should not expect to have more than one camera per USB 1.1 controller. If you need more than 1 USB camera add extra USB PCI cards to your computer. There exists cards that have 4 inputs each with their own controller and with full bandwidth. Many 4-input cards only have 1 controller. USB cameras do not have the feature of selecting input channels. <em>To disable the input selection the option <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionInput" class="twikiLink">input</a> must be set to the value 8 for USB cameras.</em>
<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 />
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 <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionInput" class="twikiLink">input</a>. Input channel numbers start at 0 (which is why the value 8 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. See the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument#RoundRobin" class="twikiCurrentTopicLink twikiAnchorLink">round robin</a> section for more information. Many TV tuner cards have the input channels: TV Tuner = 0, Standard composite video = 1, S-VHS = 3. Other have TV=0, composite video 1= 1, composite video = 2,  S-VHS = 3. For video capture cards input 1 is normally the composite video input.
<p />
Some capture cards are specially made for surveillance with for example 4 inputs. Others have a TV tuner, a composite input (phono socket) and perhaps also a S-VHS input. For all these cards the inputs are numbered. The numbering varies from card to card so the easiest is to experiment for 5 minutes with a program that can show the videostream. Use a program such as Camstream or xawtv to experiment with the values.
<p />
If you use the TV tuner input you also need to set the frequency of the TV channel using the option <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFrequency" class="twikiLink">frequency</a>. Otherwise set 'frequency' to 0.
<p />
Finally you need to set the TV norm. Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default is 0 (PAL). If your camera is a PAL black and white you may get a better result with norm=3 (PAL no colour).
<p />
If the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNetcamUrl" class="twikiLink">netcam_url</a> option is defined all the video4linux options are ignored so make sure the netcam_url option is commented out if you do not need it.
<p />
<strong>These are the parameters used for video4linux devices</strong>
<p />
<p />
<h3><a name="auto_brightness"></a> auto_brightness </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionAutoBrightness" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Let motion regulate the brightness of a video device. Only recommended for cameras without auto brightness
<p />
Motion will try to adjust the brightness of the video device if the images captured are too dark or too light. This option will be most useful for video devices like web cams, which sometimes don't have such an option in hardware.
<p />
The auto_brightness feature will adjust the brightness of the device up or down until the value defined by the option <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionBrightness" class="twikiLink">brightness</a> is reached (1 = dark, 255 = bright). If <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionBrightness" class="twikiLink">brightness</a> is zero auto_brightness will try to adjust to the average brightness level 128.
<p />
You need to know if the camera supports auto brightness. Most cameras have auto everything. If your video device already does this for you this option might cause oscillations. If you do not know assume that it has and do not use the Motion auto brightness feature. At least not to start with.
<p />
<p />
<h3><a name="brightness"></a> brightness </h3> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 255
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionBrightness" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The brightness level for the video device.
<p />
Value 0 means that Motion does not set the brightness value but leaves it unchanged.
<p />
If this setting is used in conjunction with the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionAutoBrightness" class="twikiLink">auto_brightness</a> feature then this setting is the average brightness level in the range 1 (dark) to 255 (bright) that the auto_brightness feature will try to achieve by adjusting the device brightness up and down.
<p />
<p />
<h3><a name="contrast"></a> contrast </h3> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: 0 - 255
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionContrast" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The contrast level for the video device.
<p />
Disabled (Value 0) means that Motion does not set the contrast value.
<p />
<p />
<h3><a name="framerate"></a> framerate </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 2 - 100
</li> <li> Default: 100 (no limit)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFramerate" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Maximum number of frames to be captured from the camera per second.
<p />
The faster you fetch pictures from the camera the more CPU load you get and the more pictures get included when Motion is detected.
<p />
Motion will stop storing pictures if the framerate is set to less than 2.
<p />
Set this parameter to the maximum number of images per second that you want to store either as images or as mpeg films.
<p />
To set intervals longer than one second use the 'minimum_gap' option instead.
<p />
<p />
<h3><a name="frequency"></a> frequency </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: 0 - 999999
</li> <li> Default: 0 (Not set)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFrequency" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The frequency to set the tuner to (kHz). Valid range: per tuner spec, default: 0 (Don't set it)
<p />
This option is only relevant if you have a TV tuner card where you can select the tuner frequency. Your tuner card must support this feature.
<p />
<p />
<h3><a name="height"></a> height </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: Device Dependent
</li> <li> Default: 288
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionHeight" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The height of each frame in pixels.
<p />
The height of the image in pixels. Motion does not scale so should be set to the actual size of the v4l device. In case of a net camera motion sets the height to the height of the first image read.
<p />
Motion actually set the size of the image coming from the video4linux device.
<p />
Your camera or capture/TV card will not support any picture size. You must know which frame size (width and height) the camera supports. If you do not know start with width 320 and height 240 which most cameras and capture cards supports.
<p />
For some device drivers like pwc (driver for Philips USB cameras) setting the size to a non-standard value makes the driver create an image of the nearest smaller size and create a gray band around the image to fit the size given by motion. Note that it is the driver and not motion that generates the gray band. Motion will try to detect motion in the entire image including the gray band.
<p />
Motion requires that dimensions of camera image must have both height and width that are a multiple of 16. Ths is normally not a problem. All standard sizes like 640, 480, 352, 320, 288, 240, ...etc are multiples of 16.
<p />
<p />
<h3><a name="hue"></a> hue </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 255
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionHue" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The hue level for the video device.
<p />
Normally only relevant for NTSC cameras.
<p />
<p />
<h3><a name="input"></a> input </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 7, 8 = disabled
</li> <li> Default: 8 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionInput" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Input channel to use expressed as an integer number starting from 0. Should normally be set to 1 for video/TV cards, and 8 for USB cameras.
<p />
This parameter is really used only with video capture cards that has more than one input.
<p />
However if you set the input number to e.g. 1 for a USB camera (ov511 or pwc driver) motion writes an error message back. If you set it to 8 it does not give you any warning.
<p />
If you have a video capture card you can define the channel to tune to using this option. If you are using a USB device, network camera or a capture card without tuner you should set the value to the default 8.
<p />
Many TV tuner cards have the input channels: TV Tuner = 0, Standard composite video = 1, S-VHS = 3. Other have TV=0, composite video 1= 1, composite video = 2,  S-VHS = 3. It is recommended to set the parameter to 8 for USB cameras as your first try. For video capture cards input 1 is normally the composite video input.
<p />
<p />
<h3><a name="minimum_frame_time"></a> minimum_frame_time </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 2147483647
</li> <li> Default: 0
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMinimumFrameTime" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Minimum time in seconds between the capturing picture frames from the camera. Default: 0 = disabled - the capture rate is given by the camera framerate.
<p />
This option is used when you want to capture images at a rate lower than 2 per second.
<p />
When this is enabled the framerate option is used only to set the pace the Motion service the webcam port etc. Running Motion at framerate 2 is normally fine.
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> This feature is introduced in Motion 3.2.7
<p />
<!--
Add Additional Description Below 
-->
<p />
<p />
<h3><a name="norm"></a> norm </h3>
<p /> <ul>
<li> Type: Discrete Strings
</li> <li> Range / Valid values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour)
</li> <li> Default: 0 (PAL)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNorm" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Select the norm of the video device. Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL)
<p />
This value is only used for capture cards using the <a href="http://bytesex.org/bttv/index.html" rel="nofollow" target="_top">BTTV driver</a>.
<p />
<p />
<h3><a name="rotate"></a> rotate </h3>
<p /> <ul>
<li> Type: Discrete Strings
</li> <li> Range / Valid values: 0, 90, 180, 270
</li> <li> Default: 0 (not rotated)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionRotate" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Rotate image the given number of degrees. The rotation affects all saved images as well as mpeg movies.
<p />
The rotation feature is used when the camera is hanging upside down (180 degrees) or if you choose a picture format in portrait instead of the normal landscape (90 or 270 degrees).
<p />
Note that the CPU load increases when using this feature with a value other than 0. Also note that Motion automatically swaps width and height if you rotate 90 or 270 degrees, so you don't have to touch these options.
<p />
<p />
<h3><a name="saturation"></a> saturation </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 255
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSaturation" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The colour saturation level for the video device.
<p />
<p />
<h3><a name="tunerdevice"></a> tunerdevice </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: /dev/tuner0
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTunerdevice" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The tuner device used for controlling the tuner in a tuner card. This option is only used when Motion is compiled for <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/FreeBSD" class="twikiLink">FreeBSD</a>.
<p />
Make sure to remove or comment out this option when running Motion under Linux.
<p />
<p />
<h3><a name="videodevice"></a> videodevice </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: /dev/video0 (<a href="http://www.lavrsen.dk/twiki/bin/view/Motion/FreeBSD" class="twikiLink">FreeBSD</a>: /dev/bktr0)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionVideodevice" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The video device to be used for capturing. Default for Linux is /dev/video0. for <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/FreeBSD" class="twikiLink">FreeBSD</a> the default is /dev/bktr0.
<p />
This is the video4linux device name. Ignore this for net cameras.
<p />
<p />
<h3><a name="width"></a> width </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: Device Dependent
</li> <li> Default: 352
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWidth" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The width in pixels of each frame. Valid range is camera dependent.
<p />
Motion does not scale so should be set to the actual size of the v4l device.
<p />
In case of a net camera motion sets the height to the height of the first image read.
<p />
Motion actually set the size of the image coming from the video4linux device.
<p />
Your camera or capture/TV card will not support any picture size. You must know which frame size (width and height) the camera supports. If you do not know start with width 320 and height 240 which most cameras and capture cards supports.
<p />
For some device drivers like pwc (driver for Philips USB cameras) setting the size to a non-standard value makes the driver create an image of the nearest smaller size and create a gray band around the image to fit the size given by motion. Note that it is the driver and not motion that generates the gray band. Motion will try to detect motion in the entire image including the gray band.
<p />
Motion requires that dimensions of camera image must have both height and width that are a multiple of 16. Ths is normally not a problem. All standard sizes like 640, 480, 352, 320, 288, 240, ...etc are multiples of 16.
<p />
<p />
<h2><a name="Network_Cameras"></a> Network Cameras </h2>
Motion can connect to a network camera through a normal TCP socket. All you need to give it is the URL. The URL given must return either one single jpeg picture or an mjpeg stream. For the time being Motion cannot connect to a video stream such a mpeg, mpeg4, divx. The URL must return one single jpeg image or an mjpeg stream! You can connect through a proxy server.
<p />
Also watch out that you do not use a URL that create an HTML page with an embedded jpg. What must be returned is the jpg picture itself or the raw mjpeg stream.
<p />
When the netcam_url is defined all the video4linux options above are ignored!!
<p />
If the connection to a network camera is lost - Motion will reuse the last good image for approx 30 seconds. AFter 30 seconds the image is replaced by a grey image with a text telling that the signal is lost and when the connection was lost. <em>This text and its date format is not configurable and there are no plans to make it configurable in order to keep the number config options under control.</em>
<p />
Note that Motion requires that dimensions of camera image must have both height and width that are a multiple of 16. Ths 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.
<p />
<em>The network camera feature has been completely re-written in Motion 3.2.2. We believe the netcam feature is much more stable now that it was in previous versions. Motion tries to reconnect to the camera if the connection is lost. There is no official standard for mjpeg and we know that there are probably still some cameras that are not yet supported. If you run into a problem please file a <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/BugReports" class="twikiLink">Bug Report</a> with as much information about the format as possible. A binary raw dump of the first 2-3 frames with headers and boundary strings is very useful. You can see how to make it on the special topic <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/NetcamMjpegStreamDumps" class="twikiLink">NetcamMjpegStreamDumps</a>. When you have the file you can upload it to the same topic.</em>
<p />
<p />
<h3><a name="netcam_proxy"></a> netcam_proxy </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNetcamProxy" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
URL to use for a netcam proxy server, if required. The syntax is <a href="http://myproxy:portnumber" rel="nofollow" target="_top">http://myproxy:portnumber</a>
<p />
Use this if you need to connect to a network camera through a proxy server. 
<p />
Example of syntax: "http://myproxy.mydomain.com:1024
<p />
If the proxy port number is 80 you can ommit the port number. Then the syntax is use "http://myproxy.mydomain.com" .
<p />
Leave this option undefined if you do not use a proxy server.
<p />
<p />
<h3><a name="netcam_url"></a> netcam_url </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNetcamUrl" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Specify an url to a downloadable jpeg file or raw mjpeg stream to use as input device. Such as an AXIS 2100 network camera.
<p />
Example of URL: http://www.gate.com/pe1rxq/jeroen.jpg.
<p />
Motion can connect to a network camera through a normal TCP socket. All you need to give it is the URL. The URL given must return either one single jpeg picture or an mjpeg stream. For the time being Motion cannot connect to a video stream such a mpeg, mpeg4, divx. The URL must return one single jpeg image or an mjpeg stream!
<p />
Also watch out that you do not use a URL that create an HTML page with an embedded jpg. What must be returned is the jpg picture itself or the raw mjpeg stream.
<p />
When the netcam_url is defined all the video4linux options are ignored!!
<p />
Motion can also fetch jpeg pictures via ftp. You then use the ftp:// syntax instead.
<p />
<p />
<h3><a name="netcam_userpass"></a> netcam_userpass </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNetcamUserpass" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
For network cameras protected by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication.
<p />
To use no authentication simply remove this option from the config file comment it out with "#" or ";" in front.
<p />
<p />
<p />
<a name="RoundRobin"></a>
<h2><a name="Round_Robin_feature"></a> Round Robin feature </h2>
This feature is automatically activated where multiple threads are sharing the same video device (for example /dev/video0). Each thread can then set different input channels to change camera with the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionInput" class="twikiLink">input</a> option or by tuning the tuner with <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFrequency" class="twikiLink">frequency</a> option.
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> Round Robin is not relevant for Network cameras or standard USB web cameras. The Round Robin feature is used with video capture cards which have multiple inputs per video chip.
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> Note that round robin is not the ideal way to run multiple cameras. When the capture card changes input it takes a little while before the decoder chip has syncronized to the new camera. You can improve this if you have expensive cameras with a syncronize input. Only one camera can be decoded at a time so if you have 4 cameras connected 3 of the camera threads will need to wait for their turn. The fact that cameras have to take turns and the fact that you have to skip a few frames after each turn dramatically lowers the possible framerate. You can get a high framerate by viewing each camera for a long time. But then you may miss the action on one of the inactive cameras. If you can affort it avoid Round Robin and buy the more expensive type of capture cards that has one decoder chip per input. If you only need 2 or 3 cameras you can also simply put 2 or 3 cheap TV cards in the computer. Linux has no problem working with multiple TV cards.
<p /> <ul>
<li> If multiple threads use the same video device, they each can capture <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionRoundrobinFrames" class="twikiLink">roundrobin_frames</a> number of frames before having to share the device with the other threads.
</li> <li> When another thread wants to watch another input or frequency or size the first <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionRoundrobinSkip" class="twikiLink">roundrobin_skip</a> number of frames are skipped to allow the device to settle.
</li> <li> The last option <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSwitchfilter" class="twikiLink">switch_filter</a> is supposed to prevent the change of camera from being detected as Motion. Its function is not perfect and sometimes prevents detection of real motion. You should start with having the option disabled and then try with the option enabled to see if you can skip less frames without loosing the detection of the type of motion you normally want to detect.
</li></ul> 
<p />
<strong>These are the special Round Robin options</strong>
<p />
<p />
<h3><a name="roundrobin_frames"></a> roundrobin_frames </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 1 - 2147483647
</li> <li> Default: 1
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionRoundrobinFrames" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Specifies the number of frames to capture before switching inputs, this way also slow switching (e.g. every second) is possible.
<p />
The Round Robin feature is automatically activated where multiple threads are sharing the same video device. Each thread can then set different input channels or frequencies to change camera.
<p />
If multiple threads use the same video device, they each can capture roundrobin_frames number of frames before having to share the device with the other threads.
<p />
<p />
<h3><a name="roundrobin_skip"></a> roundrobin_skip </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 1 - 2147483647
</li> <li> Default: 1
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionRoundrobinSkip" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Specifies the number of frames to skip after a switch. (1 if you are feeling lucky, 2 if you want to be safe).
<p />
The Round Robin feature is automatically activated where multiple threads are sharing the same video device. Each thread can then set different input channels or frequencies to change camera.
<p />
When another thread wants to watch another input or frequency or size the first roundrobin_skip number of frames are skipped to allow the device to settle.
<p />
<p />
<h3><a name="switchfilter"></a> switchfilter </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSwitchfilter" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Turns the switch filter on or off. The filter can distinguish between most switching noise and real motion. With this you can even set roundrobin_skip to 1 without generating much false detection.
<p />
This is a round robin related feature used when you have a capture card with multiple inputs (controlled by the 'input' option) on the same videodevice.
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> This feature was seriously broken until Motion 3.2.4
<p />
<p />
<h2><a name="Motion_Detection_Settings"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionDetectionSettings" class="twikiLink">Motion Detection Settings</a> </h2>
These are the options that controls the detection of motion. Further details follows after.
<p />
<p />
<h3><a name="despeckle"></a> despeckle </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: EedDl
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionDespeckle" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Despeckle motion image using combinations of (E/e)rode or (D/d)ilate. And ending with optional (l)abeling.
<p />
A way of tuning (by removing or enhancing) noise in the motion image. Options for the despeckle feature are any of 'e', 'E', 'd' or 'D'. This can be combined by a trailing 'l' (letter l) which enables the labeling feature. Default: Not Defined (Don't despeckle and label).
<p />
Wind blowing grass and trees around or poor light conditions can cause a lot of dots (or noise) to appear in the motion image (See the section on Tuning Motion). This feature removes (or enhances!) this noise and so improves the reliability of motion.
<p />
The 'e' option removes diamonds, 'E' removes squares and alternating eE will remove circles. Each e/E you add will shrink the noise by a pixel all the way around. So 'despeckle Ee' will remove circles of radius 2. However, this will also shrink the detection by 2 and will affect the threshold. So to remove noise and then restore the detected motion to its original size try 'despeckle EedD'. 
<p />
After the despeckle feature is done you can let the labeling feature search for areas of connected pixels and "label" each area. The program will now trigger motion based on the number of changed pixels in the largest area. In other words, the largest labeled area has to be above the threshold to trigger a motion detected.
<p />
The value EedDl is a good starting point. The possible combinations are endless and it requires many experiments to find the best combination. Just remember that the labeling feature only works as intended if it runs after the despeckle feature. Ie. the letter 'l' must be the last letter and only one 'l'.
<p />
If you have very few problems with false detections leave this option either blank or at EedD which will remove most of the single pixel noise.
A very detailed technical explanation of the despeckle part can be found at the webpage of the author of this feature <a href="http://emit.demon.co.uk/motion/" rel="nofollow" target="_top">Ian McConnell's Webcam: Motion Web Page</a>
<p />
<p />
<h3><a name="gap"></a> gap </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 2147483647
</li> <li> Default: 60
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionGap" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Gap is the seconds of no motion detection that triggers the end of an event. An event is defined as a series of motion images taken within a short timeframe.
<p />
Recommended value is 60 seconds (Default). The value 0 is allowed (but not recommended) and disables events causing all Motion to be written to one single mpeg file and no pre_capture. You can force an event to end and a new to begin using the http control 'http://host:port/thread_number/action/makemovie'. Disabling events has bad side effects on noise_tune and smartmask. Both features can only work properly outside an event. When gap is set to 0, both features don't work properly anymore.
<p />
An event is defined as a series of motion images taken within a short timeframe. E.g. a person walking through the room is an event that may have caused 10 single jpg images to be stored. This option defines how long a pause between detected motions that is needed to be defined as a new event.
<p />
The gap timer starts after the last motion is detected and post_capture images have been saved and appended to open movie mpeg files.
<p />
Any motion detected before the gap timer times out resets the gap timer so it starts counting over again.
<p />
<strong>Detailed Description</strong>
<p />
The option 'gap' is important. It defines how long a period of no motion detected it takes before we say an event is over. An event is defined as a series of motion images taken within a short timeframe. E.g. a person walking through the room is an event that may have caused 10 single jpg images to be stored. Motion detected includes post_captured frames set by the 'post_capture' option. The 'gap' option defines how long a pause between detected motions that is needed to be defined as a new event. A good starting value is 60 seconds.
<p />
The way 'gap' works in more technical terms is: <ul>
<li> Gap is a timer that timeout 'gap' seconds after the last video frame with motion is detected.
</li> <li> If 'post_capture' is activated then the gap timer starts counting after the last image of the post_capture buffer has been saved.
</li> <li> The gap timer is reset and starts all over each time new motion is detected, so you will not miss any action by having a short 'gap' value. It will just create more events (e.g. more mpegs files)
</li></ul> 
<p />
The gap value impacts many functions in Motion. <ul>
<li> When the gap timer runs out the event number is increased by one next time motion is detected. When you use the %v conversion specifier in filenames or text features this means that the number in filename or text increased by one.
</li> <li> The pre_capture feature only works at the beginning of an event. So if you have a very large 'gap' value pre_capture is not working very often.
</li> <li> When you make mpegs using the ffmpeg features a new mpeg file is started at the beginning of an event when the first motion is detected. When 'gap' seconds has passed without motion (and post_captured frames saved) the mpeg files is completed and closed.
</li> <li> Do not use large gap values to generate one large mpeg4 file. If Motion stops working this mpeg4 file never gets properly completed and closed and you will not be able to view it.
</li> <li> Some of the tracking features sets the camera back to the center position when an event is over.
</li></ul> 
<p />
Note that 'gap' and 'minimum_gap' have nothing to do with each other.
<p />
<p />
<h3><a name="lightswitch"></a> lightswitch </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 100
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionLightswitch" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Ignore sudden massive light intensity changes given as a percentage of the picture area that changed intensity.
<p />
Experiment to see what works best for your application.
<p />
Note: From version 3.1.17 (snap release 2 and on) this option has changed from a boolean (on or off) to a number in percent between 0 and 100. Zero means the option is disabled.
<p />
The value defines the picture areas in percent that will trigger the lightswitch condition. When lightswitch is detected motion detection is disabled for 5 picture frames. This is to avoid false detection when light conditions change and when a camera changes sensitivity at low light.
<p />
<p />
<h3><a name="low_cpu"></a> low_cpu </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 100
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionLowCpu" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
When this option is not zero motion will be in a low cpu mode while not detecting motion. In low cpu mode Motion reduces the framerate to the value given for this option. Value zero means disabled.
<p />
This is smart for running a server that also does other tasks such as running Apache, MySQL etc. Motion grabs this lower number of frames per second until it detects motion. Then it speeds up to normal speed and take pictures as set by the option "framerate".
<p />
<p />
<h3><a name="mask_file"></a> mask_file </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMaskFile" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
PGM file to use as a sensitivity mask. This picture MUST have the same width and height as the frames being captured and be in binary format. 
<p />
Full path of the PGM (portable gray map) mask file (binary format).
<p />
If you have one or more areas of the camera image in which you do NOT want motion detected (e.g. a tree that moves in the wind or a corner of the picture where you can see cars/pedestrians passing by) you need a mask file. This file is a picture that you create in your favorite photo editing program. The areas that you want detected must be white. The error that you want ignored must be black. The pgm image must be the same size (number of pixels high and wide) as the pictures that are taken by the camera (video4linux device).
<p />
You can adjust sensitivity by using gray tones.
<p />
If you do not have a mask file disable this option by not having it in the config file or comment it out ("#"or ";" as first character in line).
If you are using the <code>rotate</code> option, note that the mask is applied <em>after</em> the rotation.
<p />
<strong>Detailed Description</strong>
<p />
The mask file must be a pgm format image file (portable gray map). Note that you must choose the BINARY format.
<p />
The feature is simple. Create an image of exact the same size as the ones you get from your video device (camera). Make a purely white picture and paint the areas that you want to mask out black. You can also make gray areas where you want to lower the sensitivity to motion. Normally you will stick to pure black and white.
<p />
One easy method for generating the mask file is as follows.
<p />
You can just take a motion captured picture, edit it with black and white for the mask and save it as a pgm file.
If you cannot save in this format save as a grayscale jpg and then you can convert it to pgm format with
<p />
<code>djpeg -grayscale -pnm [inputfile] &gt; mask.pgm</code>
<p />
(assuming you have djpeg installed - part of the jpeg lib package).
<p />
Note that the mask file option masks off the detection of motion. The entire picture is still shown on the picture. This means that you cannot use the feature to mask off an area that you do not want people to see.
<p />
Below are an example of a webcam picture and a mask file to prevent the detection cars in the street.
<p />
Normal picture. Notice the street is visible through the hedge.
<p />
<img alt="normal.jpg" src="http://www.lavrsen.dk/twiki/pub/Motion/ConfigOptionMaskFile/normal.jpg" />
<p />
Mask file (converted to png format so it can be shown by your web browser)
<p />
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol twikiLast"> <img alt="mask1.png" src="http://www.lavrsen.dk/twiki/pub/Motion/ConfigOptionMaskFile/mask1.png" /> </td></tr>
</table>
<p />
<p />
<h3><a name="max_mpeg_time"></a> max_mpeg_time </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 (infinite) - 2147483647
</li> <li> Default: 3600
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMaxMpegTime" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The maximum length of an mpeg movie in seconds. Set this to zero for unlimited length.
<p />
<p />
<p />
<!--
Add Additional Description Below 
-->
<p />
<p />
<h3><a name="minimum_gap"></a> minimum_gap </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 2147483647
</li> <li> Default: 0 (no minimum)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMinimumGap" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The minimum time between two shots in seconds. 
<p />
This is the minimum gap between the storing pictures while detecting motion. 
<p />
The value zero means that pictures can be stored almost at the framerate of the camera. Normally you will set this to 0
<p />
This option has nothing to do with the 'gap' option.
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> From motion 3.2.7 this feature has been removed because it was in practical a useless feature. It prevented saving more than one picture per minimum_gap seconds but the capturing and motion detect was still run at full framerate loading the CPU heavily. From 3.2.7 a new feature called <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMinimumFrameTime" class="twikiLink">minimum_frame_time</a> has been introduced which lower the capture rate. So it gives the same effect as minimum_gap did but additionally lower the CPU load significantly.
<p />
<p />
<h3><a name="minimum_motion_frames"></a> minimum_motion_frames </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: 1 - 1000s
</li> <li> Default: 1
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMinimumMotionFrames" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Picture frames must contain motion at least the specified number of frames in a row before they are detected as true motion. At the default of 1, all motion is detected. Valid range is 1 to thousands, but it is recommended to keep it within 1-5.
<p />
Note that the picture frames are buffered by Motion and once motion is detected also the first frames containing motion are saved so you will not miss anything.
<p />
The feature is used when you get many false detections when the camera changes light sensitivity or light changes.
<p />
Experiment for best setting. Even though Motion accepts large values you should set this to a relatively low number (below 10). For each step larger than 1 Motion reserves space in RAM for the picture frame buffer. If you have a large value Motion will miss many frames from the camera while it is processing the all the pictures in the buffer.
<p />
<p />
<h3><a name="night_compensate"></a> night_compensate </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNightCompensate" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
When this option is set the noise threshold will be lowered if the picture is dark. This will improve the sensitivity in dark places. However it might also increase the number of false alarms since most cameras also increase light sensitivity with their AGC (Automatic Gain Control) and this will increase noise.
<p />
It has normally been the advice not to use this with 'noise_tune' turned on. However the latest experience is that with the new improved noise_tune algorithm it actually works fine in combination with 'night_compensate'.
<p />
<p />
<h3><a name="noise_level"></a> noise_level </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 1 - 255
</li> <li> Default: 32
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNoiseLevel" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The noise level is used as a threshold for distinguishing between noise and motion.
<p />
This is different from the threshold parameter. This is changes at pixel level. The purpose is to eliminate the changes generated by electric noise in the camera. Especially in complete darkness you can see the noise as small grey dots that come randomly in the picture. This noise can create false motion detection. What this parameter means is that the intensity of a pixel must change more than +/- the noise threshold parameter to be counted.
<p />
<p />
<h3><a name="noise_tune"></a> noise_tune </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: on
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionNoiseTune" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Activates the automatic tuning of noise level.
<p />
This feature makes Motion continuously adjust the noise threshold for distinguishing between noise and motion. The 'noise_level' setting is ignored when activating this feature. This is a new feature and new algorithm. It may give different results depending on camera and light conditions. Report your experience with it on the Motion mailing list. If it does not work well, deactivate the 'noise_tune' option and use the manual setting of 'noise_level' instead.
<p />
<p />
<h3><a name="output_all"></a> output_all </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOutputAll" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Picture are saved continuously as if motion was detected all the time.
<p />
This feature is not meant to be the normal mode of operation. Especially not if you have the output_normal or output_motion features enabled since it will keep on saving pictures on the disk and you will soon run out of disk space. So be careful with this command.
<p />
If your frame rate is 10 pictures per second motion will save 10 new picture pr second until the disk is full. 
<p />
It does all the normal actions that are done when motion is detected. It saves pictures on the harddisk, execute external scripts, etc as fast as the frame rate of the camera. So it is probably a good idea to run with a low framerate when using this feature and to not use activate all the features that saves files on the disk.
<p />
The idea of this feature is that you can turn the feature on and off for a short period of time to test or to generate continuous mpeg films when needed.
<p />
<p />
<h3><a name="post_capture"></a> post_capture </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 2147483647 
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPostCapture" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Specifies the number of frames to be captured after motion has been detected.
<p />
The purpose of this is mainly to create smooth video clips each time motion is detected. Use it to you personal taste (and disk space)..
<p />
This option is the preferred way to create continuous movies. Post_capture does not consume extra RAM and it does not create pauses in the movie even with large values.
<p />
If you only store mpegs movies and do not have output_normal on, then the recommended post_capture value is what is equivalent to 1-5 seconds of movie.
<p />
<p />
<h3><a name="pre_capture"></a> pre_capture </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 100s
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPreCapture" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Specifies the number of previous frames to be outputted at motion detection. Recommended range: 0 to 5, default=0. Do not use large values! Large values will cause Motion to skip video frames and cause unsmooth mpegs. To smooth mpegs use larger values of post_capture instead.
<p />
Motion buffers the number of picture frames defined by 'pre_capture'. When motion is detected the pictures in the buffer are included in the video clip generated by ffmpeg. The effect is that it seems the program knew in advance that the event was going to take place and started the recording before it actually happened. This is a nice feature that give more complete video clips of an event.
<p />
If pre_capture is set to 0 the feature is disabled. Keep this value below 5.
<p />
The recommended value would be approx 0.5 second of video so the value should be defined so it fits the framerate and the desired pre-capture time. E.g. 0.5 second at 20 frames pr second would mean a value of 5. You should never use a value larger than 10.
<p />
You can in theory have up to 100s of pre-captured frames but naturally this makes motion leave a larger footprint in the memory of the computer. More important Motion is processing all the buffered images including saving jpegs, encoding mpegs, writing to databases and executing external programs after the first image is detected as Motion.
<p />
Motion will not grab another image until this is done. This means that even moderate values for pre_capture combined with high framerates will mean that you will miss quite many frames of Motion. It is therefore recommended to use relative small values for pre_capture. Depending on your chosen framerate and depending on the features enabled values from 1-5 are sensible.
<p />
If you wish to create smooth mpegs during events using large pre_capture values will do the opposite! It will create a long pause where a lot of action is missed.
<p />
To get a smooth mpeg use a large value for <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPostCapture" class="twikiLink">post_capture</a> which does not cost any performance hit or RAM space. 
<p />
<p />
<h3><a name="smart_mask_speed"></a> smart_mask_speed </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 10
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSmartMaskSpeed" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Slugginess of the smart mask. Default is 0 = DISABLED. 1 is slow, 10 is fast.
<p />
Smartmask is a dynamic, self-learning mask. Smartmask will disable sensitivity in areas with frequent motion (like trees in the wind). Sensitivity is turned on again after some time of no more motion in this area. The built mask is a bit larger at the borders than the actual motion was. This way smartmask works more reliable when sudden moves occur under windy conditions.
<p />
smart_mask_speed - tunes the slugginess of the mask. It accepts values from 0 (turned off) to 10 (fast). Fast means here that the mask is built quick, but it is also not staying very long with no more motion. Slow means that it takes a while until the mask is built but it also stays longer. A good start value for smart_mask_speed is 5. This setting is independent from the framerate. The attack and decay time is constant over all available framerates.
<p />
When smartmask is enabled and motion is also configured to either write motion-images or motion-mpegs, the current smartmask is copied as an overlay into the black/white motion-pictures/mpegs in red colour. Same thing happens to the webcam stream when Motion runs in <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSetupMode" class="twikiLink">setup_mode</a>. That way you can easily adjust smart_mask_speed.
<p />
<strong>Detailed Description</strong>
<p />
The <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMaskFile" class="twikiLink">mask_file</a> option provides a static mask to turn off sensitivity in certain areas. This is very usefull to mask a street with cars passing by all day long etc...
<p />
But imagine a scenario with large bushes and big trees where all the leaves are moving in the wind also triggering motion from time to time even with despeckle turned on. Of course you can also define a static mask here, but what if the bushes are growing during spring and summer? Well, you have to adapt the mask from time to time. What if the camera position moves slightly? What if someone grows new plants in your garden? You always have to setup a new static mask.
<p />
The answer to this problem is the smart mask feature introduced in Motion 3.1.18. A dynamic, self-learing mask.
<p />
Smart mask will disable sensitivity in areas with frequent motion (like trees in the wind). Sensitivity is turned on again after some time of no more motion in this area. The built mask is a bit larger at the borders than the actual motion. This way smartmask works more reliably when sudden moves occur under windy conditions.
<p />
<p />
<h3><a name="threshold"></a> threshold </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 1 - 2147483647
</li> <li> Default: 1500
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionThreshold" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Threshold for declaring motion. The threshold is the number of changed pixels counted after noise filtering, masking, despeckle, and labelling.
<p />
The 'threshold' option is the most important detection setting. When motion runs it compares the current image frame with the previous and counts the number of changed pixels after having processed the image with noise filtering, masking, despeckle and labeling. If more pixels than defined by 'threshold' have changed we assume that we have detected motion. Set the threshold as low as possible so that you get the motion you want detected but large enough so that you do not get detections from noise and plants moving. Note that the larger your frames are, the more pixels you have. So for large picture frame sizes you need a higher threshold.
<p />
Use the -s (setup mode) command line option and/or the text_changes config file option to experiment to find the right threshold value. If you do not get small movements detected (see the mouse on the kitchen floor) lower the value. If motion detects too many birds or moving trees, increase the number. Practical values would be from a few hundred to 2000 indoors and 1000-10000 outdoors.
<p />
<p />
<h3><a name="threshold_tune"></a> threshold_tune </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionThresholdTune" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Activates the automatic tuning of threshold level.
<p />
This feature makes Motion continuously adjust the threshold for declaring motion.
<p />
The <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionThreshold" class="twikiLink">threshold</a> setting is ignored when activating this feature. It may give different results depending on your camera, light conditions, indoor/outdoor, the motion to be detected etc. If it does not work well, deactivate the 'threshold_tune' option and use the manual setting of <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionThreshold" class="twikiLink">threshold</a> instead.
<p />
<p />
<h2><a name="Image_File_Output"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ImageFileOutput" class="twikiLink">Image File Output</a> </h2>
The following options controls how Motion generates images when detection motion.
<p />
<p />
<h3><a name="output_motion"></a> output_motion </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOutputMotion" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Output pictures with only the moving object. This feature generates the special motion type movies where you only see the pixels that changes as a graytone image. If labelling is enabled you see the largest area in blue. Smartmask is shown in red.
<p />
Motion images shows the motion content of the pictures. This is good for tuning and testing but probably not very interesting for the general public.
<p />
Default is not to store motion images. Motion pictures are stored the same place and with the same filename as normal motion triggered pictures except they have an "m" appended at the end of the filename before the .jpg or .ppm. E.g. the name can be 01-20020424232936-00m.jpg.
<p />
<p />
<h3><a name="output_normal"></a> output_normal </h3>
<p /> <ul>
<li> Type: Discrete Strings
</li> <li> Range / Valid values: on, off, first, best
</li> <li> Default: on
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOutputNormal" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Normal image is an image that is stored when motion is detected. It is the same image that was taken by the camera. I.e. not a motion image like defined by output_motion. Default is that normal images are stored.
<p />
If you set the value to 'first' Motion saves only the first motion detected picture per event.
<p />
If you set it to "best" Motion saves the picture with most changed pixels during the event. This is useful if you store mpegs on a webserver and want to present a jpeg to show the content of the mpeg on a webpage. "best" requires a little more CPU power and resources compared to "first".
<p />
Set to 'off' to don't write pictures ( jpeg or ppm ).
<p />
<p />
<h3><a name="ppm"></a> ppm </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPpm" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Output ppm images instead of jpeg. This uses less CPU time, but causes a LOT of hard disk I/O, and it is generally slower than jpeg.
<p />
The recommendation is to always use jpg except if you have a specific need to store high quality pictures without any quality loss. For web cameras you should always choose jpg. Note that the built in webcam server requires that this parameter is set to off.
<p />
<p />
<h3><a name="quality"></a> quality </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 1 - 100
</li> <li> Default: 75
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionQuality" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The quality for the jpeg images in percent.
<p />
100 means hardly compressed. A small number means a much smaller file size but also a less nice quality image to look at. 50 is a good compromise for most.
<p />
<p />
<h2><a name="Tuning_Motion"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/TuningMotion" class="twikiLink">Tuning Motion</a> </h2>
<p />
Motion 3.2 introduces a new feature Setup Mode. This is a great new feature with really make tuning all the settings of Motion much more easy and transparent. In setup mode two things happen:
<p /> <ol>
<li> With 'motion -s' Motion runs in console mode instead of daemon. It outputs a lot of useful information for each frame from the camera. Each message is prefixed by [number] where number is the camera number (thread number).
</li> <li> When you look at the mjpeg webcam stream you see a black image with numbers. What you see is the number of changed pixels, number of labeled areas and noise setting. When something moves you see the pixels detected as Motion in black and white. The largest labelled area (assuming despeckle is enabled and with the 'l' at the end) is blue. It is only the blue areas which is counted as Motion. If smartmask is enabled you see this as red areas.
</li></ol> 
<p />
Here is a suggestion how to initially setup Motion.
<p /> <ul>
<li> Disable despeckle (comment it out in motion.conf).
</li> <li> Disable smartmask
</li> <li> Enable both http control and webcam by setting port numbers. Example 8080 for control and 8081 for webcam.
</li> <li> Start Motion in setup mode
</li> <li> View the webcam stream. Either with Cambozola or with Firefox. <a href="http://localhost:8081/" rel="nofollow" target="_top">http://localhost:8081/</a> Firefox often needs to reload the page before it works. Bug in Firefox. Internet Explorer cannot show the stream unless you make a webpage on your Apache with Cambozola applet.
</li> <li> Open new browser window and connect to the http interface. <a href="http://localhost:8080/" rel="nofollow" target="_top">http://localhost:8080/</a> . You can now control and change almost anything while Motion is running. You cannot resize the image. That was too hard to code. To disable a feature enter a space.
</li> <li> Start by experimenting with noise level. Do this both during daylight and during darkness. You will be surprised to see how much noise a camera makes during night. Try using the automatic noise feature. It should work for most.
</li> <li> Now try the despeckle feature. Enable it using the recommended default EedDl. If this is not enough experiment. Remember that the l must be the last letter. It is fun to play with.
</li> <li> Set the threshold to what you want to trigger Motion.
</li></ul> 
<p />
In normal mode you can use the same setting with two browser windows and experiment with settings of the camera if needed.
<p />
From the web interface you can ask Motion to write all your changes back to the config files (motion.conf and thread config files). It will even tidy them up for you so they look nice.
<p />
There are two sets of options to adjust. <ul>
<li> The options that controls the camera device: See <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/CaptureDeviceOptions" class="twikiLink">CaptureDeviceOptions</a>
</li> <li> The options that controls the actual motion detection: <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionDetectionSettings" class="twikiLink">MotionDetectionSettings</a>
</li></ul> 
<p />
<hr />
<p />
Normal picture frame
<p />
<img alt="outputnormal1.jpg" src="http://www.lavrsen.dk/twiki/pub/Motion/TuningMotion/outputnormal1.jpg" />
<p />
<hr />
Motion type picture frame with despeckle. Note that the largest area is blue and only this is counted as Motion.
<p />
The Motion image shows how Motion maintains a "reference frame" which is not just the last picture frame but a matematical calculation of the past images. This enlarges real Motion and ensures that it is not easy to sneak in slowly.
<p />
<img alt="outputmotion1.jpg" src="http://www.lavrsen.dk/twiki/pub/Motion/TuningMotion/outputmotion1.jpg" />
<hr />
<p />
<p />
<h2><a name="Generating_MPEG_films_with_ffmpe"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MpegFilmsFFmpeg" class="twikiLink">Generating MPEG films with ffmpeg</a> </h2>
The ffmpeg option can generate mpeg films very fast and "on the fly". This means that the mpeg film is growing each time motion is detected.
<p />
Some people on the Motion mailing list have had trouble building the ffmpeg package because they did not have the NASM assembler package installed. So pay attention to this if you run into problems.
<p />
ffmpeg exists as binary packages for most distributions including RPMs and debian packages.
<p />
Ffmpeg is an interesting project. The releases have not been very consistent over time. The official releases are out of date now. So we are forced to take our chance and checkout a version from their CVS server and hope that we are lucky in getting a version that works. See <a href="http://ffmpeg.sourceforge.net" rel="nofollow" target="_top">ffmpeg project page</a>. We encourage the maintaners of such an important project to introduce better release schedules in the near future for the benefit of opensource software.
<p />
In order to help people finding a version of ffmpeg that works we have started testing the Motion package with a selection of binaries and a CVS snapshot. The CVS source snapshot of ffmpeg which is certified with Motion is available on the <a href="http://sourceforge.net/project/showfiles.php?group_id=13468&amp;package_id=116390" rel="nofollow" target="_top">Related projects file area on the Motion Sourceforge project</a> 
<p />
Motion works with the following versions of ffmpeg: <ul>
<li> ffmpeg-0.4.8. With this release Motion supports mpeg1, mpeg4 and msmpeg4. Lately newer distributions have problems building this 2003 release of ffmpeg so many of you no longer have this option.
</li> <li> ffmpeg-0.4.9pre1. Is supported starting from Motion version 3.1.18. With this release Motion supports mpeg4 and msmpeg4 but not mpeg1. The reason is that the ffmpeg team has decided no longer to support non-standard framerates in their mpeg1 encoder library. Also ffmpeg-0.4.9pre1 gives people problems on newer distributions.
</li> <li> ffmpeg from CVS. This may work. We cannot continuously monitor and try every time a new source file is checked into ffmpeg. You will have to try.
</li> <li> ffmpeg RPMs. Currently each Motion release is tested with the current Livna ffmpeg rpm package for Fedora. See the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/DownloadFiles" class="twikiLink">Download Files</a> page for direct links to the version which has been certified with the latest Motion release.
</li> <li> ffmpeg debian binaries. Latest versions from the debian repository for Debian Sarge works fine with Motion.
</li> <li> Certified ffmpeg CVS snapshot for latest Motion release is available from the <a href="http://sourceforge.net/project/showfiles.php?group_id=13468&amp;package_id=116390" rel="nofollow" target="_top">Motion Sourceforge Related Projects file area</a>
</li></ul> 
<p />
The timelapse feature always runs mpeg1 with both ffmpeg 0.4.8 and 0.4.9 and newer. Motion simply creates the timelapse film with a standard mpeg1 framerate. <font color="#ff0000"> Note : maximum size for timelapse files is 2GB. </font>
<p />
In principle Motion can be made to support many other formats. It requires additional coding in Motion. You are welcome to submit <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionPatches" class="twikiLink">patches</a>. All ffmpeg related code is in the source file ffmpeg.c. It is not trivial to do because the ffmpeg libraries not documented at all. All you have is a couple of code examples.
<p />
To build ffpmeg from source follow these steps:
<p />
Download the ffmpeg and untar it to /usr/local/ffmpeg. Then it should be a simple matter of entering the ffmpeg directory and run the commands
<p />
<pre>
cd /usr/local/ffmpeg
./configure --enable-shared
make
make install
</pre>
<p />
This creates the <code>libavcodec.so</code> and <code>libavformat.so</code> libraries under <code>/usr/local/lib</code> and header files under <code>/usr/local/include/ffmpeg</code>.
<p />
You probably need to do one more step.
<p />
Make sure you have 'root' privileges for the next steps.
<p />
Open the file <code>/etc/ld.so.conf</code> in your favorite text editor.
<p />
Add this line of text if it is not already there - otherwise go to the next step (ldconfig).
<p />
<code>/usr/local/lib</code>
Run the command <code>ldconfig</code>.
<p />
Motion should now be able to find the shared libraries for ffmpeg (<code>libavcodec.so</code> and <code>libavformat.so</code>) in <code>/usr/local/lib</code>.
<p />
You can also find a pre-compiled binary package (e.g. rpm or deb) and install this. Normally an rpm will place the <code>libavcodec.so</code> under <code>/usr/lib</code>.
There are various RPMs available from different repositories. Some need additional RPMs that are actually not needed by Motion but need to be installed to satisfy dependencies. The editor has tried different RPMs of ffmpeg-0.4.8 and they all seem to work.
<p />
Motion then need to be built by running <code>./configure</code>, <code>make</code> and <code>make install</code>.
(Note that with earlier versions of motion you had to specify the location of libavcodec. Now configure searches for the shared library in <code>/usr/lib</code> and <code>/usr/local/lib</code> by default.)
<p />
Note that if you install ffmpeg from source and already have ffmpeg installed from an RPM, the Motion configure may very well find the binary library from the rpm instead of the sources. Make sure to uninstall any old ffmpeg RPMs before you install ffmpeg from sources. 
<p />
<strong>These are the config file options related to ffmpeg.</strong>
<p />
<p />
<h3><a name="ffmpeg_bps"></a> ffmpeg_bps </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 9999999
</li> <li> Default: 400000
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegBps" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Bitrate of mpegs produced by ffmpeg. Bitrate is bits per second. Default: 400000 (400kbps). Higher value mans better quality and larger files. Option requires that ffmpeg libraries are installed.
<p />
To use this feature you need to install the <a href="http://ffmpeg.sourceforge.net/" rel="nofollow" target="_top">FFmpeg Streaming Multimedia System</a>.
<p />
Experiment to get the desired quality. The better quality the bigger files. This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled).
<p />
<p />
<h3><a name="ffmpeg_cap_motion"></a> ffmpeg_cap_motion </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegCapMotion" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Use ffmpeg libraries to encode motion type mpeg movies where you only see the pixels that changes.
<p />
Works like ffmpeg_cap_new but outputs motion pixel type pictures instead.
<p />
This feature generates the special motion type movie where you only see the pixels that changes as a graytone image. If labelling is enabled you see the largest area in blue. Smartmask is shown in red. The filename given is the same as the normal mpegs except they have an 'm' appended after the filename before the .mpg. E.g. 20040424181525m.mpg
<p />
To use this feature you need to install the FFmpeg Streaming Multimedia System
<p />
<p />
<h3><a name="ffmpeg_cap_new"></a> ffmpeg_cap_new </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegCapNew" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Use ffmpeg libraries to encode mpeg movies in realtime.
<p />
Generates a new film at the beginning of each new event and appends to the film for each motion detected within the same event. The current event ends when the time defined by the 'gap' option has passed with no motion detected. At the next detection of motion a new mpeg film is started.
<p />
To use this feature you need to install the <a href="http://ffmpeg.sourceforge.net/" rel="nofollow" target="_top">FFmpeg Streaming Multimedia System</a>
<p />
Must not be included in config file without having ffmpeg installed.
<p />
<p />
<h3><a name="ffmpeg_deinterlace"></a> ffmpeg_deinterlace </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegDeinterlace" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Use ffmpeg to deinterlace video. Necessary if you use an analog camera and see horizontal combing on moving objects in video or pictures. 
<p />
To use this feature you need to install the <a href="http://ffmpeg.sourceforge.net/" rel="nofollow" target="_top">FFmpeg Streaming Multimedia System</a>
<p />
Must not be included in config file without having ffmpeg installed.
<p />
<p />
<!--
Add Additional Description Below 
-->
<p />
<p />
<h3><a name="ffmpeg_timelapse"></a> ffmpeg_timelapse </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: 0 - 2147483647
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegTimelapse" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Create a timelapse movie saving a picture frame at the interval in seconds set by this parameter. Set it to 0 if not used.
<p />
This feature uses ffmpegs libavcodec to encode a timelaps movie saving a picture frame at the interval in seconds set by this parameter. Setting this option to 0 disables it.
<p />
The feature gives your viewer the chance to watch the day pass by. It makes a nice effect to film flowers etc closeup during the day. Options like frame_rate, snapshot, gap etc have no impact on the ffmpeg timelapse function.
<p />
Note that the timelapse format is always mpeg1 independent of ffmpeg_video_codec. This is because mpeg1 allows the timelapse to stop and the file to be reopened and more film appended.
<p />
To use this feature you need to install the <a href="http://ffmpeg.sourceforge.net/" rel="nofollow" target="_top">FFmpeg Streaming Multimedia System</a>.
<p />
(renamed from ffmpeg_timelaps to ffmpeg_timelapse in 3.1.14)
<p />
<p />
<h3><a name="ffmpeg_timelapse_mode"></a> ffmpeg_timelapse_mode </h3>
<p /> <ul>
<li> Type: Discrete Strings
</li> <li> Range / Valid values: hourly, daily, weekly-sunday, weekly-monday, monthly, manual
</li> <li> Default: daily
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegTimelapseMode" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The file rollover mode of the timelapse video.
<p />
Note that it is important that you use the conversion specifiers in ffmpeg_filename that ensure that the new timelapse file indeed is a new file. If the filename does not change Motion will simply append the timelapse pictures to the existing file.
<p />
The value 'Manual' means that Motion does not automatically rollover to a new filename. You can do it manually using the http control interface by setting the option 'ffmpeg_timelapse' to 0 and then back to your chosen value. Value 'hourly' rolls over on the full hour. Value 'daily' which is the default rolls over at midnight. There are two weekly options because depending on where you come from a week may either start on Sunday or Monday. And 'monthly' naturally rolls over on the 1st of the month.
<p />
<p />
<h3><a name="ffmpeg_variable_bitrate"></a> ffmpeg_variable_bitrate </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0, 2 - 31
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegVariableBitrate" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Enables and defines variable bitrate for the ffmpeg encoder. ffmpeg_bps is ignored if variable bitrate is enabled. Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, or the range 2 - 31 where 2 means best quality and 31 is worst.
<p />
Experiment for the value that gives you the desired compromise between size and quality.
<p />
<p />
<h3><a name="ffmpeg_video_codec"></a> ffmpeg_video_codec </h3>
<p /> <ul>
<li> Type: Discrete Strings
</li> <li> Range / Valid values: mpeg1 (ffmpeg-0.4.8 only), mpeg4, msmpeg4, swf, flv, ffv1
</li> <li> Default: mpeg4
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegVideoCodec" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Codec to be used by ffmpeg for the video compression. Timelapse mpegs are always made in mpeg1 format independent from this option.
<p />
mpeg1 gives you files with extension .mpg. It is only supported by the old ffmpeg version 0.4.8. The ffmpeg team decided no longer to support non-standard framerates for mpeg1 from ffmpeg version 0.4.9pre1.
<p />
mpeg4 or msmpeg4 give you files with extension .avi
<p />
msmpeg4 is recommended for use with Windows Media Player because it requires with no installation of codec on the Windows client.
<p />
swf gives you a flash film with extension .swf
<p />
flv gives you a flash video with extension .flv
<p />
ffv1 , FF video codec 1 for Lossless Encoding ( experimental )
<p />
This option does not affect the timelapse feature. Timelapse is always recorded in mpeg1 format because we need to be able to append to an existing file. mpeg4 does not easily allow this.
<p />
<p />
<hr />
<p />
See also the section <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/AdvancedFilenames" class="twikiLink">Advanced Filenames</a> where the two additional options <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegFilename" class="twikiLink">ffmpeg_filename</a> and <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTimelapseFilename" class="twikiLink">timelapse_filename</a> are defined.
<p />
If you want to use this feature you can read about the <a href="http://ffmpeg.sourceforge.net/" rel="nofollow" target="_top">FFmpeg Streaming Multimedia System</a>
<p />
<p />
<h2><a name="Snapshots_The_Traditional_Period"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/SnapshotsWebCam" class="twikiLink">Snapshots - The Traditional Periodic Web Camera</a> </h2>
Motion can also act like a traditional web camera.
<p />
<p />
<h3><a name="snapshot_interval"></a> snapshot_interval </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 2147483647
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSnapshotInterval" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Make automated snapshots every 'snapshot_interval' seconds.
<p />
The snapshots are stored in the target directory + the directory/filename specified by the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSnapshotFilename" class="twikiLink">snapshot_filename</a> option.
<p />
This is the traditional web camera feature where a picture is taken at a regular interval independently of motion in the picture.
<p />
<p />
See the also <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSnapshotFilename" class="twikiLink">snapshot_filename</a> option in the section <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/AdvancedFilenames" class="twikiLink">Advanced Filenames</a>.
<p />
<p />
<h2><a name="Text_Features"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/TextFeatures" class="twikiLink">Text Features</a> </h2>
Text features are highly flexible. You can taylor the text displayed on the images and films to your taste and you can add your own user defined text.
<p />
This is how the overlayed text is located.
<p />
<table border="1" width="354">
    <tr>
        <td width="344">
            <table cellpadding="0" cellspacing="0" width="344">
                <tr>
                    <td width="216">
                        <p>&nbsp;&nbsp;<br><br><br><br><br><br>&nbsp;</p>
                    </td>
                    <td width="128">
                        <p align="right">&nbsp;CHANGES<br><br><br><br><br><br>&nbsp;</p>
                    </td>
                </tr>
                <tr>
                    <td width="216">
                        <p><br><br>TEXT_LEFT</p>
                    </td>
                    <td width="128">
                        <p align="right">TEXT_RIGHT<br>YYYY-MM-DD<br>HH:MM:SS&nbsp;</p>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<p />
You are allowed to put the text in quotation marks. This allows you to use leading spaces. By combining spaces and new lines '\n' you can place your text anywhere on the picture. Experiment to find your preferred look. When setting the text using http remote control the text must be URL encoded. The browser does this for you. If you need to set it with a command line tool, use a browser first and let it make the encoded URL for you. Then you can copy paste it to your script file or cron line or whatever you want to use.
<p />
Below are the options that controls the display of text. The 'locate' option is not a text feature but described here because it is related to information overlayed on the output images.
<p />
The <code>text_event</code> feature is special in that it defines the conversion specifier %C which can be used both for text display and for filenames.
<p />
<p />
<h3><a name="locate"></a> locate </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off, preview
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionLocate" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Locate and draw a box around the moving object. Value 'preview' makes Motion only draw a box on a saved preview jpeg image and not on the saved mpeg movie. 
<p />
The value 'preview' only works when 'output_normal' is set to either 'first' or 'best'.
<p />
<p />
<h3><a name="text_changes"></a> text_changes </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTextChanges" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Turns the text showing changed pixels on/off.
<p />
By setting this option to 'on' the number of pixels that changed compared to the reference frame is displayed in the upper right corner of the pictures. This is good for calibration and test. Maybe not so interesting for a greater public. Set it to your personal taste.
<p />
<p />
<h3><a name="text_double"></a> text_double </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li></ul> 
<p />
Draw characters at twice normal size on images.
<p />
This option makes the text defined by text_left, text_right and text_changes twice the normal size. This may be useful when using large picture formats such as 640 x 480.
<p />
<!--
Add Additional Description Below 
-->
<p />
<p />
<h3><a name="text_event"></a> text_event </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: %Y%m%d%H%M%S
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTextEvent" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
This option defines the value of the speciel event conversion specifier %C. You can use any conversion specifier in this option except %C. Date and time values are from the timestamp of the first image in the current event.
<p />
The idea is that %C can be used filenames and text_left/right for creating a unique identifier for each event. 
<p />
Option text_event defines the value %C which then can be used in filenames and text_right/text_left. The text_event/%C uses the time stamp for the first image detected in a new event. %C is an empty string when no event is in progress (gap period expired). Pre_captured and minimum_motion_frames images are time stamped before the event happens so %C in text_left/right does not have any effect on those images.
<p />
<p />
<h3><a name="text_left"></a> text_left </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTextLeft" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
User defined text overlayed on each in the lower left corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # &lt; &gt; \ , . : - + _ \n and <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> (codes starting by a %).
<p />
text_left is displayed in the lower left corner of the pictures. If the option is not defined no text is displayed at this position.
<p />
You can place the text in quotation marks to allow leading spaces. With a combination is spaces and newlines you can position the text anywhere on the picture.
<p />
<strong>Detailed Description</strong>
<p />
A conversion specifier is a code that starts by % (except newline which is \n). The <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> used has the same function as for the C function strftime (3). The most commonly used are: <ul>
<li> %Y = year
</li> <li> %m = month as two digits
</li> <li> %d = date
</li> <li> %H = hour
</li> <li> %M = minute
</li> <li> %S = second
</li> <li> %T = HH:MM:SS
</li></ul> 
<p />
These are unique to motion  <ul>
<li> %v = event
</li> <li> %q = frame number
</li> <li> %t = thread (camera) number
</li> <li> %D = changed pixels
</li> <li> %N = noise level
</li> <li> %i = width of motion area
</li> <li> %J = height of motion area
</li> <li> %K = X coordinate of motion center
</li> <li> %L = Y coordinate of motion center
</li> <li> %C = value defined by text_event 
</li></ul> 
<p />
With a combination of text, spaces, new lines \n and conversion specifiers you have some very flexible text features. 
<p />
For a full list of conversion specifiers see the section <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> for Advanced Filename and Text Feature.
<p />
<p />
<h3><a name="text_right"></a> text_right </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: %Y-%m-%d\n%T
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTextRight" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
User defined text overlayed on each in the lower right corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # &lt; &gt; , . : - + _ \n and <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> (codes starting by a %). Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock
<p />
text_right is displayed in the lower right corner of the pictures. If the option is not defined no text is displayed at this position.
<p />
You can place the text in quotation marks to allow leading spaces. With a combination is spaces and newlines you can position the text anywhere on the picture.
<p />
A major difference from text_left is that if this option is undefined the default is %Y-%m-%d\n%T which displays the date in ISO format YYYY-MM-DD and below the time in 24 hour clock HH:MM:SS.
<p />
<strong>Detailed Description</strong>
<p />
A conversion specifier is a code that starts by % (except newline which is \n). The <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> used has the same function as for the C function strftime (3). The most commonly used are: <ul>
<li> %Y = year
</li> <li> %m = month as two digits
</li> <li> %d = date
</li> <li> %H = hour
</li> <li> %M = minute
</li> <li> %S = second
</li> <li> %T = HH:MM:SS
</li></ul> 
<p />
These are unique to motion  <ul>
<li> %v = event
</li> <li> %q = frame number
</li> <li> %t = thread (camera) number
</li> <li> %D = changed pixels
</li> <li> %N = noise level
</li> <li> %i = width of motion area
</li> <li> %J = height of motion area
</li> <li> %K = X coordinate of motion center
</li> <li> %L = Y coordinate of motion center
</li> <li> %C = value defined by text_event 
</li></ul> 
<p />
With a combination of text, spaces, new lines \n and conversion specifiers you have some very flexible text features. 
<p />
For a full list of conversion specifiers see the section <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> for Advanced Filename and Text Feature.
<p />
<p />
<h2><a name="Advanced_Filenames"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/AdvancedFilenames" class="twikiLink">Advanced Filenames</a> </h2>
Motion has a very advanced and flexible automated filenaming feature.
<p />
By using <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> (codes that consist of a '%' followed by a letter) you can build up the filenames including sub directories for pictures and movies using any combination of letters, numbers and conversion specifiers which are codes that represents time, date, event number and frame numbers.
<p />
The option <code>target_dir</code> is the target directory for all snapshots, motion images and normal images. The default is the current working directory (current working directory of the terminal from which motion was started). You will normally always want to specify this parameter.
<p />
Note that the options <code>snapshot_filename</code>, <code>jpeg_filename</code>, <code>ffmpeg_filename</code>, and <code>timelapse_filename</code> all allow specifying directories by using '/' in the filename. These will all be relative to <code>target_dir</code>. This means in principle that you can specify <code>target_dir</code> as '/' and be 100% flexible. It also means that Motion can write files all over your harddisk if you make a mistake. It is recommended to specify the <code>target_dir</code> as deep or detailed as possible for this reason. And note that <code>targer_dir</code> does not allow conversion specifiers.
<p />
The conversion specifier %C which is defined by the option <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTextEvent" class="twikiLink">text_event</a> is interesting in connection with filenames because it can be used to create files and directories for each event in a very flexible way.
<p />
The convertion specifier %t (thread/camera number) is also very useful. Here is an example of filename definitions in motion.conf:
<p />
<pre>
target&#95;dir /usr/local/webcam
snapshot&#95;filename cam&#37;t/&#37;v-&#37;Y&#37;m&#37;d&#37;H&#37;M&#37;S-snapshot
jpeg&#95;filename cam&#37;t/&#37;v-&#37;Y&#37;m&#37;d&#37;H&#37;M&#37;S-&#37;q
ffmpeg&#95;filename cam&#37;t/&#37;v-&#37;Y&#37;m&#37;d&#37;H&#37;M&#37;S
timelapse&#95;filename cam&#37;t/&#37;Y&#37;m&#37;d&#37;H-timelapse
</pre>
<p />
The smart thing is that this defines the filename of all your camera threads in motion.conf so you do not need to specify target dir and filenames in the thread config files. In the above example an mpegfile for camera thread 3 will be saved as a filename similar to <code>/usr/local/webcam/cam3/28-20051128130840.avi</code>
<p />
NOTE: Unless you use the <code>minimum_gap</code> option to limit the number of shots to less then one per second - you must use the frame modifier %q as part of the <code>jpeg_filename</code>. Otherwise the pictures saved within the same second will overwrite each other. The %q in <code>jpeg_filename</code> ensures that each jpeg (or ppm) picture saved gets a unique filename.
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> Security Warning! Note that the flexibility of this feature also means you have to pay attention to the following. <ul>
<li> Anyone with access to the remote control port (http) can alter the values of these options and save files anywhere on your server with the same privileges as the user running Motion. Anyone can access your control port if you have not either limited access to localhost or limited access using firewalls in the server. You should always have a router between a machine running Motion with remote control enabled and the Internet and make sure the Motion control port is not accessible from the outside.
</li> <li> Anyone with local access to the computer and edit rights to the motion.conf file can alter the values of these options and save files anywhere on your server with the same privileges as the user running Motion. Make sure the motion.conf file is maximum readonly to anyone else but the user running Motion.
</li> <li> It is a good idea to run Motion as a harmless user. Not as root.
</li></ul> 
<p />
<strong>These are the advanced filename options in motion.conf</strong>
<p />
<p />
<h3><a name="ffmpeg_filename_now_called_movie"></a> ffmpeg_filename (now called movie_filename) </h3>
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> <font color="#ff0000">This option was renamed to <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMovieFilename" class="twikiLink">movie_filename</a> in 3.2.5 to enable better integration of alternative movie libraries to the current ffmpeg solution.</font>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: %v-%Y%m%d%H%M%S
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFfmpegFilename" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
File path for motion triggered ffmpeg movies (mpeg) relative to target_dir. This option was renamed to movie_filename in 3.2.5 to enable better integration of alternative movie libraries to the current ffmpeg solution.
<p />
Default value is equivalent to legacy 'oldlayout' option
For Motion 3.0 compatible mode (directories based on date and time) choose: %Y/%m/%d/%H%M%S
<p />
File extension .mpg or .avi is automatically added so do not include this.
<p />
This option uses <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: <ul>
<li> %Y = year
</li> <li> %m = month as two digits
</li> <li> %d = date
</li> <li> %H = hour
</li> <li> %M = minute
</li> <li> %S = second
</li> <li> %T = HH:MM:SS
</li></ul> 
<p />
These are unique to motion  <ul>
<li> %v = event
</li> <li> %q = frame number
</li> <li> %t = thread (camera) number
</li> <li> %D = changed pixels
</li> <li> %N = noise level
</li> <li> %i = width of motion area
</li> <li> %J = height of motion area
</li> <li> %K = X coordinate of motion center
</li> <li> %L = Y coordinate of motion center
</li> <li> %C = value defined by text_event 
</li></ul> 
<p />
If you are happy with the directory structures the way they were in earlier versions of motion use %v-%Y%m%d%H%M%S for 'oldlayout on' and %Y/%m/%d/%H%M%S for 'oldlayout off'.
<p />
<p />
<h3><a name="jpeg_filename"></a> jpeg_filename </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: %v-%Y%m%d%H%M%S-%q
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionJpegFilename" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
File path for motion triggered images (jpeg or ppm) relative to target_dir. Value 'preview' makes a jpeg filename with the same name body as the associated saved mpeg movie file.
<p />
Default value is equivalent to legacy 'oldlayout' option. For Motion 3.0 compatible mode (directories based on date and time) choose: %Y/%m/%d/%H/%M/%S-%q
<p />
This option uses <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: <ul>
<li> %Y = year
</li> <li> %m = month as two digits
</li> <li> %d = date
</li> <li> %H = hour
</li> <li> %M = minute
</li> <li> %S = second
</li> <li> %T = HH:MM:SS
</li></ul> 
<p />
These are unique to motion  <ul>
<li> %v = event
</li> <li> %q = frame number
</li> <li> %t = thread (camera) number
</li> <li> %D = changed pixels
</li> <li> %N = noise level
</li> <li> %i = width of motion area
</li> <li> %J = height of motion area
</li> <li> %K = X coordinate of motion center
</li> <li> %L = Y coordinate of motion center
</li> <li> %C = value defined by text_event 
</li></ul> 
<p />
If you are happy with the directory structures the way they were in earlier versions of motion use %v-%Y%m%d%H%M%S-%q for 'oldlayout on' and %Y/%m/%d/%H/%M/%S-%q for 'oldlayout off'.
<p />
The value 'preview' only works when 'output_normal' is set to 'best'. It makes Motion name the best preview jpeg file (image with most changed pixels during the event) with the same body name as the mpeg movie created during the same event. The purpose is to create a good single image that represents the saved mpeg moview so you can decide if you want to see it and spend time downloading it from a web page.
<p />
<p />
<h3><a name="movie_filename"></a> movie_filename </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: %v-%Y%m%d%H%M%S
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMovieFilename" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
File path for motion triggered ffmpeg movies (mpeg) relative to target_dir. This was previously called ffmpeg_filename.
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> This option was renamed from ffmpeg_filename to movie_filename in Motion 3.2.5.
<p />
Default value is equivalent to legacy 'oldlayout' option
For Motion 3.0 compatible mode (directories based on date and time) choose: %Y/%m/%d/%H%M%S
<p />
File extension .mpg or .avi is automatically added so do not include this.
<p />
This option uses <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: <ul>
<li> %Y = year
</li> <li> %m = month as two digits
</li> <li> %d = date
</li> <li> %H = hour
</li> <li> %M = minute
</li> <li> %S = second
</li> <li> %T = HH:MM:SS
</li></ul> 
<p />
These are unique to motion  <ul>
<li> %v = event
</li> <li> %q = frame number
</li> <li> %t = thread (camera) number
</li> <li> %D = changed pixels
</li> <li> %N = noise level
</li> <li> %i = width of motion area
</li> <li> %J = height of motion area
</li> <li> %K = X coordinate of motion center
</li> <li> %L = Y coordinate of motion center
</li> <li> %C = value defined by text_event 
</li></ul> 
<p />
If you are happy with the directory structures the way they were in earlier versions of motion use %v-%Y%m%d%H%M%S for 'oldlayout on' and %Y/%m/%d/%H%M%S for 'oldlayout off'.
<p />
<p />
<h3><a name="snapshot_filename"></a> snapshot_filename </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: %v-%Y%m%d%H%M%S-snapshot
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSnapshotFilename" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
File path for snapshots (jpeg or ppm) relative to target_dir.
<p />
Default value is equivalent to legacy 'oldlayout' option. For Motion 3.0 compatible mode (directories based on date and time) choose: %Y/%m/%d/%H/%M/%S-snapshot
<p />
File extension .jpg or .ppm is automatically added so do not include this
A symbolic link called lastsnap.jpg (or lastsnap.ppm) created in the target_dir will always point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap'
<p />
This option uses <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: <ul>
<li> %Y = year
</li> <li> %m = month as two digits
</li> <li> %d = date
</li> <li> %H = hour
</li> <li> %M = minute
</li> <li> %S = second
</li> <li> %T = HH:MM:SS
</li></ul> 
<p />
These are unique to motion  <ul>
<li> %v = event
</li> <li> %q = frame number
</li> <li> %t = thread (camera) number
</li> <li> %D = changed pixels
</li> <li> %N = noise level
</li> <li> %i = width of motion area
</li> <li> %J = height of motion area
</li> <li> %K = X coordinate of motion center
</li> <li> %L = Y coordinate of motion center
</li> <li> %C = value defined by text_event 
</li></ul> 
<p />
If you are happy with the directory structures the way they were in earlier versions of motion use %v-%Y%m%d%H%M%S-snapshot for 'oldlayout on' and %Y/%m/%d/%H/%M/%S-snapshot for 'oldlayout off'.
<p />
For the equivalent of the now obsolete option 'snap_overwrite' use the value 'lastsnap'.
<p />
<p />
<h3><a name="target_dir"></a> target_dir </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined = current working directory
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTargetDir" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Target directory for picture and movie files.
<p />
This is the target directory for all snapshots, images files and movie files. The default is the current working directory (current working directory of the terminal from which motion was started). You will normally always want to specify this parameter as an absolute path.
<p />
Note that the options snapshot_filename, jpeg_filename, ffmpeg_filename, and timelapse_filename all allows specifying directories. These will all be relative to 'target_dir'. This means in principle that you can specify target_dir as '/' and be 100% flexible. It also means that Motion can write files all over your harddisk if you make a mistake. It is recommended to specify the target_dir as deep or detailed as possible for this reason.
<p />
<p />
<h3><a name="timelapse_filename"></a> timelapse_filename </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: %v-%Y%m%d-timelapse
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTimelapseFilename" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
File path for timelapse mpegs relative to target_dir (ffmpeg only).
<p />
Default value is equivalent to legacy 'oldlayout' option.
<p />
For Motion 3.0 compatible mode (directories based on date and time) choose: %Y/%m/%d-timelapse
<p />
File extension .mpg is automatically added so do not include this.
<p />
This option uses <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: <ul>
<li> %Y = year
</li> <li> %m = month as two digits
</li> <li> %d = date
</li> <li> %H = hour
</li> <li> %M = minute
</li> <li> %S = second
</li> <li> %T = HH:MM:SS
</li></ul> 
<p />
These are unique to motion  <ul>
<li> %v = event
</li> <li> %q = frame number
</li> <li> %t = thread (camera) number
</li> <li> %D = changed pixels
</li> <li> %N = noise level
</li> <li> %i = width of motion area
</li> <li> %J = height of motion area
</li> <li> %K = X coordinate of motion center
</li> <li> %L = Y coordinate of motion center
</li> <li> %C = value defined by text_event 
</li></ul> 
<p />
If you are happy with the directory structures the way they were in earlier versions of motion use %v-%Y%m%d-timelapse for 'oldlayout on' and %Y/%m/%d-timelapse for 'oldlayout off'.
<p />
<p />
<h2><a name="Conversion_Specifiers_for_Advanc"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers for Advanced Filename and Text Features</a> </h2>
The table below shows all the supported Conversion Specifiers you can use in the options <code>text_event</code>, <code>text_left</code>, <code>text_right</code>, <code>sql_query</code>, <code>snapshot_filename</code>, <code>jpeg_filename</code>, <code>ffmpeg_filename</code>, <code>timelapse_filename</code>, <code>on_event_start</code>, <code>on_event_end</code>, <code>on_picture_save</code>, <code>on_movie_start</code>, <code>on_movie_end</code>, and <code>on_motion_detected</code>.
<p />
In <code>text_left</code> and <code>text_right</code> you can additionally use '\n' for new line.
<p />
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=0;table=11;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Conversion Specifier</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=1;table=11;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Description</a> </th></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %a </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The abbreviated weekday name according to the current locale. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %A </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The full weekday name according to the current locale. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %b </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The abbreviated month name according to the current locale. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %B </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The full month name according to the current locale. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %c </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The preferred date and time representation for the current locale. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %C </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> Text defined by the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTextEvent" class="twikiLink">text_event</a> feature </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %d </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The day of the month as a decimal number (range 01 to 31). </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %D </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> Number of pixels detected as Motion. If labelling is enabled the number is the number of pixels in the largest labelled motion area. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %E </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> Modifier: use alternative format, see below. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %f </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> File name - used in the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnPictureSave" class="twikiLink">on_picture_save</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnMovieStart" class="twikiLink">on_movie_start</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnMovieEnd" class="twikiLink">on_movie_end</a>, and <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlQuery" class="twikiLink">sql_query</a> features. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %F </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> Equivalent to %Y-%m-%d (the ISO 8601 date format). </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %H </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The hour as a decimal number using a 24-hour clock (range 00 to 23). </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %i </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> Width of the rectangle containing the motion pixels (the rectangle that is shown on the image when <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionLocate" class="twikiLink">locate</a> is on). </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %I </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The hour as a decimal number using a 12-hour clock (range 01 to 12). </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %j </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The day of the year as a decimal number (range 001 to 366). </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %J </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> Height of the rectangle containing the motion pixels (the rectangle that is shown on the image when <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionLocate" class="twikiLink">locate</a> is on). </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %k </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The hour (24-hour clock) as a decimal number (range 0 to 23); single digits are preceded by a blank. (See also %H.) </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %K </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> X coordinate in pixels of the center point of motion. Origin is upper left corner. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %l </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The hour (12-hour clock) as a decimal number (range 1 to 12); single digits are preceded by a blank. (See also %I.) </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %L </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> Y coordinate in pixels of the center point of motion. Origin is upper left corner and number is positive moving downwards (I may change this soon). </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %m </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The month as a decimal number (range 01 to 12). </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %M </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The minute as a decimal number (range 00 to 59). </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %n </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> Filetype as used in the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnPictureSave" class="twikiLink">on_picture_save</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnMovieStart" class="twikiLink">on_movie_start</a>, <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnMovieEnd" class="twikiLink">on_movie_end</a>, and <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlQuery" class="twikiLink">sql_query</a> features. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %N </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> Noise level. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %o </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> Threshold. The number of detected pixels required to trigger motion. When <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionThresholdTune" class="twikiLink">threshold_tune</a> is 'on' this can be used to show the current tuned value of threshold. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %p </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> Either 'AM' or 'PM' according to the given time value, or the corresponding strings for the current locale. Noon is treated as `pm' and midnight as `am'. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %P </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> Like %p but in lowercase: `am' or `pm' or a corresponding string for the current locale. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %q </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> Picture frame number within current second. For jpeg filenames this should always be included in the filename if you save more then 1 picture per second to ensure unique filenames. It is not needed in filenames for mpegs. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %Q </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> Number of detected labels found by the despeckle feature </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %r </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The time in a.m. or p.m. notation. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %R </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The time in 24-hour notation (%H:%M). </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %s </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The number of seconds since the Epoch, i.e., since 1970-01-01 00:00:00 UTC. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %S </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The second as a decimal number (range 00 to 61). </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %t </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> Thread number (camera number) </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %T </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The time in 24-hour notation (%H:%M:%S). </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %u </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The day of the week as a decimal, range 1 to 7, Monday being 1. See also %w. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %U </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The week number of the current year as a decimal number, range 00 to 53, starting with the first Sunday as the first day of week 01. See also %V and %W. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %v </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> Event number. An event is a series of motion detections happening with less than 'gap' seconds between them. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %V </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. See also %U and %W. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %w </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The day of the week as a decimal, range 0 to 6, Sunday being 0. See also %u. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %W </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The week number of the current year as a decimal number, range 00 to 53, starting with the first Monday as the first day of week 01. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %x </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The preferred date representation for the current locale without the time. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %X </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The preferred time representation for the current locale without the date. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %y </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The year as a decimal number without a century (range 00 to 99). </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %Y </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;"> The year as a decimal number including the century. </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol"> %z </td><td bgcolor="#edf4f9" align="left" valign="top" style="text-align:left;vertical-align:top;"> The time-zone as hour offset from GMT. </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol twikiLast"> %Z </td><td bgcolor="#ffffff" align="left" valign="top" style="text-align:left;vertical-align:top;" class="twikiLast"> The time zone or name or abbreviation. </td></tr>
</table>
<p />
<p />
<h2><a name="Webcam_Server"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/WebcamServer" class="twikiLink">Webcam Server</a> </h2>
Motion has simple webcam server built in. The video stream is in mjpeg format.
<p />
Each thread can have its own webcam server. If you enable the webcam server (option webcam_port to a number different from 0) and you have more than one camera, you must make sure to include webcam_port in each thread config file and set webcam_port to different and unique port numbers or zero (disable). Otherwise each webcam server will use the setting from the motion.conf file and try to bind to the same port. If the webcam_port numbers are not different from each other Motion will disable the webcam feature.
<p />
Note: The webcam server feature requires that the option <code>ppm</code> is set to <strong>off</strong>. (I.e. saved images are jpeg images).
<p />
The <code>webcam_maxrate</code> and <code>webcam_quality</code> options are important to limit the load on your server and link. Don't set them too high unless you only use it on the localhost or on an internal LAN. The option <code>webcam_quality</code> is equivalent to the quality level for jpeg pictures.
<p />
The <code>webcam_limit</code> option prevents people from loading your Network connection by streaming for hours and hours. The options defines the number of picture frames sent as mjpeg Motion will allow without re-connecting (e.g. clicking refresh in the browser).
<p />
The option <code>webcam_localhost</code> is a security feature. When enabled you can only access the webserver on the same machine as Motion is running on. If you want to present a live webcam on your web site this feature must be disabled.
<p />
The webserver generates a stream in "multipart jpeg" format (mjpeg). You cannot watch the stream with most browsers. Only certain versions of Netscape works. Mozilla and Firefox brosers can view the mjpeg stream but you often have to refresh the page once to get the streaming going. Internet Explorer cannot show the mjpeg stream. For public viewing this is not very useful. There exists a java applet called <a href="http://www.charliemouse.com/code/cambozola/" rel="nofollow" target="_top">Cambozola</a> which enabled any Java capable browser to show the stream. To enable the feature to a broad audience you should use this applet or similar.
<p />
To use the webcam feature with Cambozola is actually very simple.
<p />
<strong>1.</strong> Create a html page in which you will want the streamed picture.
<p />
<strong>2.</strong> In the html page include this code
<p />
<pre>
&#60;applet code&#61;com.charliemouse.cambozola.Viewer
    archive&#61;cambozola.jar width&#61;&#34;320&#34; height&#61;&#34;240&#34; style&#61;&#34;border-width:1; border-color:gray; border-style:solid;&#34;&#62;
    &#60;param name&#61;url value&#61;&#34;http://www.myurl.com:8081&#34;&#62;
&#60;/applet&#62;
</pre>
<p />
Where the width and height is the image size of the video stream.
<p />
Replace www.myurl.com:8081 by the real url and port number of your choice.
<p />
<strong>3.</strong> In the same directory you place the cambozola.jar file. No need to build the java applet from source. Simply use the applet in the package.
<p />
<strong>4.</strong> Enable the feature in motion.conf.
<p />
You can also view the live webcam stream using <a href="http://www.mplayerhq.hu/" rel="nofollow" target="_top">MPlayer</a> like this:
<p />
<pre>mplayer -demuxer lavf http://www.myurl.com:8081/stream.mjpg</pre>
<p />
Note that the <code>stream.mjpg</code> part is important, without it you will get a <code>LAVF_check: no clue about this gibberish!</code> error from libavformat.
<p />
<strong>These are the special webcam parameters.</strong>
<p />
<p />
<h3><a name="webcam_limit"></a> webcam_limit </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 2147483647
</li> <li> Default: 0 (unlimited)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamLimit" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Limit the number of frames to number frames. After 'webcam_limit' number of frames the connection will be closed by motion. The value 0 means unlimited.
<p />
Number can be defined by multiplying actual webcam rate by desired number of seconds. Actual webcam rate is the smallest of the numbers <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionFramerate" class="twikiLink">framerate</a> and <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamMaxrate" class="twikiLink">webcam_maxrate</a>.
<p />
<p />
<h3><a name="webcam_localhost"></a> webcam_localhost </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: on
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamLocalhost" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Limits the access to the webcam to the localhost.
<p />
By setting this to on, the webcam can only be accessed on the same machine on which Motion is running.
<p />
<p />
<h3><a name="webcam_maxrate"></a> webcam_maxrate </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 1 - 100
</li> <li> Default: 1
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamMaxrate" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Limit the framerate of the webcam in frames per second. Default is 1. Set the value to 100 for practically unlimited.
<p />
Don't set 'webcam_maxrate' too high unless you only use it on the localhost or on an internal LAN.
<p />
<p />
<h3><a name="webcam_motion"></a> webcam_motion </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamMotion" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
If set to 'on' Motion sends slows down the webcam stream to 1 picture per second when no motion is detected. When motion is detected the stream runs as defined by webcam_maxrate. When 'off' the webcam stream always runs as defined by webcam_maxrate.
<p />
Use this option to save bandwidth when there is not anything important to see from the camera anyway.
<p />
Note that this feature was greatly improved from Motion version 3.2.2. Before 3.2.2 the option stopped the webcam stream except when Motion was detected. This made the feature not very useful because it made it difficult to connect to the webcam stream and most mjpeg viewers would timeout and give an error message. From 3.2.2 the feature has been greatly improved and actually quite recommendable.
<p />
<p />
<p />
<h3><a name="webcam_port"></a> webcam_port </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 65535
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamPort" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
TCP port on which motion will listen for incoming connects with its webcam server.
<p />
Note that each camera thread must have its own unique port number and it must also be different from the control_port number.
<p />
A good value to select is 8081 for camera 1, 8082 for camera 2, 8083 for camera 3 etc etc.
<p />
<p />
<h3><a name="webcam_quality"></a> webcam_quality </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 1 - 100
</li> <li> Default: 50
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionWebcamQuality" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Quality setting in percent for the mjpeg picture frames transferred over the webcam connection. Keep it low to restrict needed bandwidth.
<p />
The mjpeg stream consists of a header followed by jpeg frames separated by content-length and boundary string. The quality level defines the size of the individual jpeg pictures in the mjpeg stream. If you set it too high you need quite a high bandwidth to view the stream.
<p />
<h2><a name="Remote_Control_with_http"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/RemoteControlHttp" class="twikiLink">Remote Control with http</a> </h2>
<p />
Motion can be remote controlled via a simple http interface. http is the language a normal web browser talks when it requests a web page. The web server answers back with some simple http headers followed by a webpage coded in HTML.
<p />
Most Motion config options can be changed while Motion is running except options related to the size of the captured images and mask files which are loaded only when Motion starts. So only your fantasy sets the limit to what you can change combining cron and the remote control interface for Motion.
<p />
So the most obvious tool to use to remote control Motion is any web browser. All commands are sent using the http GET method which simply means that the information is sent via the URL and maybe a query string. You can use any browser (Firefox, Mozilla, Internet Explorer, Konquerer, Opera etc). You can also use the text based browser lynx to control Motion from a console. It navigates fine through the very simple and minimalistic http control interface of Motion.
<p />
The details about how to control Motion via the URL is described in detail in the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionHttpAPI" class="twikiLink">Motion http API</a> topic.
<p />
But it is probably simpler to connect to the control port with a browser, navigate to the function you want, and copy the URL from the browser URL entry line. If your <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlPort" class="twikiLink">control_port</a> is 8080 and you browse from the same machine on which Motion runs simply look up <a href="http://localhost:8080/" rel="nofollow" target="_top">http://localhost:8080/</a> and navigate around. Connecting from a remote machine is done by using a domain name (example <a href="http://mydomain.com:8080/" rel="nofollow" target="_top">http://mydomain.com:8080/</a>) or the IP address of the machine (example <a href="http://192.168.1.4:8080/" rel="nofollow" target="_top">http://192.168.1.4:8080/</a>). The option <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlLocalhost" class="twikiLink">control_localhost</a> must be off to allow connection from a remote machine.
<p />
If you want to use a script or cron to automatically change Motion settings while Motion runs you use a program that can fetch a webpage. We simply just throw away the html page that Motion returns. Programs commonly available on Linux machines are wget and lwp-request. Here is an example of how to start and stop motion detection via cron. These two lines are added to /etc/crontab.
<p />
<pre>
0 9 &#42; &#42; &#42; root /usr/bin/lwp-request http://localhost:8080/0/detection/start &#62; /dev/null
0 18 &#42; &#42; &#42; root /usr/bin/lwp-request http://localhost:8080/0/detection/pause &#62; /dev/null
</pre>
<p />
If you want to use the http remote control from your own software (for example your own PHP front end) you can set the new motion.conf option html_output off. Then Motion answers back with very basic text only and no html around it. A bit like the xmlrpc interface did.
<p />
To remote control Motion from a web pages you can for example use PHP. In PHP it takes this simple code line to send a remote commend to Motion. Here we pause motion detection for camera 2
<p />
<code>readfile('http://localhost:8080/2/detection/pause');</code>
<p />
What happened to XMLRPC?
<p />
XMLRPC is replaced by a simpler http remote control interface. It is still being worked on but it is absolutely useable now and much nicer to work with than xmlrpc. Another advantage is that you do not need to install xmlrpc libraries. It is all written in standard C.
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> Security Warning! Note that this feature also means you have to pay attention to the following. <ul>
<li> Anyone with access to the remote control port (http) can alter the values of any options and save files anywhere on your server with the same privileges as the user running Motion. They can execute any command on your computer with the same privileges as the user running Motion. Anyone can access your control port if you have not either limited access to localhost or limited access using firewalls in the server. You should always have a router between a machine running Motion with remote control enabled and the Internet and make sure the Motion control port is not accessible from the outside.
</li> <li> If you limit control port to localhost you still need to take care of any user logging into the server with any kind of terminal session.
</li> <li> It is a good idea to run Motion as a harmless user. Not as root!!
</li></ul> 
<p />
<strong>These are the config file options that control Motion.</strong>
<p />
These must be placed in motion.conf and not in a thread config file.
<p />
<p />
<h3><a name="control_authentication"></a> control_authentication </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4096 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlAuthentication" class="twikiLink">Option Topic</a>   
</li></ul> 
<p />
To protect HTTP Control by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication. This option must be placed in motion.conf and not in a thread config file.
<p />
By setting this to on, the control using http (browser) can only be accessed using login and password ( following the Basic Authentication defined in HTTP RFC).
<p />
<p />
<p />
<!--
Add Additional Description Below 
-->
<p />
<p />
<h3><a name="control_html_output"></a> control_html_output </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: on
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlHtmlOutput" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Enable HTML in the answer sent back to a browser connecting to the control_port. This option must be placed in motion.conf and not in a thread config file.
<p />
The recommended value for most is "on" which means that you can navigate and control Motion with a normal browser. By setting this option to "off" the replies are in plain text which may be easier to parse for 3rd party programs that control Motion.
<p />
<p />
<h3><a name="control_localhost"></a> control_localhost </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: on
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlLocalhost" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Limits the http (html) control to the localhost. This option must be placed in motion.conf and not in a thread config file.
<p />
By setting this to on, the control using http (browser) can only be accessed on the same machine on which Motion is running.
<p />
<p />
<h3><a name="control_port"></a> control_port </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 65535
</li> <li> Default: 0 (disabled)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionControlPort" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Sets the port number for the http (html using browser) based remote control. This option must be placed in motion.conf and not in a thread config file.
<p />
This sets the TCP/IP port number to be used for control of motion using http (browser). Port numbers below 1024 normally requires that you have root privileges. Port 8080 is a fine choice of port to use for the purpose.
<p />
<p />
<p />
-- <a href="http://www.lavrsen.dk/twiki/bin/view/Main/KennethLavrsen" class="twikiLink">KennethLavrsen</a> - 12 Apr 2005
<p />
<p />
<h2><a name="External_Commands"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ExternalCommands" class="twikiLink">External Commands</a> </h2>
Motion can execute external commands based on the motion detection and related events. They are all described in this section. The option <code>quiet</code> is also included in this section.
<p />
A redesign of the external commands was due. They were not very easy to understand, not all were flexible enough and some were missing. So a new external command feature set was made for 3.2.1 and on.
<p />
This is how the new script commands look like:
<p />
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" class="twikiFirstCol" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=0;table=12;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Function</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=1;table=12;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Old Option</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=2;table=12;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">New Option</a> </th><th bgcolor="#6b7f93" align="center" valign="top" style="text-align:center;vertical-align:top;" maxcols="0"> <a rel="nofollow" href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument&amp;amp;sortcol=3;table=12;up=0#sorted_table" style="color:#ffffff" title="Sort by this column">Argument Appended</a> </th></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> Start of event (first motion) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> execute </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> on_event_start </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> None </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> End of event (no motion for gap seconds) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> <em>New!</em> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> on_event_end </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> None </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> Picture saved (jpg or ppm) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> onsave </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> on_picture_save </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Filename of picture </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol"> Movie starts (mpeg file opened) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> onmpeg </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> on_movie_start </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;"> Filename of movie </td></tr>
<tr class="twikiTableOdd"><td bgcolor="#ffffff" valign="top" style="vertical-align:top;" class="twikiFirstCol"> Movie ends (mpeg file closed) </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> onffmpegclose </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> on_movie_end </td><td bgcolor="#ffffff" valign="top" style="vertical-align:top;"> Filename of movie </td></tr>
<tr class="twikiTableEven"><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiFirstCol twikiLast"> Motion detected (each single frame with Motion detected) </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiLast"> <em>New!</em> </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiLast"> on_motion_detected </td><td bgcolor="#edf4f9" valign="top" style="vertical-align:top;" class="twikiLast"> None </td></tr>
</table>
<p />
Mail and sms has been removed because they were not configurable. If you want to send event-based mails or sms, just use one of those commands above and send the mail from that script. See <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument#MailSMS" class="twikiCurrentTopicLink twikiAnchorLink">What happened to mail and sms?</a>
<p />
<p />
<img src="http://www.lavrsen.dk/twiki/pub/TWiki/TWikiDocGraphics/warning.gif" alt="ALERT!" title="ALERT!" width="16" height="16" border="0" /> Security Warning! Note that this feature also means you have to pay attention to the following. <ul>
<li> Anyone with access to the remote control port (http) can execute any command on your computer with the same privileges as the user running Motion. Anyone can access your control port if you have not either limited access to localhost or limited access using firewalls in the server. You should always have a router between a machine running Motion with remote control enabled and the Internet and make sure the Motion control port is not accessible from the outside.
</li> <li> If you limit control port to localhost you still need to take care of any user logging into the server with any kind of GUI or terminal session. All it takes is a browser or single command line execution to change settings in Motion.
</li> <li> It is a good idea to run Motion as a harmless user. Not as root!!
</li></ul> 
<p />
<strong>These are the options</strong>
<p />
<p />
<h3><a name="on_event_end"></a> on_event_end </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnEventEnd" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Command to be executed when an event ends after a period of no motion. The period of no motion is defined by option gap. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> and spaces as part of the command.
<p />
Full path name of the program/script.
<p />
This can be any type of program or script. Remember to set the execution bit in the ACL and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/user/bin/perl) as the first line of the script.
<p />
The command is run when an event is over. I.e. the number of seconds defined by the time 'gap' has passed since the last detection of motion and motion closes the mpeg file.
<p />
<p />
<h3><a name="on_event_start"></a> on_event_start </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnEventStart" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Command to be executed when an event starts. An event starts at first motion detected after a period of no motion defined by gap. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">ConversionSpecifiers</a> and spaces as part of the command.
<p />
Full path name of the program/script.
<p />
This can be any type of program or script. Remember to set the execution bit in the ACL and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/user/bin/perl) as the first line of the script.
<p />
The command is run when an event starts. I.e. the first motion is detected since the last event.
<p />
This option replaces the former options 'mail', 'sms' and 'execute'.
<p />
<p />
<h3><a name="on_motion_detected"></a> on_motion_detected </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnMotionDetected" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Command to be executed when a motion frame is detected. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> and spaces as part of the command.
<p />
Do not write "none" if you do not want to execute commands. Simply do not include the option in the file or comment it out by placing a "#" or ";" as the first character on the line before the execute command.
<p />
<p />
<h3><a name="on_movie_end"></a> on_movie_end </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnMovieEnd" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Command to be executed when an ffmpeg movie is closed at the end of an event. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> and spaces as part of the command. Use %f for passing filename (with full path) to the command.
<p />
Full path name of the program/script.
<p />
This can be any type of program or script. Remember to set the execution bit in the ACL and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/user/bin/perl) as the first line of the script.
<p />
The command is run when an event is over. I.e. the number of seconds defined by the time 'gap' has passed since the last detection of motion and motion closes the mpeg file.
<p />
This option was previously called onffmpegclose.
<p />
Note that from Motion 3.2.4 the path name of the picture file is no longer appended to the command. Instead you can use the conversion specifier %f to insert the picture filename (full path) anywhere in the command.
<p />
Most common <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> 
<p /> <ul>
<li> %Y = year, %m = month, %d = date
</li> <li> %H = hour, %M = minute, %S = second
</li> <li> %v = event
</li> <li> %q = frame number
</li> <li> %t = thread (camera) number
</li> <li> %D = changed pixels
</li> <li> %N = noise level
</li> <li> %i and %J = width and height of motion area
</li> <li> %K and %L = X and Y coordinates of motion center
</li> <li> %C = value defined by text_event
</li> <li> %f = filename with full path
</li> <li> %n = number indicating filetype 
</li></ul> 
<p />
<p />
<h3><a name="on_movie_start"></a> on_movie_start </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnMovieStart" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Command to be executed when an mpeg movie is created. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> and spaces as part of the command. Use %f for passing filename (with full path) to the command.
<p />
Full path name of the program/script.
<p />
This can be any type of program or script. Remember to set the execution bit in the ACL and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/user/bin/perl) as the first line of the script. When you use ffmpeg the film is generated on the fly and on_movie_start then runs when the new mpeg file is created. Often you will want to use the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnMovieEnd" class="twikiLink">on_movie_end</a> option which runs when the mpeg file is closed and the event is over.
<p />
This option was previously called onmpeg.
<p />
Note that from Motion 3.2.4 the path name of the picture file is no longer appended to the command. Instead you can use the conversion specifier %f to insert the picture filename (full path) anywhere in the command.
<p />
Most common <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> 
<p /> <ul>
<li> %Y = year, %m = month, %d = date
</li> <li> %H = hour, %M = minute, %S = second
</li> <li> %v = event
</li> <li> %q = frame number
</li> <li> %t = thread (camera) number
</li> <li> %D = changed pixels
</li> <li> %N = noise level
</li> <li> %i and %J = width and height of motion area
</li> <li> %K and %L = X and Y coordinates of motion center
</li> <li> %C = value defined by text_event
</li> <li> %f = filename with full path
</li> <li> %n = number indicating filetype 
</li></ul> 
<p />
<p />
<h3><a name="on_picture_save"></a> on_picture_save </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionOnPictureSave" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Command to be executed when an image is saved. You can use <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">Conversion Specifiers</a> and spaces as part of the command. Use %f for passing filename (with full path) to the command.
<p />
Full path name of the program/script.
<p />
This can be any type of program or script. Remember to set the execution bit in the file access control list (chmod) and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/usr/bin/perl) as the first line of the script.
<p />
Note that from Motion 3.2.4 the path name of the picture file is no longer appended to the command. Instead you can use the conversion specifier %f to insert the picture filename (full path) anywhere in the command.
<p />
Most common <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> 
<p /> <ul>
<li> %Y = year, %m = month, %d = date
</li> <li> %H = hour, %M = minute, %S = second
</li> <li> %v = event
</li> <li> %q = frame number
</li> <li> %t = thread (camera) number
</li> <li> %D = changed pixels
</li> <li> %N = noise level
</li> <li> %i and %J = width and height of motion area
</li> <li> %K and %L = X and Y coordinates of motion center
</li> <li> %C = value defined by text_event
</li> <li> %f = filename with full path
</li> <li> %n = number indicating filetype 
</li></ul> 
<p />
<p />
<h3><a name="quiet"></a> quiet </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionQuiet" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Be quiet, don't output beeps when detecting motion.
<p />
Only works in non-daemon mode.
<p />
<p />
<p />
<a name="MailSMS"></a>
<h3><a name="What_happened_to_mail_and_sms"></a><a name="What_happened_to_mail_and_sms_"></a> What happened to mail and sms? </h3>
The 6 new on_xxxxx options replace the former execute, mail and sms options.
<p />
They are quite generic and flexible. These small bash scripts gives to the same functionality as mail and sms BUT you have all the flexibility you want to extend the messages, change the 'from' email address etc.
<p />
<h4><a name="Sending_email_at_start_of_event"></a> Sending email at start of event </h4>
<em>Script written by <a href="http://www.lavrsen.dk/twiki/bin/view/Main/JoergWeber" class="twikiLink">JoergWeber</a></em>
<pre>
#!/bin/sh

# Motion sample script to send an e-mail at start of an event.
# Replaces the former &#39;mail&#39; option.
# Just define this script as &#39;on&#95;event&#95;start&#39;-script in motion.conf like that:
# on&#95;event&#95;start send&#95;mail &#34;&#37;Y-&#37;m-&#37;d &#37;T&#34;

#change to suit your needs:
#location of &#39;mail&#39; binary
MAIL&#61;&#34;/usr/bin/mail&#34;
#Destination e-mail address
TO&#61;&#34;root&#64;localhost&#34;
#Subject of the e-mail
SUBJECT&#61;&#34;Motion detected&#34;

#Don&#39;t change anything below this line
echo -e &#34;This is an automated message generated by motion.\n\nMotion detected: $1\n\n&#34; &#124; $MAIL -s &#34;$SUBJECT&#34; $TO
</pre>
<p />
<h4><a name="Sending_SMS_at_start_of_event"></a> Sending SMS at start of event </h4>
<em>Script written by <a href="http://www.lavrsen.dk/twiki/bin/view/Main/JoergWeber" class="twikiLink">JoergWeber</a></em>
<p />
If you uncomment the line <code>#/usr/local/bin/send_mail $1</code> you can combine both sending email and sms.
<pre>
#!/bin/sh

# Motion sample script to send an sms at start of an event.
# Replaces the former &#39;sms&#39; option.
# Just define this script as &#39;on&#95;event&#95;start&#39;-script in motion.conf like that:
# on&#95;event&#95;start send&#95;sms &#34;&#37;Y-&#37;m-&#37;d &#37;T&#34;
#
# If you want to send an e-mail message here as well, just uncomment the last
# line of this script.

#change to suit your needs:
#location of &#39;sms-client&#39; binary
SMS&#95;CLIENT&#61;&#34;/usr/bin/sms&#95;client&#34;
#Destination sms number
TO&#61;&#34;12345&#34;

#Don&#39;t change anything below this line
$SMS&#95;CLIENT $TO &#34;Motion detected $1&#34;

#/usr/local/bin/send&#95;mail $1

</pre>
<p />
<p />
<h1><a name="Motion_Guide_Special_Features"></a> Motion Guide - Special Features </h1>
<p />
<h2><a name="Tracking_Control"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/TrackingControl" class="twikiLink">Tracking Control</a> </h2>
This is still at the experimental stage. Read more about it <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionTracking" class="twikiLink">motion tracking</a> page.
<p />
<h3><a name="Tracking_Feature_with_Logitech_Q"></a> Tracking Feature with Logitech Quickcam Sphere/Orbit </h3>
Motion supports controlling the pan and tilt feature of a Logitech Quickcam Sphere/Orbit.
<p />
Motion can move the camera to a fixed position given in degrees pan (left-right) and tilt (down-up). Movement can be set with absolute coordinates or relative to current position. There is also an auto tracking feature for the Logitech Quickcam Sphere/Orbit but it is not very mature. It is fun to play with but not very useful yet. See this topic of how <a href="http://www.lavrsen.dk/twiki/bin/view/Main/KennethLavrsen" class="twikiLink">KennethLavrsen</a> controls his Sphere: <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/LogitechSphereControl" class="twikiLink">LogitechSphereControl</a>.
<p />
For a detailed description of http remote control see the section <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/RemoteControlHttp" class="twikiLink">Remote Control with http</a>.
<p />
<strong>List of tracking options</strong>
<p />
<h3><a name="track_auto"></a> track_auto </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackAuto" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Enable auto tracking
<p />
Requires a tracking camera type supported by Motion.
<p />
<p />
<h3><a name="track_iomojo_id"></a> track_iomojo_id </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 2147483647
</li> <li> Default: 0 
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackIomojoId" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Use this option if you have an iomojo smilecam connected to the serial port instead of a general stepper motor controller.
<p />
Only used for iomojo camera.
<p />
<p />
<h3><a name="track_maxx"></a> track_maxx </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 2147483647
</li> <li> Default: 0 
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackMaxx" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The maximum position for servo x.
<p />
Only used for stepper motor tracking.
<p />
<p />
<h3><a name="track_maxy"></a> track_maxy </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 2147483647
</li> <li> Default: 0 
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackMaxy" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The maximum position for servo y.
<p />
Only used for stepper motor tracking.
<p />
<!--
Add Additional Description Below 
-->
<p />
<p />
<h3><a name="track_motorx"></a> track_motorx </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: -1 - 2147483647
</li> <li> Default: -1
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackMotorx" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The motor number that is used for controlling the x-axis.
<p />
Only used for stepper motor tracking. 
<p />
<p />
<h3><a name="track_motory"></a> track_motory </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: -1 - 2147483647
</li> <li> Default: -1
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackMotory" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The motor number that is used for controlling the y-axis.
<p />
Only used for stepper motor tracking.
<p />
<!--
Add Additional Description Below 
-->
<p />
<p />
<h3><a name="track_move_wait"></a> track_move_wait </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 2147483647
</li> <li> Default: 10
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackMoveWait" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Delay during which tracking is disabled after auto tracking has moved the camera. Delay is defined as number of picture frames.
<p />
The actual delay is depending on the chosen framerate. If you want the camera to move maximum once every 2 seconds and the framerate is 10 then you need to set the track_move_wait value to 2 * 10 = 20.
<p />
<p />
<h3><a name="track_port"></a> track_port </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackPort" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
This is the device name of the serial port to which the stepper motor interface is connected.
<p />
Only used for stepper motor tracking.
<p />
<p />
<h3><a name="track_speed"></a> track_speed </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 255
</li> <li> Default: 255
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackSpeed" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Speed to set the motor to.
<p />
Only used for stepper motor tracking.
<p />
<p />
<h3><a name="track_step_angle_x"></a> track_step_angle_x </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0-90
</li> <li> Default: 10
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackStepAngleX" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Angle in degrees the camera moves per step on the X-axis with auto tracking. Currently only used with pwc type cameras.
<p />
Requires a tracking camera type pwc.
<p />
<p />
<h3><a name="track_step_angle_y"></a> track_step_angle_y </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0-40
</li> <li> Default: 10
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackStepAngleY" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Angle in degrees the camera moves per step on the Y-axis with auto tracking. Currently only used with pwc type cameras.
<p />
Requires a tracking camera type pwc.
<p />
<!--
Add Additional Description Below 
-->
<p />
<p />
<h3><a name="track_stepsize"></a> track_stepsize </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 255
</li> <li> Default: 40
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackStepsize" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Number of steps to make.
<p />
Only used for stepper motor tracking.
<p />
<p />
<h3><a name="track_type"></a> track_type </h3>
<p /> <ul>
<li> Type: Discrete Strings
</li> <li> Range / Valid values: 0 (none), 1 (stepper), 2 (iomojo), 3 (pwc), 4 (generic), 5 (uvcvideo)
</li> <li> Default: 0 (None)
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionTrackType" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Type of tracker.
<p />
Motion has special tracking options which use either a serial stepper motor controller, an iomojo smile cam or a Philips <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/WebCam" class="twikiLink">WebCam</a> driver compatible pan/tilt camera such as the Logitech Quickcam Sphere or Orbit.
<p />
To disable tracking, set this to 0 and the other track options are ignored.
<p />
Value 1 is for the special <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionTracking" class="twikiLink">Motion Tracking</a> project using a stepper motor and a home made controller.
<p />
Value 2 is for the iomojo smilecam
<p />
Value 3 is for pwc type USB tracking cameras such as the Logitech Quickcam Sphere/Orbit which is driven by the pwc (Philips <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/WebCam" class="twikiLink">WebCam</a>) driver. To use this camera your version of pwc must be at least 8.12.
<p />
Value 4 is the generic track type. Currently it has no other function than enabling some of the internal Motion features related to tracking. Eventually more functionality will be implemented for this type.
<p />
Value 5 is for uvcvideo type USB tracking cameras such as the Logitech Quickcam Sphere/Orbit MP (new Model) which is driven by the <a href="http://linux-uvc.berlios.de/" rel="nofollow" target="_top">uvcvideo</a> driver. This option was added in Motion 3.2.8.
<p />
<p />
<h2><a name="Using_Databases"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/UsingDatabases" class="twikiLink">Using Databases</a> </h2>
Motion can be compiled with both MySQL and PostgreSQL database support. When enabled Motion adds a record to a table in the database as specified by the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlQuery" class="twikiLink">sql_query</a>. The query contains the fields that are used and the value are given by using <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> for dynamic data like filename, time, number of detected pixels etc. Motion does not place any binary images in the database and it cannot remove old records.
<p />
Motion only adds records to the database when files are created. The database contains records of saved files which means to get a record in the database the feature that enables for example motion detection, timelapse, snapshots etc must be enabled. The sql_log options defines which types of files are logged in the database.
<p />
The following sql_log options are common to both MySQL and PostgreSQL.
<p />
<p />
<h3><a name="sql_log_image"></a> sql_log_image </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: on
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlLogImage" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Log to the database when creating motion triggered image file.
<p />
Configuration option common to MySQL and PostgreSQL. Motion must be built with MySQL or PostgreSQL support to use this feature.
<p />
<p />
<h3><a name="sql_log_mpeg"></a> sql_log_mpeg </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlLogMpeg" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Log to the database when creating motion triggered mpeg file.
<p />
Configuration option common to MySQL and PostgreSQL. Motion must be built with MySQL or PostgreSQL support to use this feature.
<p />
<p />
<h3><a name="sql_log_snapshot"></a> sql_log_snapshot </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: on
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlLogSnapshot" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Log to the database when creating a snapshot image file.
<p />
Configuration option common to MySQL and PostgreSQL. Motion must be built with MySQL or PostgreSQL support to use this feature.
<p />
<p />
<h3><a name="sql_log_timelapse"></a> sql_log_timelapse </h3>
<p /> <ul>
<li> Type: Boolean
</li> <li> Range / Valid values: on, off
</li> <li> Default: off
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlLogTimelapse" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Log to the database when creating timelapse mpeg file
<p />
Configuration option common to MySQL and PostgreSQL. Motion must be built with MySQL or PostgreSQL support to use this feature.
<p />
<p />
<h3><a name="sql_query"></a> sql_query </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') 
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlQuery" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
SQL query string that is sent to the database. The values for each field are given by using <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">convertion specifiers</a>
<p />
Most common <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConversionSpecifiers" class="twikiLink">conversion specifiers</a> 
<p /> <ul>
<li> %Y = year, %m = month, %d = date
</li> <li> %H = hour, %M = minute, %S = second
</li> <li> %v = event
</li> <li> %q = frame number
</li> <li> %t = thread (camera) number
</li> <li> %D = changed pixels
</li> <li> %N = noise level
</li> <li> %i and %J = width and height of motion area
</li> <li> %K and %L = X and Y coordinates of motion center
</li> <li> %C = value defined by text_event
</li> <li> %f = filename with full path
</li> <li> %n = number indicating filetype 
</li></ul> 
<p />
<p />
See the "MySQL" section for detailed information about the database itself.
<p />
<h2><a name="MySQL"></a><a name="_MySQL"></a> MySQL </h2>
You can use the MySQL database to register each file that is stored by motion.
<p />
You need to generate a new database with a name of your own choice. You must enter this name in the config file (mysql_db option). The default value for the option <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlQuery" class="twikiLink">sql_query</a> requires that you create a new database in MySQL with a new table called "security" with the following fields:
<p />
insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')
<p /> <ul>
<li> camera (int) - camera (thread) number 
</li> <li> filename (char60) - filename (full path) 
</li> <li> frame (int) - the number of the picture frame 
</li> <li> file_type (int) - file type as a number - see table below.
</li> <li> time_stamp (timestamp) - timestamp for the picture in native database format 
</li> <li> text_event (timestamp) - The text from the text_event option which by default is compatible with timestamps in SQL.
</li></ul> 
<p />
Note from version 3.2.4 the introduction of <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionSqlQuery" class="twikiLink">sql_query</a> completely redefines the way you setup the SQL feature. It is now 100% flexible and can easily be made compatible with your existing Motion database from earlier versions of Motion.
<p />
These are the file type descriptions and the file type numbers stored in the database.
<p />
<table style="border-width:1px;" cellspacing="0" cellpadding="0" class="twikiTable" border="1"><tr class="twikiTableEven"><td width="400" bgcolor="#ffffff" align="left" valign="top" style="width:400;text-align:left;vertical-align:top;" class="twikiFirstCol"> Normal image </td><td width="70" bgcolor="#ffffff" align="center" valign="top" style="width:70;text-align:center;vertical-align:top;"> 1 </td></tr>
<tr class="twikiTableOdd"><td width="400" bgcolor="#edf4f9" align="left" valign="top" style="width:400;text-align:left;vertical-align:top;" class="twikiFirstCol"> Snapshot image </td><td width="70" bgcolor="#edf4f9" align="center" valign="top" style="width:70;text-align:center;vertical-align:top;"> 2 </td></tr>
<tr class="twikiTableEven"><td width="400" bgcolor="#ffffff" align="left" valign="top" style="width:400;text-align:left;vertical-align:top;" class="twikiFirstCol"> Motion image (showing only pixels defined as motion) </td><td width="70" bgcolor="#ffffff" align="center" valign="top" style="width:70;text-align:center;vertical-align:top;"> 4 </td></tr>
<tr class="twikiTableOdd"><td width="400" bgcolor="#edf4f9" align="left" valign="top" style="width:400;text-align:left;vertical-align:top;" class="twikiFirstCol"> Normal mpeg image </td><td width="70" bgcolor="#edf4f9" align="center" valign="top" style="width:70;text-align:center;vertical-align:top;"> 8 </td></tr>
<tr class="twikiTableEven"><td width="400" bgcolor="#ffffff" align="left" valign="top" style="width:400;text-align:left;vertical-align:top;" class="twikiFirstCol"> Motion mpeg (showing only pixels defined as motion) </td><td width="70" bgcolor="#ffffff" align="center" valign="top" style="width:70;text-align:center;vertical-align:top;"> 16 </td></tr>
<tr class="twikiTableOdd"><td width="400" bgcolor="#edf4f9" align="left" valign="top" style="width:400;text-align:left;vertical-align:top;" class="twikiFirstCol twikiLast"> Timelapse mpeg </td><td width="70" bgcolor="#edf4f9" align="center" valign="top" style="width:70;text-align:center;vertical-align:top;" class="twikiLast"> 32 </td></tr>
</table>
<p />
You can create the table using the following SQL statement.
<p />
<code>CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp(14), text_event timestamp(14));</code>
<p />
If you choose to use text_event for a non-timestamp value you can instead define something like.
<p />
<code>CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp(14), text_event char(40));</code>
<p />
<p />
Remember to update grant table to give access to the mysql username you choose for motion.
<p />
It would be too much to go into detail about how to setup and use MySQL. After all this is a guide about Motion. However here are some hints and links.
<p />
<a href="http://www.linuxplanet.com/linuxplanet/tutorials/1046/1/" rel="nofollow" target="_top">Setting Up a MySQL Based Website</a> - A beginners guide from Linux Planet.
<p />
<a href="http://hotwired.lycos.com/webmonkey/99/21/index2a.html" rel="nofollow" target="_top">Webmonkey PHP/!MySQL tutorial</a> - Entertaining and easy to read.
<p />
The <a href="http://www.phpmyadmin.net/" rel="nofollow" target="_top">phpMyAdmin homepage</a>. The best and simplest tool to use MySQL (editors opinion). Requires Apache/PHP.
<p />
<strong>The options for MySQL</strong>
<p />
<p />
<h3><a name="mysql_db"></a> mysql_db </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMysqlDb" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Name of the MySQL database.
<p />
MySQL CONFIG FILE OPTION. Motion must be built with MySQL libraries to use this feature.
<p />
If you compiled motion with MySQL support you will need to set the mysql options if you want motion to log events to the database.
<p />
<p />
<h3><a name="mysql_host"></a> mysql_host </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: localhost
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMysqlHost" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
IP address or domain name for the MySQL server. Use "localhost" if motion and MySQL runs on the same server.
<p />
MySQL CONFIG FILE OPTION. Motion must be built with MySQL libraries to use this feature.
<p />
<p />
<h3><a name="mysql_password"></a> mysql_password </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMysqlPassword" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The MySQL password.
<p />
MySQL CONFIG FILE OPTION. Motion must be built with MySQL libraries to use this feature.
<p />
<p />
<h3><a name="mysql_user"></a> mysql_user </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMysqlUser" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The MySQL user name.
<p />
MySQL CONFIG FILE OPTION. Motion must be built with MySQL libraries to use this feature.
<p />
<p />
<p />
<h2><a name="PostgreSQL"></a><a name="_PostgreSQL"></a> PostgreSQL </h2>
Same/similar as for MySQL above.
<p />
<strong>The options for PostgreSQL</strong>
<p />
<p />
<h3><a name="pgsql_db"></a> pgsql_db </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPgsqlDb" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
Name of the PostgreSQL database.
<p />
PostgreSQL CONFIG FILE OPTION. Motion must be built with PostgreSQL libraries to use this feature.
<p />
If you compiled motion with PostgreSQL support you will need to set all the pgsql_ options if you want motion to log events to the database.
<p />
<p />
<h3><a name="pgsql_host"></a> pgsql_host </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: localhost
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPgsqlHost" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
IP address or domain name for the PostgreSQL server. Use "localhost" if motion and PostgreSQL runs on the same server.
<p />
PostgreSQL CONFIG FILE OPTION. Motion must be built with pgsql_db libraries to use this feature.
<p />
<p />
<h3><a name="pgsql_password"></a> pgsql_password </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPgsqlPassword" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The PostgreSQL password. 
<p />
PostgreSQL CONFIG FILE OPTION. Motion must be built with PostgreSQL libraries to use this feature.
<p />
<p />
<h3><a name="pgsql_port"></a> pgsql_port </h3>
<p /> <ul>
<li> Type: Integer
</li> <li> Range / Valid values: 0 - 65535
</li> <li> Default: 5432
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPgsqlPort" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The PostgreSQL server port number.
<p />
PostgreSQL CONFIG FILE OPTION. Motion must be built with PostgreSQL libraries to use this feature.
<p />
<p />
<h3><a name="pgsql_user"></a> pgsql_user </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionPgsqlUser" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The PostgreSQL user name. 
<p />
PostgreSQL CONFIG FILE OPTION. Motion must be built with PostgreSQL libraries to use this feature.
<p />
<p />
<h2><a name="Video4Linux_Loopback_Device"></a> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/LoopbackDevice" class="twikiLink">Video4Linux Loopback Device</a> </h2>
You can use this driver for looking at motion in realtime. The video4linux driver is written by the same author that first created Motion. You can find the source and a brief description at the <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/VideoFourLinuxLoopbackDevice" class="twikiLink">video4linux loopback device web page</a>. 
<p />
The video4linux device is a Kernel module which installs itself as a video pipe. It has an input and an output. The module simply takes anything that comes on its input and send it out at the output. The purpose of this is to create a standard video4linux type video device that other programs can then use. You may now ask: "What do I need that for?".
<p />
Only one program can access a video device at a time. When motion is using a camera - no other program can access the same camera. But motion is made to be able to feed a video signal to the video loopback device. This way an additional program such as Camstream, Xawtv, a video stream server etc can watch the signal from a camera that motion uses already. What you see is not the live camera stream but the exact same picture that motion uses for detecting motion and the same pictures that are saved/streamed. You can also choose to see the "motion" type images where you see the pixels that are changing - live. Originally the video4linux pipe was used as an interface between Motion and a Webcam server. Since version 2.9 Motion has had its own webserver so this usage is no longer very relevant.
<p />
When you install the video loopback device it will create an input - for example /dev/video5 and an output - for example /dev/video6. You can then tell motion to "pipe" the video signal to the /dev/video5 and look at the pictures live using e.g. Camstream on /dev/video6. Camstream is "fooled" to think it is looking at a real camera.
<p />
<strong>Installing</strong>
<p />
Installing the video loopback device is not difficult. At least not when you have this document available.
<p />
First you must prepare your system for more video devices. You will need two extra devices for each video pipe that you want.
<p />
For example if you have 4 cameras they will probably run at /dev/video0, /dev/video1, /dev/video2, and /dev/video3. So you will need additional 8 video devices. This is easy to do.
<p />
<pre>
mknod /dev/video4 c 81 4
mknod /dev/video5 c 81 5
mknod /dev/video6 c 81 6
mknod /dev/video7 c 81 7
mknod /dev/video8 c 81 8
mknod /dev/video9 c 81 9
mknod /dev/video10 c 81 10
mknod /dev/video11 c 81 11
</pre>
<p />
Note that the video device number is the same as the last parameter given on each line.
<p />
You may need to set the ownership and permissions (chown and chmod) to be the same as the video devices that were already there.
<p />
Now you need to install the video loopback device.
<p />
Download the latest <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/VideoFourLinuxLoopbackDevice" target="_top">video4linux loopback device</a> . Place the file in a place of your own choice. 
<p />
Untar and uncompress the file to the place you want the program installed. Editor recommends /usr/local/vloopback.
<p />
<code>cd /usr/local</code>
<p />
<code>tar -xvzf /path/to/vloopback-1.1-rc1.tar.gz</code>
<p />
You now have a directory called vloopback-1.1-rc1. You can rename it to vloopback (mv vloopback-1.1-rc1 vloopback). I recommend creating a symbolic link to the current version. This way you can more easily experiment with different versions simply by changing the link.
<p />
<code>ln -s vloopback-1.1-rc1 vloopback</code>
<p />
Now change to the new directory
<p />
<code>cd vloopback</code>
<p />
Build the code
<p />
<code>make</code>
<p />
There is a good chance that the make will not work and give you a long list of errors. To run make the following must be available on you machine. <ul>
<li> The kernel source files must be installed. 
</li> <li> The source files must be available at /usr/src/linux.<br />E.g. the new Red Hat 7.3 does not have a link to the sources called linux. Instead there is a link called linux-2.4. This is easy to fix. Just create a link to the real source tree. Do not rename! Add a link using this command (replacing the kernel version number with the one you have on your machine)<br /> <code>ln -s /usr/src/linux-2.4.18-4 /usr/src/linux</code>
</li> <li> Alternatively you can change the vloopback makefile so that the "LINUXSRC=/usr/src/linux" line is changed to the actual path. I recommend the link solution since this may solve other similar problems that you can get when installing other software. 
</li></ul> 
<p />
When compiling on a newer Linux distribution you may get a warning about a header file malloc.h. To remove this warning simply change the header reference as suggested by the warning.
<p />
In vloopback.c you replace the line
<p />
<code>#include &lt;linux/malloc.h&gt;</code>
<p />
with the line
<p />
<code>#include &lt;linux/slab.h&gt;</code>
<p />
Install the code you built as a Kernel module. There are two options: pipes should be set to the number of video loopbacks that you want. Probably one for each camera. The dev_offset defines which video device number will be the first. If dev_offset is not defined the vloopback module will install itself from the first available video device. If you want the cameras to be assigned to the lower video device numbers you must either load vloopback after loading the video device modules OR use the dev_offset option when loading vloopback. Vloopback then installs itself in the sequence input 0, output 0, input 1, output 1, input 2, output 2 etc. Here is shown the command for our example of 4 cameras and 4 loopback devices and the first loopback device offset to /dev/video4.
<p />
<code>/sbin/insmod /usr/local/vloopback/vloopback.o pipes=4 dev_offset=4</code>
<p />
When you run the command you may get a warning about tainting the Kernel. Just ignore this.
You can choose to copy the vloopback.o file into a directory in the /lib/modules tree where the insmod/modprobe programs are already looking for modules. Then the command gets simpler (/sbin/insmod vloopback pipes=.....).
<p />
If you want the loopback device to load during boot, you can place the call in one of the bootup scripts such as /etc/rc.d/rc.local. Vloopback should be loaded before you start motion. 
<p />
To activate the vloopback device in motion set the 'video_pipe' option in the motion.conf file. You can also view the special motion pictures where you see the changed pixels by setting the option 'motion_video_pipe' in motion.conf. When setting the video_pipe and/or motion_video_pipe options either specify the input device as e.g. /dev/video4. You can also set the parameter to '-' which means that motion will find the first vacant video loopback device input. If you have more than one camera you may want to control which loopback device each thread uses. Then you need to define the specific device name in motion.conf for the first camera and in each thread config file for the other cameras. If you set the video_pipe parameter to '-' in the motion.conf file and not setting it in the thread config files, motion automatically assign video devices in the same sequence as the threads are loaded. You can combine both video_pipe and motion_video_pipe but then naturally you will need twice as many pipes. 
<p />
De-activating should be done with this command
<p />
<code>/sbin/modprobe -r vloopback</code>
<p />
<strong>Description of the motion.conf options related to video loopback device.</strong>
<p />
<p />
<h3><a name="motion_video_pipe"></a> motion_video_pipe </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionMotionVideoPipe" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The video4linux video loopback input device for motion images. If a particular pipe is to be used then use the device filename of this pipe, if a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe. Default: not set
<p />
Using this you can view the results in real time. E.g. by using the program <a href="http://www.smcc.demon.nl/camstream/" rel="nofollow" target="_top">camstream</a>. The difference between this option and the video-pipe option is that this option shows the motion version of the images instead of the normal images.
<p />
Disable this option by not having it in the config file (or comment it out with "#" or ";").
<p />
<p />
<h3><a name="video_pipe"></a> video_pipe </h3>
<p /> <ul>
<li> Type: String
</li> <li> Range / Valid values: Max 4095 characters
</li> <li> Default: Not defined
</li> <li> <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionVideoPipe" class="twikiLink">Option Topic</a>
</li></ul> 
<p />
The video4linux video loopback input device for normal images. If a particular pipe is to be used then use the device filename of this pipe. If a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe.
<p />
Using this you can view the results in real time. E.g. by using the program <a href="http://www.smcc.demon.nl/camstream/" rel="nofollow" target="_top">camstream</a>.
<p />
Disable this option by not having it in the config file (or comment it out with "#" or ";").
<p />
<p />
<p />
<p />
-- <a href="http://www.lavrsen.dk/twiki/bin/view/Main/KennethLavrsen" class="twikiLink">KennethLavrsen</a> - 13 Apr 2005