diff --git a/motioneye/extra/motioneye.conf.sample b/motioneye/extra/motioneye.conf.sample index b5505819f..135acae2e 100644 --- a/motioneye/extra/motioneye.conf.sample +++ b/motioneye/extra/motioneye.conf.sample @@ -20,6 +20,14 @@ listen 0.0.0.0 # the TCP port to listen on port 8765 +# path to libcamerify for backwards compatability when using libcamera +# This should only be used on Raspberry Pi with Bullseye or newer when you can not use the legacy camera libraries like raspicam. +# If you have Raspberry Pi Camera v3 or newer you probably have to use this or some other workaround like a local IP-camera. +# Libcamerify enables a way to access a libcamera-camera using the legacy APIs and will probably not support all if any camera parameters. +# Libcamerify can be installed with "sudo apt install libcamera-tools". +# Warning: needs Motion release newer than release 4.5.1. As of 2023-05-23 Motion needs to be compiled manually. See https://github.com/Motion-Project/motion/issues/1644 +#libcamerify /usr/bin/libcamerify + # path to the motion binary to use (automatically detected if commented) #motion_binary /usr/bin/motion diff --git a/motioneye/motionctl.py b/motioneye/motionctl.py index 272e487af..fb8bba6a2 100644 --- a/motioneye/motionctl.py +++ b/motioneye/motionctl.py @@ -69,6 +69,19 @@ def find_motion(): return _motion_binary_cache +def find_libcamerify(): + if settings.LIBCAMERIFY: + if os.path.exists(settings.LIBCAMERIFY): + 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 def start(deferred=False): from motioneye import config, mjpgclient @@ -100,6 +113,10 @@ def start(deferred=False): motion_pid_path = os.path.join(settings.RUN_PATH, 'motion.pid') args = [program, '-n', '-c', motion_config_path, '-d'] + libcamerify = find_libcamerify() + if libcamerify: + logging.debug('Using libcamera wrapper libcamerify') + args.insert(0, libcamerify) if settings.LOG_LEVEL <= logging.DEBUG: args.append('9') diff --git a/motioneye/settings.py b/motioneye/settings.py index 33b0bb18f..11791fff1 100644 --- a/motioneye/settings.py +++ b/motioneye/settings.py @@ -59,6 +59,14 @@ # the TCP port to listen on PORT = 8765 +# path to libcamerify for backwards compatibility when using libcamera +# This should only be used on Raspberry Pi with Bullseye or newer when you cannot use the legacy camera libraries like raspicam. +# If you have Raspberry Pi Camera v3 or newer you probably have to use this or some other workaround like a local IP-camera. +# Libcamerify enables a way to access a libcamera-camera using the legacy APIs and will probably not support all if any camera parameters. +# Libcamerify can be installed with "sudo apt install libcamera-tools". +# Warning: needs Motion release newer than release 4.5.1. As of 2023-05-23 Motion needs to be compiled manually. See https://github.com/Motion-Project/motion/issues/1644 +LIBCAMERIFY = None + # path to the motion binary to use (automatically detected by default) MOTION_BINARY = None