Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement libcamerify support for motion binary #2765

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open
28 changes: 27 additions & 1 deletion motioneye/motionctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,21 @@ def find_motion():

return _motion_binary_cache

def find_libcamerify():

if settings.LIBCAMERIFY:

if os.path.exists(settings.LIBCAMERIFY):
strips marked this conversation as resolved.
Show resolved Hide resolved
logging.debug(f'Found {settings.LIBCAMERIFY}')
return settings.LIBCAMERIFY

else:
binary = utils.call_subprocess(['which', 'libcamerify'])
if os.path.exists(binary):
logging.debug(f'Found {binary}')
return binary

return None, None
strips marked this conversation as resolved.
Show resolved Hide resolved

def start(deferred=False):
from motioneye import config, mjpgclient
Expand Down Expand Up @@ -99,7 +114,18 @@ def start(deferred=False):
motion_log_path = os.path.join(settings.LOG_PATH, 'motion.log')
motion_pid_path = os.path.join(settings.RUN_PATH, 'motion.pid')

args = [program, '-n', '-c', motion_config_path, '-d']
args = []

libcamerify = find_libcamerify()
if libcamerify:
args.append(libcamerify)
logging.debug('Using libcam wrapper libcamerify')

args.append(program)
args.append('-n')
args.append('-c')
args.append(motion_config_path)
args.append('-d')
strips marked this conversation as resolved.
Show resolved Hide resolved

if settings.LOG_LEVEL <= logging.DEBUG:
args.append('9')
Expand Down
3 changes: 3 additions & 0 deletions motioneye/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
# the TCP port to listen on
PORT = 8765

# Path to libcamerify if libcamera compatability layer/wrapper should be used (default no)
LIBCAMERIFY = None

# path to the motion binary to use (automatically detected by default)
MOTION_BINARY = None

Expand Down