--> gunoiul de ffmpeg_variable_bitrate nu merge decat in motion.conf
+-> add/remove camera: apply button still there
--> brightness/contrast/hue/sat on picam1 issue when applying
-> http clients don't die: max_clients limit reached, request queued. 10 active, 217 queued requests.
-> remote adding ui could be improved (cleanup fields on ok/on load, no error message until everything is ok)
-> add a previewer for snapshots
-> add a motioneye.svg icon
+-> implement working schedule (add another combo deciding what to do during working schedule)
-> add other options applicable only to special devices (rpi): wifi settings, notifications
-> group @config rules to top
# add a motion running checker
def checker():
ioloop = tornado.ioloop.IOLoop.instance()
- if not ioloop.running(): # just stopped
+ if ioloop._stopped:
return
-
+
if not motionctl.running() and config.has_enabled_cameras():
- motionctl.start()
- logging.info('motion started')
+ try:
+ motionctl.start()
+ logging.info('motion started')
+
+ except Exception as e:
+ logging.error('failed to start motion: %(msg)s' % {
+ 'msg': unicode(e)})
ioloop.add_timeout(datetime.timedelta(seconds=settings.MOTION_CHECK_INTERVAL), checker)
def do_cleanup():
ioloop = tornado.ioloop.IOLoop.instance()
- if not ioloop.running(): # just stopped
+ if ioloop._stopped:
return
-
+
try:
cleanup.cleanup_images()
cleanup.cleanup_movies()
if 'width' in device_details:
data['width'] = device_details['width']
data['height'] = device_details['height']
+ data['ffmpeg_bps'] = device_details['ffmpeg_bps']
- else:
+ else: # remote
data['@host'] = device_details['host']
data['@port'] = device_details['port']
data['@username'] = device_details['username']
data.setdefault('quality', 75)
data.setdefault('@preserve_images', 0)
- data.setdefault('ffmpeg_variable_bitrate', 14)
+ data.setdefault('ffmpeg_variable_bitrate', 0)
+ data.setdefault('ffmpeg_bps', 400000)
data.setdefault('movie_filename', '%Y-%m-%d-%H-%M-%S')
data.setdefault('ffmpeg_cap_new', False)
data.setdefault('@preserve_movies', 0)
if w > 300:
device_details['width'] = w
device_details['height'] = h
+ # compute the ffmpeg bps
+
+ max_val = w * h * 2 / 3
+ max_val = min(max_val, 9999999)
+ val = max_val * 75 / 100
+ device_details['ffmpeg_bps'] = val
+
break
camera_id, camera_config = config.add_camera(device_details)
'@preserve_images': int(ui.get('preserve_images', 0)),
# movies
- 'ffmpeg_variable_bitrate': 2 + int((100 - int(ui.get('movie_quality', 75))) * 0.29),
'ffmpeg_cap_new': ui.get('motion_movies', False),
'movie_filename': ui.get('movie_file_name', '%Y-%m-%d-%H-%M-%S-%q'),
'@preserve_movies': int(ui.get('preserve_movies', 0)),
data['jpeg_filename'] = ui.get('image_file_name', '%Y-%m-%d-%H-%M-%S')
data['quality'] = max(1, int(ui.get('image_quality', 75)))
+
+ if ui.get('motion_movies'):
+ max_val = data['width'] * data['height'] * data['framerate'] / 3
+ max_val = min(max_val, 9999999)
+ data['ffmpeg_bps'] = int(ui.get('movie_quality', 75)) * max_val / 100
+
if ui.get('working_schedule', False):
data['@working_schedule'] = (
ui.get('monday_from', '') + '-' + ui.get('monday_to') + '|' +
# motion movies
'motion_movies': data.get('ffmpeg_cap_new'),
- 'movie_quality': int((max(2, data.get('ffmpeg_variable_bitrate')) - 2) / 0.29),
'movie_file_name': data.get('movie_filename'),
'preserve_movies': data['@preserve_movies'],
ui['image_file_name'] = jpeg_filename
ui['image_quality'] = ui.get('quality', 75)
+
+ ffmpeg_bps = data.get('ffmpeg_bps')
+ if ffmpeg_bps is not None:
+ max_val = data['width'] * data['height'] * data['framerate'] / 3
+ max_val = min(max_val, 9999999)
+
+ ui['movie_quality'] = min(100, int(round(ffmpeg_bps * 100.0 / max_val)))
working_schedule = data.get('@working_schedule')
if working_schedule: