Видеонаблюдение
Какой умный дом без видеонаблюдения?
Motion представляет из себя консольную программу со встроенным веб-сервером выводящим по указанному порту в видео поток с устройств video4linux(/dev/video*) в случае обнаружения движения.
После обнаружения движения можно записать происходящее, или выполнить какие нибудь действия с помощью скриптов.
Установка
Установка происходит на ОС AltLinux.
Выполняется стандартная команда
«apt-get install» на установку пакета Motion
apt-get install motion |
Включаем камеру в USB порт , ипроверяем опозналась ли она системой.
#lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 046d:08da Logitech, Inc. QuickCam Messanger
Так же должно появиться устройство в папке /dev/video0
Конфигурационный файл
Расположение /etc/motion
Этот файл хорошо откоменирован, и если у вас нет проблем с английским, то понять смысл опций для вас не составит труда. Но все же для себя я небольшую часть перевел.
# motion.conf # Это конфигурационный файл для motion версии 3.2.12 ####################################################### # Daemon ####################################################### # Start in daemon (background) mode and release terminal #(default: off) daemon on # Файл для хранения идентификатора процесса, также # называемый PID файла. (По умолчанию: не определен) process_id_file /var/run/motion/motion.pid ######################################################## # Основной режим установки ######################################################## # Запуск в режиме демона. !!!Быть очень внимательным, # возможно появление артефактов, или пропадании # изображения!!! # Start in Setup-Mode, daemon disabled. (default: off) setup_mode off ####################################################### # Опции захватывающего устройства ####################################################### # Устройство для захвата видео - если камера одна - # оставить как есть, иначе добавить необходимые # устройства по необходимости videodevice /dev/video0 # v4l2_palette allows to choose preferable palette to # be use by motion to capture from those supported # by your videodevice. (default: 8) # E.g. if your videodevice supports both # V4L2_PIX_FMT_SBGGR8 and # V4L2_PIX_FMT_MJPEG then motion will by default use # V4L2_PIX_FMT_MJPEG. # Setting v4l2_palette to 1 forces motion to use # V4L2_PIX_FMT_SBGGR8 # instead. # # Values : # V4L2_PIX_FMT_SN9C10X : 0 'S910' # V4L2_PIX_FMT_SBGGR8 : 1 'BA81' # V4L2_PIX_FMT_MJPEG : 2 'MJPEG' # V4L2_PIX_FMT_JPEG : 3 'JPEG' # V4L2_PIX_FMT_RGB24 : 4 'RGB3' # V4L2_PIX_FMT_UYVY : 5 'UYVY' # V4L2_PIX_FMT_YUYV : 6 'YUYV' # V4L2_PIX_FMT_YUV422P : 7 '422P' # V4L2_PIX_FMT_YUV420 : 8 'YU12' v4l2_palette 3 # Tuner device to be used for capturing using tuner as # source (default /dev/tuner0) # This is ONLY used for FreeBSD. Leave it commented out # for Linux ; tunerdevice /dev/tuner0 # Какой вход для видео использовать. В случае # USB-камеры оставить как есть. # Для видео/TV карты обычно устанавливается 0 или 1 # (default: 8) input 8 # Используемый видео стандарт (только для захвата видео # и карты ТВ-тюнера) # Варианты: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no # colour). # По умолчанию: 0 (PAL) norm 0 # Частота установки тюнера(КГц) (только для карт TV #тюнера) #(По умолчанию: 0) frequency 0 # Поворот изображения. Вращение влияет на всё сохраненное # видео и изображения. # Допустимые значения: 0 (По умолчанию = no rotation), # 90, 180 и 270. rotate 180 # Разрешение видео, выдаваемое камерой - # отредактировать в соответствии с характеристиками # своей камеры # Ширина изображения (в пикселях). Возможые значения: # Camera dependent, default: 352 width 640 # Высота изображения (в пикселях). Возможные значения: # Camera dependent, default: 288 height 480 # Число кадров в секунду - опять же в соответствии с # характеристиками камеры.Для PAL стандартное # значение - 25 кадров/с # Возможные значения: 2-100. По умолчанию: 100 # (almost no limit). framerate 25 # Minimum time in seconds between capturing picture # frames from the camera. # Default: 0 = disabled - the capture rate is given by # the camera framerate. This option is used when you want # to capture images at a rate lower # than 2 per second. minimum_frame_time 0 # Если вы используете сетевую камеру, поставьте её URL, # размер подстроится автоматически (http:// ftp:// # или file:///) Может быть URL который возвращает # отдельные изображения или raw # поток mjpeg. По умолчанию: не определено ; netcam_url value # Имя пользователя и пароль для сетевой камеры # (если требуется). По умолчанию: не определен # Синтаксис user:password ; netcam_userpass value # The setting for keep-alive of network socket, should # improve performance on compatible net cameras. # 1.0: The historical implementation using # HTTP/1.0, closing the socket after each http request. # keep_alive: Use HTTP/1.0 requests with keep alive # header to reuse the same connection. # 1.1: Use HTTP/1.1 requests that support keep # alive as default. # Default: 1.0 ; netcam_http 1.0 # URL to use for a netcam proxy server, if required, # e.g. "http://myproxy". # If a port number other than 80 is needed, use # "http://myproxy:1234". # Default: not defined ; netcam_proxy value # Set less strict jpeg checks for network cameras with # a poor/buggy firmware. # Default: off netcam_tolerant_check off # Авто регулировка яркости изображения с видео устройства # (По умолчанию: off). # The auto_brightness feature uses the brightness option # as its target value. If brightness is zero # auto_brightness will adjust to average brightness # value 128. Рекомендуется, только для камер без # автоматической яркости auto_brightness on # Установить начальную яркость видеоустройства. # If auto_brightness is enabled, this value defines the # average brightness level # which Motion will try and adjust to. # Допустимый диапазон 0-255, По умолчанию 0 = disabled brightness 0 # Установить контрастность видео устройства. # Возможные значения 0-255, По умолчанию 0 = disabled contrast 0 # Установить насыщенность видео устройства. # Возможные значения 0-255, По умолчанию 0 = disabled saturation 0 # Set the hue of a video device (NTSC feature). # Valid range 0-255, default 0 = disabled hue 0 ####################################################### # Round Robin (multiple inputs on same video device # name) ####################################################### # Number of frames to capture in each roundrobin step # (default: 1) roundrobin_frames 1 # Number of frames to skip before each roundrobin step # (default: 1) roundrobin_skip 1 # Try to filter out noise generated by roundrobin # (default: off) switchfilter off ######################################################## # Настройки обнаружения движения: ######################################################## # Секция “Motion Detection Settings”, отвечает за тонкую # настройку обнаружения движущихся объектов. # Если камера стоит в небольшой комнате, и размеры # движущихся предметов большие, проблем с обнаружением # нет. # Вмешательство потребуется в том случае, когда камера # контролирует большую территорию, где объект имеет # относительно маленький размер, и срабатывание может # быть вызвано колыханием веток деревьев, проезжающими # машинами и прочими помехами. На дешевых устройствах # запись может начинаться из-за артефактов, вызванных # искажениями самой камеры или поведением драйвера. # Параметр позволяет указать количество пикселей, которые # должны измениться для срабатывания детектора # (default: 1500) threshold 2500 # Автоматическое значение порога вниз, насколько это # возможно.(По умолчанию: off) threshold_tune off # Отвечает за уровень порога шума(default: 32) noise_level 32 # Автоматическая настройка порога шума. #(По умолчанию: on) noise_tune on # Фильтры для сглаживания шума подключаются при помощи # despeckle. По умолчанию используется оптимальное # значение EedDl. При появлении проблем следует # поэкспериментировать, убирая буквы в сочетании EedDl и # пробуя их в разных комбинациях (подробнее о despeckle # смотри на WiKi Motion и на emit.demon.co.uk/motion). # Despeckle motion image using (e)rode or (d)ilate or # (l)abel (Default: not defined) # Any combination (and number of) of E, e, d, and D is # valid. (l)abeling must only be used once and the 'l' # must be the last letter. # Закоментируйте для отключения despeckle EedDl # Обнаружение движения в заранее определенных областях # (1 - 9). Области нумеруются так: 1 2 3 # Скрипт (on_area_detected) запускается немедленно когда # обнаруживается движение 4 5 6 # в одной из заданной области, но только один раз во # время мероприятия. 7 8 9 # Один или несколько областей могут быть указаны с этой # опцией. (По умолчанию: not defined) ; area_detect value # Параметр mask_file очень полезен. Делаем снимок камерой, # создаем маску, в которой нужная область для # сканирования окрашиваем белым, а все остальное, что нас # не интересует, черным. Сохраняем его в файле формата # pgm и указываем # путь при помощи mask_file. Теперь наличие движения будет # сканироваться # только в закрашенной белым области. # (По умолчанию: not defined) ; mask_file value # Динамическое создание маски файлов во время работы # (По умолчанию: 0) # Отрегулируйте скорость маски, изменяется от 0 # (выключен) до 10 (быстро) smart_mask_speed 0 # Ignore sudden massive light intensity changes given as # a percentage of the picture # area that changed intensity. Valid range: 0 - 100 , # default: 0 = disabled lightswitch 0 # Считается, что обнаружено движение после такого # количества кадров (minimum_motion_frames), # в которых были зафиксированы изменение со значением # параметра threshold # At the default of 1, all motion is detected. # Допустимый диапазон: 1 to 1000, рекомендуется 1-5 minimum_motion_frames 1 # Specifies the number of pre-captured (buffered) # pictures from before motion # was detected that will be output at motion detection. # Рекомендуемый диапазон: 0 to 5 (По умолчанию: 0) # Не используйте большие значения! Large values will # cause Motion to skip video frames and # cause unsmooth mpegs. To smooth mpegs use larger values # of post_capture instead. pre_capture 0 # Number of frames to capture after motion is no longer # detected (default: 0) post_capture 0 # После какого количества секунд отсутствия движения будет # перезапущена запись (а файл перезаписан) # 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. # Recommended value is 60 seconds (Default). The value 0 # is allowed and disables # events causing all Motion to be written to one single # mpeg file and no pre_capture. gap 360 # Ограничение размера файла с записью (в секундах). В #случае ненулевого значения после превышения # лимита будет создаваться новый файл # Maximum length in seconds of an mpeg movie # Когда значение(max_mpeg_time) превышается создается # новый файл видео.(По умолчанию: 0 = бесконечность) max_mpeg_time 600 # Всегда сохранять изображения, даже если не было # никакого движения (по умолчанию: off) output_all off ######################################################## # Image File Output ######################################################## # Варианты сохранения скриншота с движением - все # подряд(on), ни одного(off), первый с начала движения # (first), лучший (best) или с движением ближе к центру # изображения (center).(По умолчанию: on) # Возможные значения: on, off, first, best, center # Picture with most motion of an event is saved when set # to 'best'. Picture with motion nearest center of # picture is saved when set to 'center'. Can be used as # preview shot for the corresponding movie. #output_normal on output_normal best # Output pictures with only the pixels moving object # (ghost images) (default: off) output_motion off # Качество (в процентах), которое будет использоваться # при сжатие в JPEG (по умолчанию: 75) quality 90 # Output ppm images instead of jpeg (default: off) ppm off ####################################################### # FFMPEG related options # Film (mpeg) file output, and deinterlacing of the #video input. The options movie_filename and # timelapse_filename are also used by the ffmpeg feature ####################################################### #Сохранения потока с камеры как видеофайла. # Use ffmpeg to encode mpeg movies in realtime # (default: off) ffmpeg_cap_new on # Use ffmpeg to make movies with only the pixels moving # object (ghost images) (default: off) ffmpeg_cap_motion off # Use ffmpeg to encode a timelapse movie # Default value 0 = off - else save frame every Nth # second ffmpeg_timelapse 0 # Сколько времени в (секундах) вести запись в один # файл.После превышения предела создается новый # файл. # The file rollover mode of the timelapse video # Возможные значения: hourly(ежечасно), daily # (ежедневно,default), weekly-sunday(еженедельно, #ачало недели в воскресенье), # weekly-monday(аналогично с началом в понедельник), # monthly(ежемесячно), manual(вручную) ffmpeg_timelapse_mode hourly # Bitrate to be used by the ffmpeg encoder # (default: 400000) # This option is ignored if ffmpeg_variable_bitrate # is not 0 (disabled) ffmpeg_bps 500000 # 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. ffmpeg_variable_bitrate 0 # Выбор кодека, которым будет обработан сохраняемый # видеопоток. Выбранный кодек должен быть установлен # в системе, иначе при запуске Motion будет выдавать # ошибку. # Codec to used by ffmpeg for the video compression. # Timelapse mpegs are always made in mpeg1 format # independent from this option. # Supported formats are: mpeg1 (ffmpeg-0.4.8 only), # mpeg4 (default), and msmpeg4. # mpeg1 - gives you files with extension .mpg # mpeg4 or msmpeg4 - gives you files with # extension .avi # msmpeg4 is recommended for use with Windows Media # Player because # it requires no installation of codec on the # Windows client. # swf - gives you a flash film with extension .swf # flv - gives you a flash video with extension .flv # ffv1 - FF video codec 1 for Lossless Encoding # ( experimental ) # mov - QuickTime ( testing ) ffmpeg_video_codec mpeg4 # Если появляются искажения, можно попробывать # включить. Я прбывал когда у меня было нормальное # изображение из любопытства. Никакой разницы не заметил # Use ffmpeg to deinterlace video. Necessary if you use # an analog camera # and see horizontal combing on moving objects in video # or pictures. # (По умолчанию: off) #ffmpeg_deinterlace off ######################################################## # Snapshots (Traditional Periodic Webcam File Output) ######################################################## # Делать снимки с периодом (секунд), независимо есть # движение или нет.(По умолчанию: 0 = выключено) snapshot_interval 120 ######################################################## # Text Display # %Y = year, %m = month, %d = date, # %H = hour, %M = minute, %S = second, %T = HH:MM:SS, # %v = event, %q = frame number, %t = thread (camera) # number, # %D = changed pixels, %N = noise level, n = new line, # %i and %J = width and height of motion area, # %K and %L = X and Y coordinates of motion center # %C = value defined by text_event - do not use with # text_event! # You can put quotation marks around the text to allow # leading spaces ######################################################### #Активация locate будет выделять на снимке движущийся # объект. # Locate and draw a box around the moving object. # Valid values: on, off and preview (По умолчанию: off) # Set to 'preview' will only draw a box in preview_shot # pictures. locate on # Draws the timestamp using same options as C function # strftime(3) # Default: %Y-%m-%dn%T = date in ISO format and time in # 24 hour clock # Text is placed in lower right corner text_right %d-%m-%Yn%T-%q # Draw a user defined text on the images using same # options as C function strftime(3) # По умолчанию: Not defined = no text # Text is placed in lower left corner # text_left CAMERA %t text_left CAMERA KAPMAH # Draw the number of changed pixed on the images #(По умолчанию: off) # Will normally be set to off except when you setup # and adjust the motion settings # Текст помещается в верхнем правом углу text_changes off # This option defines the value of the special 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. # Default: %Y%m%d%H%M%S # The idea is that %C can be used filenames and # text_left/right for creating # a unique identifier for each event. text_event %d.%m.%Y_%H:%M:%S # Увеличиваем размер отображения текста на экране. # (По умолчанию: off) text_double on ######################################################## # Target Directories and filenames For Images And Films # For the options snapshot_, jpeg_, mpeg_ and # timelapse_filename you can use conversion specifiers # %Y = year, %m = month, %d = date, # %H = hour, %M = minute, %S = second, # %v = event, %q = frame number, %t = thread (camera) # number, # %D = changed pixels, %N = noise level, # %i and %J = width and height of motion area, # %K and %L = X and Y coordinates of motion center # %C = value defined by text_event # Quotation marks round string are allowed. ######################################################## # Target base directory for pictures and films # (Default: current working directory, # target_dir /usr/local/apache2/htdocs/cam1) target_dir /home/andvas/MOTION_VIDEO # File path for snapshots (jpeg or ppm) relative to # target_dir # Default: %v-%Y%m%d%H%M%S-snapshot # Default value is equivalent to legacy oldlayout option # For Motion 3.0 compatible mode choose: # %Y/%m/%d/%H/%M/%S-snapshot # File extension .jpg or .ppm is automatically added so # do not include this. # Note: A symbolic link called lastsnap.jpg created in # the target_dir will always # point to the latest snapshot, unless snapshot_filename # is exactly 'lastsnap' snapshot_filename %v-%d.%m.%Y_%H:%M:%S-snapshot # File path for motion triggered images (jpeg or ppm) # relative to target_dir # Default: %v-%Y%m%d%H%M%S-%q # Default value is equivalent to legacy oldlayout option # For Motion 3.0 compatible mode choose: # %Y/%m/%d/%H/%M/%S-%q # File extension .jpg or .ppm is automatically added so # do not include this # Set to 'preview' together with best-preview feature # enables special naming # convention for preview shots. See motion guide for # details jpeg_filename %v-%d.%m.%Y_%H:%M:%S-%q # File path for motion triggered ffmpeg films (mpeg) # relative to target_dir # Default: %v-%Y%m%d%H%M%S # Default value is equivalent to legacy oldlayout option # For Motion 3.0 compatible mode choose: %Y/%m/%d/%H%M%S # File extension .mpg or .avi is automatically added so # do not include this # This option was previously called ffmpeg_filename movie_filename %v-%d.%m.%Y_%H:%M:%S # File path for timelapse mpegs relative to target_dir # Default: %Y%m%d-timelapse # Default value is near equivalent to legacy oldlayout # option # For Motion 3.0 compatible mode choose: # %Y/%m/%d-timelapse # File extension .mpg is automatically added so do not # include this timelapse_filename %d.%m.%Y-timelapse ######################################################## # Live Webcam Server ######################################################## # Номер порта, на котором будет работать встроенный # http-сервер Motion - при необходимости прописать любой # свободный порт # The mini-http server listens to this port for requests # (По умолчанию: 0 = disabled) webcam_port 8081 #Процент качества для сжимаемых в jpeg изображений с # камеры, которые будут выводиться в браузер # Quality of the jpeg (in percent) images produced # (По умолчанию: 50) webcam_quality 60 #Частота обновления видео в браузере (кадров в секунду) # в случае отсутствия зарегистрированного движения - #если не планируется просматривать изображение с камеры # переодически, то можно отключить. При обнаружении # движения частота #обновления станет равной параметру webcam_maxrate # Output frames at 1 fps when no motion is detected and # increase to the # rate given by webcam_maxrate when motion is detected # (По умолчанию: off) webcam_motion 1 # Частота обновления видео в браузере в случае # регистрации движения программой. # Maximum framerate for webcam streams # (По умолчанию: 1) webcam_maxrate 15 #Разрешить(off) или запретить(on) доступ к просмотру # камеры с удаленных машин. # Restrict webcam connections to localhost only # (По умолчанию: on) webcam_localhost off # Limits the number of images per connection # (По умолчанию: 0 = unlimited) # Number can be defined by multiplying actual webcam # rate by desired number of seconds # Actual webcam rate is the smallest of the numbers # framerate and webcam_maxrate webcam_limit 0 ######################################################## # HTTP Based Control ######################################################## # TCP/IP port for the http server to listen on # (По умолчанию: 0 = disabled) control_port 8080 # Restrict control connections to localhost only # (По умолчанию: on) control_localhost off # Output for http server, select off to choose raw text # plain (По умолчанию: on) control_html_output on # Проверка подлинности для http управления настройками. # Синтаксис username:password # По умолчанию: not defined (Disabled) ; control_authentication username:password ######################################################## # Tracking (Pan/Tilt) ######################################################## # Type of tracker (0=none (По умолчанию), 1=stepper, # 2=iomojo, 3=pwc, 4=generic, 5=uvcvideo) # The generic type enables the definition of motion # center and motion size to # be used with the conversion specifiers for options # like on_motion_detected track_type 0 # Enable auto tracking (По умолчанию: off) track_auto off # Serial port of motor (По умолчанию: none) ; track_port value # Motor number for x-axis (По умолчанию: 0) track_motorx 0 # Motor number for y-axis (По умолчанию: 0) track_motory 0 # Maximum value on x-axis (По умолчанию: 0) track_maxx 0 # Maximum value on y-axis (По умолчанию: 0) track_maxy 0 # ID of an iomojo camera if used (По умолчанию: 0) track_iomojo_id 0 # Angle in degrees the camera moves per step on the # X-axis # with auto-track (По умолчанию: 10) # Currently only used with pwc type cameras track_step_angle_x 10 # Angle in degrees the camera moves per step on the # Y-axis # with auto-track (По умолчанию: 10) # Currently only used with pwc type cameras track_step_angle_y 10 # Delay to wait for after tracking movement as number # of picture frames (По умолчанию: 10) track_move_wait 10 # Speed to set the motor to (stepper motor option) # (По умолчанию: 255) track_speed 255 # Number of steps to make (stepper motor option) # (По умолчанию: 40) track_stepsize 40 ######################################################## # External Commands, Warnings and Logging: # You can use conversion specifiers for the on_xxxx # commands # %Y = year, %m = month, %d = date, # %H = hour, %M = minute, %S = second, # %v = event, %q = frame number, %t = thread (camera) # number, # %D = changed pixels, %N = noise level, # %i and %J = width and height of motion area, # %K and %L = X and Y coordinates of motion center # %C = value defined by text_event # %f = filename with full path # %n = number indicating filetype # Both %f and %n are only defined for on_picture_save, # on_movie_start and on_movie_end # Quotation marks round string are allowed. ######################################################## # Do not sound beeps when detecting motion # (По умолчанию: on) # Note: Motion never beeps when running in daemon mode. quiet on # !!!ВОТ ЗДЕСЬ САМОЕ ИНТЕРЕСНОЕ, МОЖНО УКАЗЫВАТЬ ПУТЬ # К СКРИПТАМ КОТОРЫЕ БУДУТ ЗАПУСКАТЬСЯ # ПРИ СРАБАТЫВАНИЕ НА ОПРЕДЕЛЕННЫЕ СОБЫТИЯ !!! # Команда, которая будет выполняться при наступлении # события, то есть при движении. (По умолчанию: none) # Например можно послать SMS. # An event starts at first motion detected after a # period of no motion defined by gap ; on_event_start value on_event_start /etc/motion/on_motion_detected # Команда, которая будет выполняться, когда событие # заканчивается после периода без движения # (По умолчанию: none). Период без движения #определяется опцией gap. ; on_event_end value # Команда которыя будет выполняться при сохранении # картинки(.ppm|.jpg) (По умолчанию: none) # To give the filename as an argument to a command # append it with %f ; on_picture_save value # Команда, которая будет выполняться, когда # обнаруживается движение кадров (По умолчанию: нет) ; on_motion_detected value # Команда которая будет выполняться, когда # обнаруживается движение в предопределенной области # Необходимо настроить опцию 'area_detect'. # (По умолчанию: none) ; on_area_detected value # Команда, которая будет выполняться, когда # создается видео файл (.mpg|.avi). (По умолчанию: none) # To give the filename as an argument to a command # append it with %f ; on_movie_start value # Команда которая будет выполняться, когда видео файл # (.mpg|.avi) закрывается.(По умолчанию: none) # To give the filename as an argument to a command # append it with %f ; on_movie_end value # Command to be executed when a camera can't be opened # or if it is lost # Команда, которая будет выполнятся, когда камера не # может быть открыта, или потеряна # NOTE: There is situations when motion doesn't detect # a lost camera! # It depends on the driver, some drivers don't detect # a lost camera at all # Some hang the motion thread. Some even hang the PC! # (По умолчанию: none) # ; on_camera_lost value ######################################################## # Common Options For MySQL and PostgreSQL database # features. # Options require the MySQL/PostgreSQL options to be #active also. ######################################################## # Log to the database when creating motion triggered # image file (По умолчанию: on) sql_log_image on # Log to the database when creating a snapshot image # file (По умолчанию: on) sql_log_snapshot on # Log to the database when creating motion triggered # mpeg file (По умолчанию: off) sql_log_mpeg off # Log to the database when creating timelapse mpeg # file (По умолчанию: off) sql_log_timelapse off # SQL строка запроса, которая отправляется в базу # данных # Use same conversion specifiers has for text # features # Additional special conversion specifiers are # %n = the number representing the file_type # %f = filename with full path # По умолчанию value: # insert into security(camera, filename, frame, # file_type, time_stamp, text_event) values('%t', # '%f', '%q', '%n', '%Y-%m-%d %T', '%C') sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') ######################################################## # Опции для базы MySQL ######################################################## # Mysql база данных (По умолчанию: не определена) ; mysql_db value # Хост, на котором находится база данных # (По умолчанию: localhost) ; mysql_host value # Имя учетной записи пользователя для MySQL базы данных # (По умолчанию: не определен) ; mysql_user value # Пароль пользователя для базы данных MySQL # (По умолчанию: не определен) ; mysql_password value ######################################################## # Опции для базы PostgreSQL ######################################################## # PostgreSQL database to log to # (По умолчанию: not defined) ; pgsql_db value # Хост, на котором находится база данных # (По умолчанию: localhost) ; pgsql_host value # Имя учетной записи пользователя для базы данных # PostgreSQL (По умолчанию: не определен) ; pgsql_user value # Пароль пользователя для базы данных PostgreSQL # (По умолчанию: не определен) ; pgsql_password value # Порт на котором находится база данных PostgreSQL # (По умолчанию: 5432) ; pgsql_port 5432 ######################################################## # Video Loopback Device (vloopback project) ######################################################## # Output images to a video4linux loopback device # The value '-' means next available # (По умолчанию: not defined) ; video_pipe value # Output motion images to a video4linux loopback device # The value '-' means next available # (По умолчанию: not defined) ; motion_video_pipe value ######################################################## # Thread config files - One for each camera. # Except if only one camera - You only need this config # file. # If you have more than one camera you MUST define one # thread config file for each camera in addition to this # config file. ######################################################## # Remember: If you have more than one camera you must # have one thread file for each camera. E.g. 2 cameras # requires 3 files: This motion.conf file AND # thread1.conf and thread2.conf. Only put the options # that are unique to each camera in the thread config # files. ; thread /usr/local/etc/thread1.conf ; thread /usr/local/etc/thread2.conf ; thread /usr/local/etc/thread3.conf ; thread /usr/local/etc/thread4.conf Теперь нужно добавить в автозапуск, у себя я добавил в /etc/rc.d/rc.local
/usr/bin/motion |
Сохраняя видео на сервере умного дома не забываем что место у нас ограниченно, поэтому необходимо очищать место каким нибудь простеньким скриптом, добавленным в cron.
0 comments