forked from sackmotion/motion
-
Notifications
You must be signed in to change notification settings - Fork 5
/
conf.c
2419 lines (2279 loc) · 76.2 KB
/
conf.c
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
/*
**
** conf.c
**
** I originally wrote conf.c as part of the drpoxy package
** thanks to Matthew Pratt and others for their additions.
**
** Copyright 1999 Jeroen Vreeken (pe1rxq@chello.nl)
**
** This software is licensed under the terms of the GNU General
** Public License (GPL). Please see the file COPYING for details.
**
**
*/
/**
* How to add a config option :
*
* 1. think twice, there are settings enough
*
* 2. add a field to 'struct config' (conf.h) and 'struct config conf'
*
* 4. add a entry to the config_params array below, if your
* option should be configurable by the config file.
*/
#include "motion.h"
#if (defined(BSD) && !defined(PWCBSD))
#include "video_freebsd.h"
#else
#include "video.h"
#endif /* BSD */
#ifndef HAVE_GET_CURRENT_DIR_NAME
char *get_current_dir_name(void)
{
char *buf = mymalloc(MAXPATHLEN);
getwd(buf);
return buf;
}
#endif
#define stripnewline(x) {if ((x)[strlen(x)-1]=='\n') (x)[strlen(x) - 1] = 0; }
struct config conf_template = {
width: DEF_WIDTH,
height: DEF_HEIGHT,
quality: DEF_QUALITY,
rotate_deg: 0,
max_changes: DEF_CHANGES,
threshold_tune: 0,
output_pictures: "on",
motion_img: 0,
emulate_motion: 0,
event_gap: DEF_EVENT_GAP,
max_movie_time: DEF_MAXMOVIETIME,
snapshot_interval: 0,
locate_motion_mode: "off",
locate_motion_style: "box",
input: IN_DEFAULT,
norm: 0,
frame_limit: DEF_MAXFRAMERATE,
quiet: 1,
picture_type: "jpeg",
noise: DEF_NOISELEVEL,
noise_tune: 1,
minimum_frame_time: 0,
lightswitch: 0,
autobright: 0,
brightness: 0,
contrast: 0,
saturation: 0,
hue: 0,
roundrobin_frames: 1,
roundrobin_skip: 1,
pre_capture: 0,
post_capture: 0,
switchfilter: 0,
ffmpeg_output: 0,
extpipe: NULL,
useextpipe: 0,
ffmpeg_output_debug: 0,
ffmpeg_bps: DEF_FFMPEG_BPS,
ffmpeg_vbr: DEF_FFMPEG_VBR,
ffmpeg_video_codec: DEF_FFMPEG_CODEC,
#ifdef HAVE_SDL
sdl_threadnr: 0,
#endif
ipv6_enabled: 0,
stream_port: 0,
stream_quality: 50,
stream_motion: 0,
stream_maxrate: 1,
stream_localhost: 1,
stream_limit: 0,
stream_auth_method: 0,
stream_authentication: NULL,
webcontrol_port: 0,
webcontrol_localhost: 1,
webcontrol_html_output: 1,
webcontrol_authentication: NULL,
frequency: 0,
tuner_number: 0,
timelapse: 0,
timelapse_mode: DEF_TIMELAPSE_MODE,
#if (defined(BSD))
tuner_device: NULL,
#endif
video_device: VIDEO_DEVICE,
v4l2_palette: DEF_PALETTE,
vidpipe: NULL,
filepath: NULL,
imagepath: DEF_IMAGEPATH,
moviepath: DEF_MOVIEPATH,
snappath: DEF_SNAPPATH,
timepath: DEF_TIMEPATH,
on_event_start: NULL,
on_event_end: NULL,
mask_file: NULL,
smart_mask_speed: 0,
#if defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3)
sql_log_image: 1,
sql_log_snapshot: 1,
sql_log_movie: 0,
sql_log_timelapse: 0,
sql_event_start_query: DEF_SQL_START_QUERY,
sql_file_query: DEF_SQL_FILE_QUERY,
database_type: NULL,
database_dbname: NULL,
database_host: "localhost",
database_user: NULL,
database_password: NULL,
database_port: 0,
#ifdef HAVE_SQLITE3
sqlite3_db: NULL,
#endif
#endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || define(HAVE_SQLITE3) */
on_picture_save: NULL,
on_motion_detected: NULL,
on_area_detected: NULL,
on_movie_start: NULL,
on_movie_end: NULL,
on_camera_lost: NULL,
motionvidpipe: NULL,
netcam_url: NULL,
netcam_userpass: NULL,
netcam_keepalive: "off",
netcam_proxy: NULL,
netcam_tolerant_check: 0,
rtsp_uses_tcp: 1,
text_changes: 0,
text_left: NULL,
text_right: DEF_TIMESTAMP,
text_event: DEF_EVENTSTAMP,
text_double: 0,
despeckle_filter: NULL,
area_detect: NULL,
minimum_motion_frames: 1,
exif_text: NULL,
pid_file: NULL,
log_file: NULL,
log_level: LEVEL_DEFAULT+10,
log_type_str: NULL,
};
static struct context **copy_bool(struct context **, const char *, int);
static struct context **copy_int(struct context **, const char *, int);
static struct context **config_thread(struct context **cnt, const char *str, int val);
static const char *print_bool(struct context **, char **, int, unsigned int);
static const char *print_int(struct context **, char **, int, unsigned int);
static const char *print_string(struct context **, char **, int, unsigned int);
static const char *print_thread(struct context **, char **, int, unsigned int);
static void usage(void);
/* Pointer magic to determine relative addresses of variables to a
struct context pointer */
#define CNT_OFFSET(varname) ((long)&((struct context *)NULL)->varname)
#define CONF_OFFSET(varname) ((long)&((struct context *)NULL)->conf.varname)
#define TRACK_OFFSET(varname) ((long)&((struct context *)NULL)->track.varname)
config_param config_params[] = {
{
"daemon",
"############################################################\n"
"# Daemon\n"
"############################################################\n\n"
"# Start in daemon (background) mode and release terminal (default: off)",
1,
CNT_OFFSET(daemon),
copy_bool,
print_bool
},
{
"process_id_file",
"#File to store the process ID, also called pid file. (default: not defined)",
1,
CONF_OFFSET(pid_file),
copy_string,
print_string
},
{
"setup_mode",
"############################################################\n"
"# Basic Setup Mode\n"
"############################################################\n\n"
"# Start in Setup-Mode, daemon disabled. (default: off)",
0,
CONF_OFFSET(setup_mode),
copy_bool,
print_bool
},
{
"logfile",
"# Use a file to save logs messages, if not defined stderr and syslog is used. (default: not defined)",
1,
CONF_OFFSET(log_file),
copy_string,
print_string
},
{
"log_level",
"# Level of log messages [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, ERR, DBG, ALL). (default: 6 / NTC)",
1,
CONF_OFFSET(log_level),
copy_int,
print_int
},
{
"log_type",
"# Filter to log messages by type (COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL)",
1,
CONF_OFFSET(log_type_str),
copy_string,
print_string
},
{
"videodevice",
"\n###########################################################\n"
"# Capture device options\n"
"############################################################\n\n"
"# Videodevice to be used for capturing (default /dev/video0)\n"
"# for FreeBSD default is /dev/bktr0",
0,
CONF_OFFSET(video_device),
copy_string,
print_string
},
{
"v4l2_palette",
"# v4l2_palette allows to choose preferable palette to be use by motion\n"
"# to capture from those supported by your videodevice. (default: 17)\n"
"# E.g. if your videodevice supports both V4L2_PIX_FMT_SBGGR8 and\n"
"# V4L2_PIX_FMT_MJPEG then motion will by default use V4L2_PIX_FMT_MJPEG.\n"
"# Setting v4l2_palette to 2 forces motion to use V4L2_PIX_FMT_SBGGR8\n"
"# instead.\n"
"#\n"
"# Values :\n"
"# V4L2_PIX_FMT_SN9C10X : 0 'S910'\n"
"# V4L2_PIX_FMT_SBGGR16 : 1 'BYR2'\n"
"# V4L2_PIX_FMT_SBGGR8 : 2 'BA81'\n"
"# V4L2_PIX_FMT_SPCA561 : 3 'S561'\n"
"# V4L2_PIX_FMT_SGBRG8 : 4 'GBRG'\n"
"# V4L2_PIX_FMT_SGRBG8 : 5 'GRBG'\n"
"# V4L2_PIX_FMT_PAC207 : 6 'P207'\n"
"# V4L2_PIX_FMT_PJPG : 7 'PJPG'\n"
"# V4L2_PIX_FMT_MJPEG : 8 'MJPEG'\n"
"# V4L2_PIX_FMT_JPEG : 9 'JPEG'\n"
"# V4L2_PIX_FMT_RGB24 : 10 'RGB3'\n"
"# V4L2_PIX_FMT_SPCA501 : 11 'S501'\n"
"# V4L2_PIX_FMT_SPCA505 : 12 'S505'\n"
"# V4L2_PIX_FMT_SPCA508 : 13 'S508'\n"
"# V4L2_PIX_FMT_UYVY : 14 'UYVY'\n"
"# V4L2_PIX_FMT_YUYV : 15 'YUYV'\n"
"# V4L2_PIX_FMT_YUV422P : 16 '422P'\n"
"# V4L2_PIX_FMT_YUV420 : 17 'YU12'\n"
"#",
0,
CONF_OFFSET(v4l2_palette),
copy_int,
print_int
},
#if (defined(BSD))
{
"tunerdevice",
"# Tuner device to be used for capturing using tuner as source (default /dev/tuner0)\n"
"# This is ONLY used for FreeBSD. Leave it commented out for Linux",
0,
CONF_OFFSET(tuner_device),
copy_string,
print_string
},
#endif
{
"input",
"# The video input to be used (default: -1)\n"
"# Should normally be set to 0 or 1 for video/TV cards, and -1 for USB cameras",
0,
CONF_OFFSET(input),
copy_int,
print_int
},
{
"norm",
"# The video norm to use (only for video capture and TV tuner cards)\n"
"# Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL)",
0,
CONF_OFFSET(norm),
copy_int,
print_int
},
{
"frequency",
"# The frequency to set the tuner to (kHz) (only for TV tuner cards) (default: 0)",
0,
CONF_OFFSET(frequency),
copy_int,
print_int
},
{
"rotate",
"# Rotate image this number of degrees. The rotation affects all saved images as\n"
"# well as movies. Valid values: 0 (default = no rotation), 90, 180 and 270.",
0,
CONF_OFFSET(rotate_deg),
copy_int,
print_int
},
{
"width",
"# Image width (pixels). Valid range: Camera dependent, default: 352",
0,
CONF_OFFSET(width),
copy_int,
print_int
},
{
"height",
"# Image height (pixels). Valid range: Camera dependent, default: 288",
0,
CONF_OFFSET(height),
copy_int,
print_int
},
{
"framerate",
"# Maximum number of frames to be captured per second.\n"
"# Valid range: 2-100. Default: 100 (almost no limit).",
0,
CONF_OFFSET(frame_limit),
copy_int,
print_int
},
{
"minimum_frame_time",
"# Minimum time in seconds between capturing picture frames from the camera.\n"
"# Default: 0 = disabled - the capture rate is given by the camera framerate.\n"
"# This option is used when you want to capture images at a rate lower than 2 per second.",
0,
CONF_OFFSET(minimum_frame_time),
copy_int,
print_int
},
{
"netcam_url",
"# URL to use if you are using a network camera, size will be autodetected (incl http:// ftp:// mjpg:// or file:///)\n"
"# Must be a URL that returns single jpeg pictures or a raw mjpeg stream. Default: Not defined",
0,
CONF_OFFSET(netcam_url),
copy_string,
print_string
},
{
"netcam_userpass",
"# Username and password for network camera (only if required). Default: not defined\n"
"# Syntax is user:password",
0,
CONF_OFFSET(netcam_userpass),
copy_string,
print_string
},
{
"netcam_keepalive",
"# The setting for keep-alive of network socket, should improve performance on compatible net cameras.\n"
"# off: The historical implementation using HTTP/1.0, closing the socket after each http request.\n"
"# force: Use HTTP/1.0 requests with keep alive header to reuse the same connection.\n"
"# on: Use HTTP/1.1 requests that support keep alive as default.\n"
"# Default: off",
0,
CONF_OFFSET(netcam_keepalive),
copy_string,
print_string
},
{
"netcam_proxy",
"# URL to use for a netcam proxy server, if required, e.g. \"http://myproxy\".\n"
"# If a port number other than 80 is needed, use \"http://myproxy:1234\".\n"
"# Default: not defined",
0,
CONF_OFFSET(netcam_proxy),
copy_string,
print_string
},
{
"netcam_tolerant_check",
"# Set less strict jpeg checks for network cameras with a poor/buggy firmware.\n"
"# Default: off",
0,
CONF_OFFSET(netcam_tolerant_check),
copy_bool,
print_bool
},
{
"rtsp_uses_tcp",
"# RTSP connection uses TCP to communicate to the camera. Can prevent image corruption.\n"
"# Default: on",
1,
CONF_OFFSET(rtsp_uses_tcp),
copy_bool,
print_bool
},
{
"auto_brightness",
"# Let motion regulate the brightness of a video device (default: off).\n"
"# The auto_brightness feature uses the brightness option as its target value.\n"
"# If brightness is zero auto_brightness will adjust to average brightness value 128.\n"
"# Only recommended for cameras without auto brightness",
0,
CONF_OFFSET(autobright),
copy_bool,
print_bool
},
{
"brightness",
"# Set the initial brightness of a video device.\n"
"# If auto_brightness is enabled, this value defines the average brightness level\n"
"# which Motion will try and adjust to.\n"
"# Valid range 0-255, default 0 = disabled",
0,
CONF_OFFSET(brightness),
copy_int,
print_int
},
{
"contrast",
"# Set the contrast of a video device.\n"
"# Valid range 0-255, default 0 = disabled",
0,
CONF_OFFSET(contrast),
copy_int,
print_int
},
{
"saturation",
"# Set the saturation of a video device.\n"
"# Valid range 0-255, default 0 = disabled",
0,
CONF_OFFSET(saturation),
copy_int,
print_int
},
{
"hue",
"# Set the hue of a video device (NTSC feature).\n"
"# Valid range 0-255, default 0 = disabled",
0,
CONF_OFFSET(hue),
copy_int,
print_int
},
{
"roundrobin_frames",
"\n############################################################\n"
"# Round Robin (multiple inputs on same video device name)\n"
"############################################################\n\n"
"# Number of frames to capture in each roundrobin step (default: 1)",
0,
CONF_OFFSET(roundrobin_frames),
copy_int,
print_int
},
{
"roundrobin_skip",
"# Number of frames to skip before each roundrobin step (default: 1)",
0,
CONF_OFFSET(roundrobin_skip),
copy_int,
print_int
},
{
"switchfilter",
"# Try to filter out noise generated by roundrobin (default: off)",
0,
CONF_OFFSET(switchfilter),
copy_bool,
print_bool
},
{
"threshold",
"\n############################################################\n"
"# Motion Detection Settings:\n"
"############################################################\n\n"
"# Threshold for number of changed pixels in an image that\n"
"# triggers motion detection (default: 1500)",
0,
CONF_OFFSET(max_changes),
copy_int,
print_int
},
{
"threshold_tune",
"# Automatically tune the threshold down if possible (default: off)",
0,
CONF_OFFSET(threshold_tune),
copy_bool,
print_bool
},
{
"noise_level",
"# Noise threshold for the motion detection (default: 32)",
0,
CONF_OFFSET(noise),
copy_int,
print_int
},
{
"noise_tune",
"# Automatically tune the noise threshold (default: on)",
0,
CONF_OFFSET(noise_tune),
copy_bool,
print_bool
},
{
"despeckle_filter",
"# Despeckle motion image using (e)rode or (d)ilate or (l)abel (Default: not defined)\n"
"# Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid.\n"
"# (l)abeling must only be used once and the 'l' must be the last letter.\n"
"# Comment out to disable",
0,
CONF_OFFSET(despeckle_filter),
copy_string,
print_string
},
{
"area_detect",
"# Detect motion in predefined areas (1 - 9). Areas are numbered like that: 1 2 3\n"
"# A script (on_area_detected) is started immediately when motion is 4 5 6\n"
"# detected in one of the given areas, but only once during an event. 7 8 9\n"
"# One or more areas can be specified with this option. Take care: This option\n"
"# does NOT restrict detection to these areas! (Default: not defined)",
0,
CONF_OFFSET(area_detect),
copy_string,
print_string
},
{
"mask_file",
"# PGM file to use as a sensitivity mask.\n"
"# Full path name to. (Default: not defined)",
0,
CONF_OFFSET(mask_file),
copy_string,
print_string
},
{
"smart_mask_speed",
"# Dynamically create a mask file during operation (default: 0)\n"
"# Adjust speed of mask changes from 0 (off) to 10 (fast)",
0,
CONF_OFFSET(smart_mask_speed),
copy_int,
print_int
},
{
"lightswitch",
"# Ignore sudden massive light intensity changes given as a percentage of the picture\n"
"# area that changed intensity. If set to 1, motion will do some kind of\n"
"# auto-lightswitch. Valid range: 0 - 100 , default: 0 = disabled",
0,
CONF_OFFSET(lightswitch),
copy_int,
print_int
},
{
"minimum_motion_frames",
"# Picture frames must contain motion at least the specified number of frames\n"
"# in a row before they are detected as true motion. At the default of 1, all\n"
"# motion is detected. Valid range: 1 to thousands, recommended 1-5",
0,
CONF_OFFSET(minimum_motion_frames),
copy_int,
print_int
},
{
"pre_capture",
"# Specifies the number of pre-captured (buffered) pictures from before motion\n"
"# was detected that will be output at motion detection.\n"
"# Recommended range: 0 to 5 (default: 0)\n"
"# Do not use large values! Large values will cause Motion to skip video frames and\n"
"# cause unsmooth movies. To smooth movies use larger values of post_capture instead.",
0,
CONF_OFFSET(pre_capture),
copy_int,
print_int
},
{
"post_capture",
"# Number of frames to capture after motion is no longer detected (default: 0)",
0,
CONF_OFFSET(post_capture),
copy_int,
print_int
},
{
"event_gap",
"# Event Gap is the seconds of no motion detection that triggers the end of an event.\n"
"# An event is defined as a series of motion images taken within a short timeframe.\n"
"# Recommended value is 60 seconds (Default). The value -1 is allowed and disables\n"
"# events causing all Motion to be written to one single movie file and no pre_capture.\n"
"# If set to 0, motion is running in gapless mode. Movies don't have gaps anymore. An\n"
"# event ends right after no more motion is detected and post_capture is over.",
0,
CONF_OFFSET(event_gap),
copy_int,
print_int
},
{
"max_movie_time",
"# Maximum length in seconds of a movie\n"
"# When value is exceeded a new movie file is created. (Default: 0 = infinite)",
0,
CONF_OFFSET(max_movie_time),
copy_int,
print_int
},
{
"emulate_motion",
"# Always save images even if there was no motion (default: off)",
0,
CONF_OFFSET(emulate_motion),
copy_bool,
print_bool
},
{
"output_pictures",
"\n############################################################\n"
"# Image File Output\n"
"############################################################\n\n"
"# Output 'normal' pictures when motion is detected (default: on)\n"
"# Valid values: on, off, first, best, center\n"
"# When set to 'first', only the first picture of an event is saved.\n"
"# Picture with most motion of an event is saved when set to 'best'.\n"
"# Picture with motion nearest center of picture is saved when set to 'center'.\n"
"# Can be used as preview shot for the corresponding movie.",
0,
CONF_OFFSET(output_pictures),
copy_string,
print_string
},
{
"output_debug_pictures",
"# Output pictures with only the pixels moving object (ghost images) (default: off)",
0,
CONF_OFFSET(motion_img),
copy_bool,
print_bool
},
{
"quality",
"# The quality (in percent) to be used by the jpeg compression (default: 75)",
0,
CONF_OFFSET(quality),
copy_int,
print_int
},
{
"picture_type",
"# Type of output images\n"
"# Valid values: jpeg, ppm (default: jpeg)",
0,
CONF_OFFSET(picture_type),
copy_string,
print_string
},
#ifdef HAVE_FFMPEG
{
"ffmpeg_output_movies",
"\n############################################################\n"
"# FFMPEG related options\n"
"# Film (movie) file output, and deinterlacing of the video input\n"
"# The options movie_filename and timelapse_filename are also used\n"
"# by the ffmpeg feature\n"
"############################################################\n\n"
"# Use ffmpeg to encode movies in realtime (default: off)",
0,
CONF_OFFSET(ffmpeg_output),
copy_bool,
print_bool
},
{
"ffmpeg_output_debug_movies",
"# Use ffmpeg to make movies with only the pixels moving\n"
"# object (ghost images) (default: off)",
0,
CONF_OFFSET(ffmpeg_output_debug),
copy_bool,
print_bool
},
{
"ffmpeg_timelapse",
"# Use ffmpeg to encode a timelapse movie\n"
"# Default value 0 = off - else save frame every Nth second",
0,
CONF_OFFSET(timelapse),
copy_int,
print_int
},
{
"ffmpeg_timelapse_mode",
"# The file rollover mode of the timelapse video\n"
"# Valid values: hourly, daily (default), weekly-sunday, weekly-monday, monthly, manual",
0,
CONF_OFFSET(timelapse_mode),
copy_string,
print_string
},
{
"ffmpeg_bps",
"# Bitrate to be used by the ffmpeg encoder (default: 400000)\n"
"# This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled)",
0,
CONF_OFFSET(ffmpeg_bps),
copy_int,
print_int
},
{
"ffmpeg_variable_bitrate",
"# Enables and defines variable bitrate for the ffmpeg encoder.\n"
"# ffmpeg_bps is ignored if variable bitrate is enabled.\n"
"# Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps,\n"
"# or the range 2 - 31 where 2 means best quality and 31 is worst.",
0,
CONF_OFFSET(ffmpeg_vbr),
copy_int,
print_int
},
{
"ffmpeg_video_codec",
"# Codec to used by ffmpeg for the video compression.\n"
"# Timelapse movies are always made in mpeg1 format independent from this option.\n"
"# Supported formats are: mpeg1 (ffmpeg-0.4.8 only), mpeg4 (default), and msmpeg4.\n"
"# mpeg1 - gives you files with extension .mpg\n"
"# mpeg4 or msmpeg4 - gives you files with extension .avi\n"
"# msmpeg4 is recommended for use with Windows Media Player because\n"
"# it requires no installation of codec on the Windows client.\n"
"# swf - gives you a flash film with extension .swf\n"
"# flv - gives you a flash video with extension .flv\n"
"# ffv1 - FF video codec 1 for Lossless Encoding ( experimental )\n"
"# mov - QuickTime ( testing )\n"
"# ogg - Ogg/Theora ( testing )",
0,
CONF_OFFSET(ffmpeg_video_codec),
copy_string,
print_string
},
{
"ffmpeg_deinterlace",
"# Use ffmpeg to deinterlace video. Necessary if you use an analog camera\n"
"# and see horizontal combing on moving objects in video or pictures.\n"
"# (default: off)",
0,
CONF_OFFSET(ffmpeg_deinterlace),
copy_bool,
print_bool
},
#endif /* HAVE_FFMPEG */
#ifdef HAVE_SDL
{
"sdl_threadnr",
"\n############################################################\n"
"# SDL Window\n"
"############################################################\n\n"
"# Number of motion thread to show in SDL Window (default: 0 = disabled)",
1,
CONF_OFFSET(sdl_threadnr),
copy_int,
print_int
},
#endif /* HAVE_SDL */
{
"use_extpipe",
"\n############################################################\n"
"# External pipe to video encoder\n"
"# Replacement for FFMPEG builtin encoder for ffmpeg_output_movies only.\n"
"# The options movie_filename and timelapse_filename are also used\n"
"# by the ffmpeg feature\n"
"############################################################\n\n"
"# Bool to enable or disable extpipe (default: off)",
0,
CONF_OFFSET(useextpipe),
copy_bool,
print_bool
},
{
"extpipe",
"# External program (full path and opts) to pipe raw video to\n"
"# Generally, use '-' for STDIN...",
0,
CONF_OFFSET(extpipe),
copy_string,
print_string
},
{
"snapshot_interval",
"\n############################################################\n"
"# Snapshots (Traditional Periodic Webcam File Output)\n"
"############################################################\n\n"
"# Make automated snapshot every N seconds (default: 0 = disabled)",
0,
CONF_OFFSET(snapshot_interval),
copy_int,
print_int
},
{
"locate_motion_mode",
"\n############################################################\n"
"# Text Display\n"
"# %Y = year, %m = month, %d = date,\n"
"# %H = hour, %M = minute, %S = second, %T = HH:MM:SS,\n"
"# %v = event, %q = frame number, %t = thread (camera) number,\n"
"# %D = changed pixels, %N = noise level, \\n = new line,\n"
"# %i and %J = width and height of motion area,\n"
"# %K and %L = X and Y coordinates of motion center\n"
"# %C = value defined by text_event - do not use with text_event!\n"
"# You can put quotation marks around the text to allow\n"
"# leading spaces\n"
"############################################################\n\n"
"# Locate and draw a box around the moving object.\n"
"# Valid values: on, off, preview (default: off)\n"
"# Set to 'preview' will only draw a box in preview_shot pictures.",
0,
CONF_OFFSET(locate_motion_mode),
copy_string,
print_string
},
{
"locate_motion_style",
"# Set the look and style of the locate box if enabled.\n"
"# Valid values: box, redbox, cross, redcross (default: box)\n"
"# Set to 'box' will draw the traditional box.\n"
"# Set to 'redbox' will draw a red box.\n"
"# Set to 'cross' will draw a little cross to mark center.\n"
"# Set to 'redcross' will draw a little red cross to mark center.",
0,
CONF_OFFSET(locate_motion_style),
copy_string,
print_string
},
{
"text_right",
"# Draws the timestamp using same options as C function strftime(3)\n"
"# Default: %Y-%m-%d\\n%T = date in ISO format and time in 24 hour clock\n"
"# Text is placed in lower right corner",
0,
CONF_OFFSET(text_right),
copy_string,
print_string
},
{
"text_left",
"# Draw a user defined text on the images using same options as C function strftime(3)\n"
"# Default: Not defined = no text\n"
"# Text is placed in lower left corner",
0,
CONF_OFFSET(text_left),
copy_string,
print_string
},
{
"text_changes",
"# Draw the number of changed pixed on the images (default: off)\n"
"# Will normally be set to off except when you setup and adjust the motion settings\n"
"# Text is placed in upper right corner",
0,
CONF_OFFSET(text_changes),
copy_bool,
print_bool
},
{
"text_event",
"# This option defines the value of the special event conversion specifier %C\n"
"# You can use any conversion specifier in this option except %C. Date and time\n"
"# values are from the timestamp of the first image in the current event.\n"
"# Default: %Y%m%d%H%M%S\n"
"# The idea is that %C can be used filenames and text_left/right for creating\n"
"# a unique identifier for each event.",
0,
CONF_OFFSET(text_event),
copy_string,
print_string
},
{
"text_double",
"# Draw characters at twice normal size on images. (default: off)",
0,
CONF_OFFSET(text_double),
copy_bool,
print_bool
},
{
"exif_text",
"# Text to include in a JPEG EXIF comment\n"
"# May be any text, including conversion specifiers.\n"
"# The EXIF timestamp is included independent of this text.",
0,
CONF_OFFSET(exif_text),
copy_string,
print_string
},
{
"target_dir",
"\n############################################################\n"
"# Target Directories and filenames For Images And Films\n"
"# For the options snapshot_, picture_, movie_ and timelapse_filename\n"
"# you can use conversion specifiers\n"
"# %Y = year, %m = month, %d = date,\n"
"# %H = hour, %M = minute, %S = second,\n"
"# %v = event, %q = frame number, %t = thread (camera) number,\n"
"# %D = changed pixels, %N = noise level,\n"
"# %i and %J = width and height of motion area,\n"
"# %K and %L = X and Y coordinates of motion center\n"
"# %C = value defined by text_event\n"
"# Quotation marks round string are allowed.\n"
"############################################################\n\n"
"# Target base directory for pictures and films\n"
"# Recommended to use absolute path. (Default: current working directory)",
0,
CONF_OFFSET(filepath),
copy_string,
print_string
},
{
"snapshot_filename",
"# File path for snapshots (jpeg or ppm) relative to target_dir\n"
"# Default: "DEF_SNAPPATH"\n"
"# Default value is equivalent to legacy oldlayout option\n"
"# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-snapshot\n"
"# File extension .jpg or .ppm is automatically added so do not include this.\n"
"# Note: A symbolic link called lastsnap.jpg created in the target_dir will always\n"
"# point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap'",
0,
CONF_OFFSET(snappath),
copy_string,
print_string
},
{
"picture_filename",
"# File path for motion triggered images (jpeg or ppm) relative to target_dir\n"
"# Default: "DEF_IMAGEPATH"\n"
"# Default value is equivalent to legacy oldlayout option\n"
"# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-%q\n"
"# File extension .jpg or .ppm is automatically added so do not include this\n"
"# Set to 'preview' together with best-preview feature enables special naming\n"
"# convention for preview shots. See motion guide for details",
0,
CONF_OFFSET(imagepath),
copy_string,
print_string
},
#ifdef HAVE_FFMPEG
{
"movie_filename",
"# File path for motion triggered ffmpeg films (movies) relative to target_dir\n"
"# Default: "DEF_MOVIEPATH"\n"
"# Default value is equivalent to legacy oldlayout option\n"
"# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H%M%S\n"
"# File extension .mpg or .avi is automatically added so do not include this\n"
"# This option was previously called ffmpeg_filename",
0,
CONF_OFFSET(moviepath),
copy_string,
print_string
},
{
"timelapse_filename",
"# File path for timelapse movies relative to target_dir\n"
"# Default: "DEF_TIMEPATH"\n"
"# Default value is near equivalent to legacy oldlayout option\n"
"# For Motion 3.0 compatible mode choose: %Y/%m/%d-timelapse\n"
"# File extension .mpg is automatically added so do not include this",
0,
CONF_OFFSET(timepath),
copy_string,
print_string
},
#endif /* HAVE_FFMPEG */