]> www.vanbest.org Git - motioneye-debian/commitdiff
added support for ffmpeg_output_debug_movies/output_debug_pictures; config cleanups
authorCalin Crisan <ccrisan@gmail.com>
Sun, 13 Nov 2016 16:52:50 +0000 (18:52 +0200)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 13 Nov 2016 16:52:50 +0000 (18:52 +0200)
motioneye/config.py
motioneye/static/js/main.js
motioneye/templates/main.html

index 45b3c3e040eb57763f3e1972a9b3d7c32cb482d8..e4a849f546f37163d4f73f5e5ca0f7f1f7d465dd 100644 (file)
@@ -59,14 +59,65 @@ _EXPONENTIAL_DEF_QUALITY = 511 # about 75%
 _MAX_FFMPEG_VARIABLE_BITRATE = 32767
 
 _KNOWN_MOTION_OPTIONS = set([
-    'auto_brightness', 'brightness', 'contrast', 'emulate_motion', 'event_gap', 'ffmpeg_bps', 'ffmpeg_output_movies', 'ffmpeg_variable_bitrate', 'ffmpeg_video_codec',
-    'framerate', 'height', 'hue', 'lightswitch', 'despeckle_filter', 'locate_motion_mode', 'locate_motion_style', 'minimum_motion_frames', 'movie_filename', 'max_movie_time', 'max_mpeg_time',
-    'noise_level', 'noise_tune', 'on_event_end', 'on_event_start', 'on_movie_end', 'on_picture_save', 'output_pictures', 'picture_filename', 'post_capture', 'pre_capture',
-    'quality', 'rotate', 'saturation', 'snapshot_filename', 'snapshot_interval', 'stream_auth_method', 'stream_authentication', 'stream_localhost', 'stream_maxrate',
-    'stream_motion', 'stream_port', 'stream_quality', 'target_dir', 'text_changes', 'text_double', 'text_left', 'text_right', 'threshold', 'videodevice', 'width',
-    'webcam_localhost', 'webcam_port', 'webcam_maxrate', 'webcam_quality', 'webcam_motion', 'ffmpeg_cap_new', 'output_normal', 'output_motion', 'jpeg_filename', 'output_all',
-    'gap', 'locate', 'netcam_url', 'netcam_userpass', 'netcam_http', 'netcam_tolerant_check', 'netcam_keepalive', 'rtsp_uses_tcp',
-    'mask_file', 'smart_mask_speed'
+    'auto_brightness',
+    'brightness',
+    'contrast',
+    'despeckle_filter',
+    'emulate_motion',
+    'event_gap',
+    'ffmpeg_bps',
+    'ffmpeg_output_debug_movies',
+    'ffmpeg_output_movies',
+    'ffmpeg_variable_bitrate',
+    'ffmpeg_video_codec',
+    'framerate',
+    'height',
+    'hue',
+    'lightswitch',
+    'locate_motion_mode',
+    'locate_motion_style',
+    'mask_file',
+    'max_movie_time',
+    'minimum_motion_frames',
+    'movie_filename',
+    'netcam_keepalive',
+    'netcam_tolerant_check',
+    'netcam_url',
+    'netcam_userpass',
+    'noise_level',
+    'noise_tune',
+    'on_event_end',
+    'on_event_start',
+    'on_movie_end',
+    'on_picture_save',
+    'output_debug_pictures',
+    'output_motion',
+    'output_pictures',
+    'picture_filename',
+    'post_capture',
+    'pre_capture',
+    'quality',
+    'rotate',
+    'rtsp_uses_tcp',
+    'saturation',
+    'smart_mask_speed',
+    'snapshot_filename',
+    'snapshot_interval',
+    'stream_authentication',
+    'stream_auth_method',
+    'stream_localhost',
+    'stream_maxrate',
+    'stream_motion',
+    'stream_port',
+    'stream_quality',
+    'target_dir',
+    'text_changes',
+    'text_double',
+    'text_left',
+    'text_right',
+    'threshold',
+    'videodevice',
+    'width',
 ])
 
 
@@ -311,6 +362,8 @@ def get_camera(camera_id, as_lines=False):
                 camera_config['emulate_motion'] = camera_config.pop('output_all')
             if 'ffmpeg_cap_new' in camera_config:
                 camera_config['ffmpeg_output_movies'] = camera_config.pop('ffmpeg_cap_new')
+            if 'ffmpeg_cap_motion' in camera_config:
+                camera_config['ffmpeg_output_debug_movies'] = camera_config.pop('ffmpeg_cap_motion')
             if 'locate' in camera_config:
                 camera_config['locate_motion_mode'] = camera_config.pop('locate')
             if 'jpeg_filename' in camera_config:
@@ -375,6 +428,8 @@ def set_camera(camera_id, camera_config):
                 camera_config['output_all'] = camera_config.pop('emulate_motion')
             if 'ffmpeg_output_movies' in camera_config:
                 camera_config['ffmpeg_cap_new'] = camera_config.pop('ffmpeg_output_movies')
+            if 'ffmpeg_output_debug_movies' in camera_config:
+                camera_config['ffmpeg_cap_motion'] = camera_config.pop('ffmpeg_output_debug_movies')
             if 'locate_motion_mode' in camera_config:
                 camera_config['locate'] = camera_config.pop('locate_motion_mode')
             if 'picture_filename' in camera_config:
@@ -697,6 +752,8 @@ def motion_camera_ui_to_dict(ui, old_config=None):
         'minimum_motion_frames': int(ui['minimum_motion_frames']),
         'smart_mask_speed': 0,
         'mask_file': '',
+        'output_debug_pictures': ui['create_debug_media'],
+        'ffmpeg_output_debug_movies': ui['create_debug_media'],
         
         # working schedule
         '@working_schedule': '',
@@ -1075,6 +1132,7 @@ def motion_camera_dict_to_ui(data):
         'mask_type': 'smart',
         'smart_mask_sluggishness': 5,
         'mask_lines': [],
+        'create_debug_media': data['ffmpeg_output_debug_movies'] or data['output_debug_pictures'],
         
         # motion notifications
         'email_notifications_enabled': False,
@@ -1818,6 +1876,8 @@ def _set_default_motion_camera(camera_id, data):
     data.setdefault('minimum_motion_frames', 20)
     data.setdefault('smart_mask_speed', 0)
     data.setdefault('mask_file', '')
+    data.setdefault('ffmpeg_output_debug_movies', False)
+    data.setdefault('output_debug_pictures', False)
     
     data.setdefault('pre_capture', 1)
     data.setdefault('post_capture', 1)
index ab2b0030298b08c3617cb5a50be5f10a0da4a165..134e7af8bc631bc3d254e59917e894078045bb2f 100644 (file)
@@ -1857,7 +1857,6 @@ function cameraUi2Dict() {
         
         /* motion detection */
         'motion_detection': $('#motionDetectionEnabledSwitch')[0].checked,
-        'show_frame_changes': $('#showFrameChangesSwitch')[0].checked,
         'frame_change_threshold': $('#frameChangeThresholdSlider').val(),
         'auto_noise_detect': $('#autoNoiseDetectSwitch')[0].checked,
         'noise_level': $('#noiseLevelSlider').val(),
@@ -1871,6 +1870,8 @@ function cameraUi2Dict() {
         'mask_type': $('#maskTypeSelect').val(),
         'smart_mask_sluggishness': $('#smartMaskSluggishnessSlider').val(),
         'mask_lines': $('#maskLinesEntry').val() ? $('#maskLinesEntry').val().split(',').map(function (l) {return parseInt(l);}) : [],
+        'show_frame_changes': $('#showFrameChangesSwitch')[0].checked,
+        'create_debug_media': $('#createDebugMediaSwitch')[0].checked,
 
         /* motion notifications */
         'email_notifications_enabled': $('#emailNotificationsEnabledSwitch')[0].checked,
@@ -2210,7 +2211,6 @@ function dict2CameraUi(dict) {
     
     /* motion detection */
     $('#motionDetectionEnabledSwitch')[0].checked = dict['motion_detection']; markHideIfNull('motion_detection', 'motionDetectionEnabledSwitch');
-    $('#showFrameChangesSwitch')[0].checked = dict['show_frame_changes']; markHideIfNull('show_frame_changes', 'showFrameChangesSwitch');
     $('#frameChangeThresholdSlider').val(dict['frame_change_threshold']); markHideIfNull('frame_change_threshold', 'frameChangeThresholdSlider');
     $('#autoNoiseDetectSwitch')[0].checked = dict['auto_noise_detect']; markHideIfNull('auto_noise_detect', 'autoNoiseDetectSwitch');
     $('#noiseLevelSlider').val(dict['noise_level']); markHideIfNull('noise_level', 'noiseLevelSlider');
@@ -2224,6 +2224,8 @@ function dict2CameraUi(dict) {
     $('#maskTypeSelect').val(dict['mask_type']); markHideIfNull('mask_type', 'maskTypeSelect');
     $('#smartMaskSluggishnessSlider').val(dict['smart_mask_sluggishness']); markHideIfNull('smart_mask_sluggishness', 'smartMaskSluggishnessSlider');
     $('#maskLinesEntry').val((dict['mask_lines'] || []).join(',')); markHideIfNull('mask_lines', 'maskLinesEntry');
+    $('#showFrameChangesSwitch')[0].checked = dict['show_frame_changes']; markHideIfNull('show_frame_changes', 'showFrameChangesSwitch');
+    $('#createDebugMediaSwitch')[0].checked = dict['create_debug_media']; markHideIfNull('create_debug_media', 'createDebugMediaSwitch');
 
     /* motion notifications */
     $('#emailNotificationsEnabledSwitch')[0].checked = dict['email_notifications_enabled']; markHideIfNull('email_notifications_enabled', 'emailNotificationsEnabledSwitch');
index 627fed8211fb2786ee0a79889b25d934a326c28d..fac8930b534fd89ce3cc73612409f1ddeceb1fca 100644 (file)
                     <span class="minimize"></span>
                 </div>
                 <table class="settings advanced-setting">
-                    <tr class="settings-item advanced-setting">
-                        <td class="settings-item-label"><span class="settings-item-label">Show Frame Changes</span></td>
-                        <td class="settings-item-value"><input type="checkbox" class="styled motion-detection camera-config" id="showFrameChangesSwitch"></td>
-                        <td><span class="help-mark" title="if this is enabled, frame changes (number of pixels as well as the changed area) are shown on the video; temporarily enable this option to help adjust the motion detection parameters">?</span></td>
-                    </tr>
                     <tr class="settings-item advanced-setting" min="0" max="20" snap="0" ticksnum="5" decimals="1" unit="%">
                         <td class="settings-item-label"><span class="settings-item-label">Frame Change Threshold</span></td>
                         <td class="settings-item-value"><input type="text" class="range styled motion-detection camera-config" id="frameChangeThresholdSlider"></td>
                         <td class="settings-item-value"><div class="button normal-button clear-mask-button" id="clearMaskButton">Clear Mask</div></td>
                         <td><span class="help-mark" title="click this button to clear the current mask">?</span></td>
                     </tr>
+                    <tr class="settings-item advanced-setting">
+                        <td colspan="100"><div class="settings-item-separator"></div></td>
+                    </tr>
+                    <tr class="settings-item advanced-setting">
+                        <td class="settings-item-label"><span class="settings-item-label">Show Frame Changes</span></td>
+                        <td class="settings-item-value"><input type="checkbox" class="styled motion-detection camera-config" id="showFrameChangesSwitch"></td>
+                        <td><span class="help-mark" title="if this is enabled, frame changes (number of pixels as well as the changed area) are shown on the video; temporarily enable this option to help adjust the motion detection parameters">?</span></td>
+                    </tr>
+                    <tr class="settings-item advanced-setting">
+                        <td class="settings-item-label"><span class="settings-item-label">Create Debug Media Files</span></td>
+                        <td class="settings-item-value"><input type="checkbox" class="styled motion-detection camera-config" id="createDebugMediaSwitch"></td>
+                        <td><span class="help-mark" title="when enabled, creates special movies and pictures that help debugging motion detection problems">?</span></td>
+                    </tr>
                     {% for config in camera_sections.get('motion-detection', {}).get('configs', []) %}
                         {{config_item(config)}}
                     {% endfor %}