RPi Camera 3 compatibility #2350

Open
opened 2026-02-28 01:10:12 -05:00 by deekerman · 81 comments
Owner

Originally created by @Firesphere on GitHub (Jan 9, 2023).

Will MotionEye, in its current state, be compatible with the new RPi cam 3?
https://www.raspberrypi.com/news/new-autofocus-camera-modules/

The new Camera Module 3 is only supported by the modern libcamera software environment and by the libcamera-based Picamera2 beta under Raspberry Pi OS Bullseye, and not by the legacy closed-source camera stack

Originally created by @Firesphere on GitHub (Jan 9, 2023). Will MotionEye, in its current state, be compatible with the new RPi cam 3? https://www.raspberrypi.com/news/new-autofocus-camera-modules/ > The new Camera Module 3 is only supported by the modern [libcamera](https://www.raspberrypi.com/documentation/computers/camera_software.html#libcamera-and-libcamera-apps) software environment and by the libcamera-based [Picamera2](https://datasheets.raspberrypi.com/camera/picamera2-manual.pdf) beta under Raspberry Pi OS Bullseye, and not by the [legacy closed-source camera stack](https://www.raspberrypi.com/documentation/computers/camera_software.html#raspicam-applications)
Author
Owner

@hotducker commented on GitHub (Jan 21, 2023):

I just try RPI3b (MotionEyeOS) + RPI Camera 3, It's not work and still find the solution.

@hotducker commented on GitHub (Jan 21, 2023): I just try RPI3b (MotionEyeOS) + RPI Camera 3, It's not work and still find the solution.
Author
Owner

@gpambrozio commented on GitHub (Jan 21, 2023):

I found a way to make it work with the current motioneye version on a pi zero w with the new camera module 3.

First, create a file named motion.sh in /home/pi:

#!/bin/bash

/usr/bin/libcamerify /usr/bin/motion $@

Now, edit your motioneye.conf file (should be in /etc/motioneye) and make sure that the line with motion_binary looks like this:

motion_binary /home/pi/motion.sh

Depending on your debian distribution you might have to also install libcamera-tools with sudo apt-get install libcamera-tools

Now restart motioneye and you can configure your camera as a local camera on /dev/video0

The information that led me to this solution was found here

@gpambrozio commented on GitHub (Jan 21, 2023): I found a way to make it work with the current motioneye version on a pi zero w with the new camera module 3. First, create a file named `motion.sh` in `/home/pi`: ``` #!/bin/bash /usr/bin/libcamerify /usr/bin/motion $@ ``` Now, edit your `motioneye.conf` file (should be in `/etc/motioneye`) and make sure that the line with `motion_binary` looks like this: ``` motion_binary /home/pi/motion.sh ``` Depending on your debian distribution you might have to also install `libcamera-tools` with `sudo apt-get install libcamera-tools` Now restart motioneye and you can configure your camera as a local camera on `/dev/video0` The information that led me to this solution was found [here](https://motion-project.github.io/motion_config.html#basic_setup_picam)
Author
Owner

@MidnightLink commented on GitHub (Jan 21, 2023):

I found a way to make it work with the current motioneye version on a pi zero w with the new camera module 3.

First, create a file named motion.sh in /home/pi:

#!/bin/bash

/usr/bin/libcamerify /usr/bin/motion $@

Now, edit your motioneye.sh file (should be in /etc/motioneye) and make sure that the line with motion_binary looks like this:

motion_binary /home/pi/motion.sh

Now you can configure your camera as a local camera on /dev/video0

The information that led me to this solution was found here

I tried this but unfortunately it doesn't work. A couple things I've noticed, though.

motioneye.sh is actually motioneye.conf and the correct chmod permissions need to be given to the motion.sh

libcamera-tools has to be installed

I edited my camera-1.conf and changed the video device to /dev/video0 and when running libcamera-hello I'm getting a message that the device is in use...so it feels like it's close!

@MidnightLink commented on GitHub (Jan 21, 2023): > I found a way to make it work with the current motioneye version on a pi zero w with the new camera module 3. > > First, create a file named `motion.sh` in `/home/pi`: > > ``` > #!/bin/bash > > /usr/bin/libcamerify /usr/bin/motion $@ > ``` > > Now, edit your `motioneye.sh` file (should be in `/etc/motioneye`) and make sure that the line with `motion_binary` looks like this: > > ``` > motion_binary /home/pi/motion.sh > ``` > > Now you can configure your camera as a local camera on `/dev/video0` > > The information that led me to this solution was found [here](https://motion-project.github.io/motion_config.html#basic_setup_picam) I tried this but unfortunately it doesn't work. A couple things I've noticed, though. `motioneye.sh` is actually `motioneye.conf` and the correct chmod permissions need to be given to the `motion.sh` `libcamera-tools` has to be installed I edited my `camera-1.conf` and changed the video device to `/dev/video0` and when running `libcamera-hello` I'm getting a message that the device is in use...so it feels like it's close!
Author
Owner

@gpambrozio commented on GitHub (Jan 22, 2023):

@MidnightLink I edited my post to correct the file and add the libcamera-tools (I didn't need that as I have the latest debian and it already includes it).

I think your issue is that you can't be running libcamera-hello (or any other application that tries to use the camera) when you start motioneye

@gpambrozio commented on GitHub (Jan 22, 2023): @MidnightLink I edited my post to correct the file and add the `libcamera-tools` (I didn't need that as I have the latest debian and it already includes it). I think your issue is that you can't be running `libcamera-hello` (or any other application that tries to use the camera) when you start motioneye
Author
Owner

@johnm-w commented on GitHub (Jan 26, 2023):

Now restart motioneye and you can configure your camera as a local camera on /dev/video0

Hi @gpambrozio - can you explain how to do this? In MotionEye, Add Camera, I select "Local V4L2 Camera" from the "Camera Type" dropdown, then it lists several options for "Camera". With the module 2 camera, I had to try each one until I found the one that worked, but I can't manually enter a device path.

Also, please can you let me know the exact OS you're running? I tried your fix on Buster & Bullseye with no luck (on an RPi4).

Thanks!

@johnm-w commented on GitHub (Jan 26, 2023): > Now restart motioneye and you can configure your camera as a local camera on `/dev/video0` Hi @gpambrozio - can you explain how to do this? In MotionEye, Add Camera, I select "Local V4L2 Camera" from the "Camera Type" dropdown, then it lists several options for "Camera". With the module 2 camera, I had to try each one until I found the one that worked, but I can't manually enter a device path. Also, please can you let me know the exact OS you're running? I tried your fix on Buster & Bullseye with no luck (on an RPi4). Thanks!
Author
Owner

@gpambrozio commented on GitHub (Jan 27, 2023):

Now restart motioneye and you can configure your camera as a local camera on /dev/video0

Hi @gpambrozio - can you explain how to do this? In MotionEye, Add Camera, I select "Local V4L2 Camera" from the "Camera Type" dropdown, then it lists several options for "Camera". With the module 2 camera, I had to try each one until I found the one that worked, but I can't manually enter a device path.

Best way might be to just pick any cameras, then shutdown motioneye and edit camera-1.conf (probably in /etc/motioneye) and make sure that the videodevice line is videodevice /dev/video0. The start motioneye again.

Also, please can you let me know the exact OS you're running? I tried your fix on Buster & Bullseye with no luck (on an RPi4).

Using bullseye on a pi zero w.

@gpambrozio commented on GitHub (Jan 27, 2023): > > Now restart motioneye and you can configure your camera as a local camera on `/dev/video0` > > Hi @gpambrozio - can you explain how to do this? In MotionEye, Add Camera, I select "Local V4L2 Camera" from the "Camera Type" dropdown, then it lists several options for "Camera". With the module 2 camera, I had to try each one until I found the one that worked, but I can't manually enter a device path. Best way might be to just pick any cameras, then shutdown motioneye and edit `camera-1.conf` (probably in `/etc/motioneye`) and make sure that the `videodevice` line is `videodevice /dev/video0`. The start motioneye again. > Also, please can you let me know the exact OS you're running? I tried your fix on Buster & Bullseye with no luck (on an RPi4). Using bullseye on a pi zero w.
Author
Owner

@MisterEmm commented on GitHub (Jan 27, 2023):

Tried this earlier on a Pi 3B with the latest Bullseye release, fresh install of motioneye, followed the steps above and it works well, I can see the view from the camera via the web interface. For now it doesn't seem to want to let me make any changes, keeps saying "Refresh Recommended" if I try to change resolution or something. I can see the changes reflected in camera-1.conf but the display doesn't change. Will have another poke at it tomorrow, but grateful to have got this far thanks to the previous posts.

@MisterEmm commented on GitHub (Jan 27, 2023): Tried this earlier on a Pi 3B with the latest Bullseye release, fresh install of motioneye, followed the steps above and it works well, I can see the view from the camera via the web interface. For now it doesn't seem to want to let me make any changes, keeps saying "Refresh Recommended" if I try to change resolution or something. I can see the changes reflected in camera-1.conf but the display doesn't change. Will have another poke at it tomorrow, but grateful to have got this far thanks to the previous posts.
Author
Owner

@johnm-w commented on GitHub (Jan 27, 2023):

Thanks @gpambrozio - I have it working to a point now - I can see the camera's feed. Unfortunately:
I don't see all the camera's controls in the Video Device section (like I do with the camera module 2) and performance isn't great.

And like @MisterEmm , If I make any changes via the web app: "An error occurred. Refreshing is recommended." - but refreshing does appear to persist settings

I've also had very similar results running:

libcamera-vid -t 0 --inline -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream1}' :demux=h264

(https://www.raspberrypi.com/documentation/computers/camera_software.html#libcamera-vid)

Then adding the camera as a network camera in motioneye using:

rtsp://localhost:8554/stream1

then selecting the UDP option that appears.

Neither option seems as quite as good as when I'm using the v2 camera - but maybe I just need to experiment/tweak more. Or hopefully someone with the right skills can update motioneye.

Also, @gpambrozio please could you explain what your motion.sh script does?

@johnm-w commented on GitHub (Jan 27, 2023): Thanks @gpambrozio - I have it working to a point now - I can see the camera's feed. Unfortunately: I don't see all the camera's controls in the Video Device section (like I do with the camera module 2) and performance isn't great. And like @MisterEmm , If I make any changes via the web app: "An error occurred. Refreshing is recommended." - but refreshing does appear to persist settings I've also had very similar results running: libcamera-vid -t 0 --inline -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream1}' :demux=h264 (https://www.raspberrypi.com/documentation/computers/camera_software.html#libcamera-vid) Then adding the camera as a network camera in motioneye using: rtsp://localhost:8554/stream1 then selecting the UDP option that appears. Neither option seems as quite as good as when I'm using the v2 camera - but maybe I just need to experiment/tweak more. Or hopefully someone with the right skills can update motioneye. Also, @gpambrozio please could you explain what your motion.sh script does?
Author
Owner

@gpambrozio commented on GitHub (Jan 27, 2023):

@johnm-w motion.sh is a wrapper to make motion use libcamerify as described in this document. Without that /dev/video0 doesn't work as motion expects it.

I tried just changing motion_binary to libcamerify motion but that doesn't work so I created this simple script to trick motioneye.

@gpambrozio commented on GitHub (Jan 27, 2023): @johnm-w `motion.sh` is a wrapper to make motion use `libcamerify` as described in [this document](https://motion-project.github.io/motion_config.html#basic_setup_picam). Without that `/dev/video0` doesn't work as motion expects it. I tried just changing `motion_binary` to `libcamerify motion` but that doesn't work so I created this simple script to trick motioneye.
Author
Owner

@ReneMuetti commented on GitHub (Jan 28, 2023):

I have proceeded according to these instructions. The camera can now be integrated into MotionEye and a picture is displayed.
https://github.com/motioneye-project/motioneye/issues/2683#issuecomment-1399367885
but unfortunately errors are still written to the log file:

[0:motion] [NTC] [ALL] conf_load: Processing thread 0 - config file /etc/motioneye/motion.conf
[0:motion] [NTC] [ALL] config_camera: Processing camera config file camera-1.conf
[0:motion] [NTC] [ALL] motion_startup: Logging to syslog
[0:motion] [NTC] [ALL] motion_startup: Motion 4.3.2 Started
[0:motion] [NTC] [ALL] motion_startup: Using default log type (ALL)
[0:motion] [NTC] [ALL] motion_startup: Using log type (ALL) log level (WRN)
[2:22:53.594696843] [21329]  INFO Camera camera_manager.cpp:299 libcamera v0.0.3+40-9b860a66
[2:22:53.617144741] [21330] ERROR V4L2 v4l2_device.cpp:352 'imx708_wide': Unable to set controls: Das Gerät oder die Ressource ist belegt
[2:22:53.619075612] [21330]  WARN CameraSensorProperties camera_sensor_properties.cpp:205 No static properties available for 'imx708_wide'
[2:22:53.619170872] [21330]  WARN CameraSensorProperties camera_sensor_properties.cpp:207 Please consider updating the camera sensor properties database
[2:22:53.665191035] [21330]  INFO RPI raspberrypi.cpp:1425 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media3 and ISP device /dev/media0
[2:22:53.665626136] [21329]  INFO Camera camera.cpp:841 Pipeline handler in use by another process
[2:22:53.665809312] [21329] ERROR V4L2Compat v4l2_camera.cpp:34 Failed to acquire camera
/home/pi/motion.sh: Zeile 3: 21328 Speicherzugriffsfehler  /usr/bin/libcamerify /usr/bin/motion $@

i also couldn't find out yet why the vido is so jerky ...
and how I activate the nightvision mode I have also not yet figured out

I also noticed that after starting MotionEye the camera is addressed completely wrong. The settings from the file /usr/share/libcamera/ipa/raspberrypi/imx708_wide.json were all deleted again.

this is how it looks directly after the import.

libcamera-hello --list-camera
Available cameras
-----------------
0 : imx708_wide [4608x2592] (/base/soc/i2c0mux/i2c@1/imx708@1a)
    Modes: 'SRGGB10_CSI2P' : 1536x864 [120.13 fps - (768, 432)/3072x1728 crop]
                             2304x1296 [56.03 fps - (0, 0)/4608x2592 crop]
                             4608x2592 [14.35 fps - (0, 0)/4608x2592 crop]

After starting MotionEye everything is gone again.

libcamera-hello --list-camera
Available cameras
-----------------
0 : imx708_wide [4608x2592] (/base/soc/i2c0mux/i2c@1/imx708@1a)
    Modes: 'SBGGR10_CSI2P' : 1536x864 [30.00 fps - (0, 0)/0x0 crop]
                             2304x1296 [30.00 fps - (0, 0)/0x0 crop]
                             4608x2592 [30.00 fps - (0, 0)/0x0 crop]

Service-Status:

systemctl status motioneye.service
● motioneye.service - motionEye Server
     Loaded: loaded (/etc/systemd/system/motioneye.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-01-28 18:37:00 CET; 6s ago
   Main PID: 6675 (meyectl)
      Tasks: 14 (limit: 1934)
        CPU: 4.347s
     CGroup: /system.slice/motioneye.service
             ├─6675 /usr/bin/python2 /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf
             ├─6710 /bin/bash /home/pi/motion.sh -n -c /etc/motioneye/motion.conf -d 5
             ├─6711 /usr/bin/motion -n -c /etc/motioneye/motion.conf -d 5
             └─6735 /usr/bin/python2 /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf

Jan 28 18:37:02 raspberrypi motion[6711]: [0:motion] [NTC] [ALL] motion_startup: Logging to syslog
Jan 28 18:37:02 raspberrypi motion[6711]: [0:motion] [NTC] [ALL] motion_startup: Motion 4.3.2 Started
Jan 28 18:37:02 raspberrypi motion[6711]: [0:motion] [NTC] [ALL] motion_startup: Using default log type (ALL)
Jan 28 18:37:02 raspberrypi motion[6711]: [0:motion] [NTC] [ALL] motion_startup: Using log type (ALL) log level (WRN)
Jan 28 18:37:03 raspberrypi motion[6711]: [1:ml1:Camera1] [ERR] [VID] v4l2_fps_set: Fehler beim Einstellen der FPS. Rückkehrcode -1
Jan 28 18:37:04 raspberrypi meyectl[6675]:     INFO: cleanup started
Jan 28 18:37:04 raspberrypi meyectl[6675]:     INFO: wsswitch started
Jan 28 18:37:04 raspberrypi meyectl[6675]:     INFO: tasks started
Jan 28 18:37:04 raspberrypi meyectl[6675]:     INFO: mjpg client garbage collector started
Jan 28 18:37:04 raspberrypi meyectl[6675]:     INFO: server started
@ReneMuetti commented on GitHub (Jan 28, 2023): I have proceeded according to these instructions. The camera can now be integrated into MotionEye and a picture is displayed. https://github.com/motioneye-project/motioneye/issues/2683#issuecomment-1399367885 but unfortunately errors are still written to the log file: ``` [0:motion] [NTC] [ALL] conf_load: Processing thread 0 - config file /etc/motioneye/motion.conf [0:motion] [NTC] [ALL] config_camera: Processing camera config file camera-1.conf [0:motion] [NTC] [ALL] motion_startup: Logging to syslog [0:motion] [NTC] [ALL] motion_startup: Motion 4.3.2 Started [0:motion] [NTC] [ALL] motion_startup: Using default log type (ALL) [0:motion] [NTC] [ALL] motion_startup: Using log type (ALL) log level (WRN) [2:22:53.594696843] [21329] INFO Camera camera_manager.cpp:299 libcamera v0.0.3+40-9b860a66 [2:22:53.617144741] [21330] ERROR V4L2 v4l2_device.cpp:352 'imx708_wide': Unable to set controls: Das Gerät oder die Ressource ist belegt [2:22:53.619075612] [21330] WARN CameraSensorProperties camera_sensor_properties.cpp:205 No static properties available for 'imx708_wide' [2:22:53.619170872] [21330] WARN CameraSensorProperties camera_sensor_properties.cpp:207 Please consider updating the camera sensor properties database [2:22:53.665191035] [21330] INFO RPI raspberrypi.cpp:1425 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media3 and ISP device /dev/media0 [2:22:53.665626136] [21329] INFO Camera camera.cpp:841 Pipeline handler in use by another process [2:22:53.665809312] [21329] ERROR V4L2Compat v4l2_camera.cpp:34 Failed to acquire camera /home/pi/motion.sh: Zeile 3: 21328 Speicherzugriffsfehler /usr/bin/libcamerify /usr/bin/motion $@ ``` i also couldn't find out yet why the vido is so jerky ... and how I activate the nightvision mode I have also not yet figured out I also noticed that after starting MotionEye the camera is addressed completely wrong. The settings from the file `/usr/share/libcamera/ipa/raspberrypi/imx708_wide.json` were all deleted again. this is how it looks directly after the import. ``` libcamera-hello --list-camera Available cameras ----------------- 0 : imx708_wide [4608x2592] (/base/soc/i2c0mux/i2c@1/imx708@1a) Modes: 'SRGGB10_CSI2P' : 1536x864 [120.13 fps - (768, 432)/3072x1728 crop] 2304x1296 [56.03 fps - (0, 0)/4608x2592 crop] 4608x2592 [14.35 fps - (0, 0)/4608x2592 crop] ``` After starting MotionEye everything is gone again. ``` libcamera-hello --list-camera Available cameras ----------------- 0 : imx708_wide [4608x2592] (/base/soc/i2c0mux/i2c@1/imx708@1a) Modes: 'SBGGR10_CSI2P' : 1536x864 [30.00 fps - (0, 0)/0x0 crop] 2304x1296 [30.00 fps - (0, 0)/0x0 crop] 4608x2592 [30.00 fps - (0, 0)/0x0 crop] ``` Service-Status: ``` systemctl status motioneye.service ● motioneye.service - motionEye Server Loaded: loaded (/etc/systemd/system/motioneye.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2023-01-28 18:37:00 CET; 6s ago Main PID: 6675 (meyectl) Tasks: 14 (limit: 1934) CPU: 4.347s CGroup: /system.slice/motioneye.service ├─6675 /usr/bin/python2 /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf ├─6710 /bin/bash /home/pi/motion.sh -n -c /etc/motioneye/motion.conf -d 5 ├─6711 /usr/bin/motion -n -c /etc/motioneye/motion.conf -d 5 └─6735 /usr/bin/python2 /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf Jan 28 18:37:02 raspberrypi motion[6711]: [0:motion] [NTC] [ALL] motion_startup: Logging to syslog Jan 28 18:37:02 raspberrypi motion[6711]: [0:motion] [NTC] [ALL] motion_startup: Motion 4.3.2 Started Jan 28 18:37:02 raspberrypi motion[6711]: [0:motion] [NTC] [ALL] motion_startup: Using default log type (ALL) Jan 28 18:37:02 raspberrypi motion[6711]: [0:motion] [NTC] [ALL] motion_startup: Using log type (ALL) log level (WRN) Jan 28 18:37:03 raspberrypi motion[6711]: [1:ml1:Camera1] [ERR] [VID] v4l2_fps_set: Fehler beim Einstellen der FPS. Rückkehrcode -1 Jan 28 18:37:04 raspberrypi meyectl[6675]: INFO: cleanup started Jan 28 18:37:04 raspberrypi meyectl[6675]: INFO: wsswitch started Jan 28 18:37:04 raspberrypi meyectl[6675]: INFO: tasks started Jan 28 18:37:04 raspberrypi meyectl[6675]: INFO: mjpg client garbage collector started Jan 28 18:37:04 raspberrypi meyectl[6675]: INFO: server started ```
Author
Owner

@mgrn0 commented on GitHub (Feb 11, 2023):

unfortunately I could not get my camera module 3 to work via any of the suggestions above with a raspberry pi 4 / b running bullseye. Really hope the new cameras will be supported without workarounds in motioneye soon.

@mgrn0 commented on GitHub (Feb 11, 2023): unfortunately I could not get my camera module 3 to work via any of the suggestions above with a raspberry pi 4 / b running bullseye. Really hope the new cameras will be supported without workarounds in motioneye soon.
Author
Owner

@MaRaGaWa commented on GitHub (Mar 14, 2023):

@gpambrozio
It works ! Many thanks !

My setup :

  • RPI 4 with 1 GB RAM, 16 GB SD-Card
  • RPI OS, Rasbian GNU/Linux 11 (Bullseye)
  • Motioneye vs 0.42.1, Motion vs 4.3.2
  • Raspberry Pi Camera Module 3 NoIR

Some additional advices/observations:

  • after adding Camera1 in Motioneye make sure you select the upper 'Unicam'
  • note that the 'camera-1.conf' file does not pop-up in /etc/motioneye sooner than after adding that Camera1,
  • then edit the 'camera-1.conf' as in the above instructions
  • and... you can additionally improve the picture-quality dramatically by editing 'stream_quality' and 'movie_quality' in 'camera-1.conf'(I both increased them to 150, perfect quality !)
  • and the infrared also works, and even automatically :-)
@MaRaGaWa commented on GitHub (Mar 14, 2023): @gpambrozio It works ! Many thanks ! My setup : - RPI 4 with 1 GB RAM, 16 GB SD-Card - RPI OS, Rasbian GNU/Linux 11 (Bullseye) - Motioneye vs 0.42.1, Motion vs 4.3.2 - Raspberry Pi Camera Module 3 NoIR Some additional advices/observations: - after adding Camera1 in Motioneye make sure you select the upper 'Unicam' - note that the 'camera-1.conf' file does not pop-up in /etc/motioneye sooner than after adding that Camera1, - then edit the 'camera-1.conf' as in the above instructions - and... you can additionally improve the picture-quality dramatically by editing 'stream_quality' and 'movie_quality' in 'camera-1.conf'(I both increased them to 150, perfect quality !) - and the infrared also works, and even automatically :-)
Author
Owner

@notabotscott commented on GitHub (Mar 22, 2023):

For those who have gotten this workaround to work:

  • Are you using a 64 bit or 32 bit OS version of Bullseye?
  • Did you enable legacy camera support in raspi-config?
  • Are you adding the camera as V4L2 or MMAL?
  • Are you using the main branch of Motioneye (python2) or the Dev branch (python3)?

I just keep getting the following errors no matter what i try:

[1:ml1:Camera1] [ERR] [VID] v4l2_device_capability: Not a V4L2 device?
[1:ml1:Camera1] [ERR] [VID] vid_start: V4L2 device failed to open
@notabotscott commented on GitHub (Mar 22, 2023): For those who have gotten this workaround to work: - Are you using a 64 bit or 32 bit OS version of Bullseye? - Did you enable legacy camera support in raspi-config? - Are you adding the camera as V4L2 or MMAL? - Are you using the main branch of Motioneye (python2) or the Dev branch (python3)? I just keep getting the following errors no matter what i try: ``` [1:ml1:Camera1] [ERR] [VID] v4l2_device_capability: Not a V4L2 device? [1:ml1:Camera1] [ERR] [VID] vid_start: V4L2 device failed to open ```
Author
Owner

@notabotscott commented on GitHub (Mar 23, 2023):

Update: This workaround worked on the 32-bit version of Bullseye using the Dev branch.
Legacy camera support was not needed.
Cameras were added as V4L2.

@notabotscott commented on GitHub (Mar 23, 2023): Update: This workaround worked on the 32-bit version of Bullseye using the Dev branch. Legacy camera support was not needed. Cameras were added as V4L2.
Author
Owner

@B4n4n3 commented on GitHub (Mar 26, 2023):

Hey together, what am I doing wrong?

  • Raspberry Pi 3 B+
  • Bullseye OS 32-bit lite
  • installing motioneye according to the official instructions
  • follow the instructions from @gpambrozio
    • creating motion.sh an setting up chmod (sudo chmod +x motion.sh)
    • editing motioneye.conf by following the instructions.
    • start motioneye and added a V4L2 Camera
    • stop motioneye an edit camera-1.conf -> videodevice /dev/video0
    • start motioneye ...

but no picture in the preview.

@B4n4n3 commented on GitHub (Mar 26, 2023): Hey together, what am I doing wrong? - Raspberry Pi 3 B+ - Bullseye OS 32-bit lite - installing motioneye according to the official [instructions](https://github.com/motioneye-project/motioneye/wiki/Install-on-Raspbian-Bullseye) - follow the instructions from @gpambrozio - creating motion.sh an setting up chmod (sudo chmod +x motion.sh) - editing `motioneye.conf` by following the instructions. - start motioneye and added a V4L2 Camera - stop motioneye an edit `camera-1.conf` -> `videodevice /dev/video0` - start motioneye ... but no picture in the preview.
Author
Owner

@dber01 commented on GitHub (Mar 27, 2023):

Camera works with Raspberry Pi 4, Bullseye OS 32-bit lite and motionEye (dev) up to 4608 / 2592 (legacy camera not enabled). Only one issue, neither storage (/var/lib/motioneye/Camera1 empty) nor FTP upload seems to work. Anybody facing same issue?

@dber01 commented on GitHub (Mar 27, 2023): Camera works with Raspberry Pi 4, Bullseye OS 32-bit lite and motionEye (dev) up to 4608 / 2592 (legacy camera not enabled). Only one issue, neither storage (/var/lib/motioneye/Camera1 empty) nor FTP upload seems to work. Anybody facing same issue?
Author
Owner

@notabotscott commented on GitHub (Mar 27, 2023):

Hey together, what am I doing wrong?

  • Raspberry Pi 3 B+

  • Bullseye OS 32-bit lite

  • installing motioneye according to the official instructions

  • follow the instructions from @gpambrozio

    • creating motion.sh an setting up chmod (sudo chmod +x motion.sh)
    • editing motioneye.conf by following the instructions.
    • start motioneye and added a V4L2 Camera
    • stop motioneye an edit camera-1.conf -> videodevice /dev/video0
    • start motioneye ...

but no picture in the preview.

Did you install the motioneye dev branch? https://github.com/motioneye-project/motioneye/tree/dev
Also, did you install libcamera-tools? sudo apt install libcamera-tools

@notabotscott commented on GitHub (Mar 27, 2023): > Hey together, what am I doing wrong? > > * Raspberry Pi 3 B+ > * Bullseye OS 32-bit lite > * installing motioneye according to the official [instructions](https://github.com/motioneye-project/motioneye/wiki/Install-on-Raspbian-Bullseye) > * follow the instructions from @gpambrozio > > * creating motion.sh an setting up chmod (sudo chmod +x motion.sh) > * editing `motioneye.conf` by following the instructions. > * start motioneye and added a V4L2 Camera > * stop motioneye an edit `camera-1.conf` -> `videodevice /dev/video0` > * start motioneye ... > > but no picture in the preview. Did you install the motioneye dev branch? https://github.com/motioneye-project/motioneye/tree/dev Also, did you install libcamera-tools? `sudo apt install libcamera-tools`
Author
Owner

@B4n4n3 commented on GitHub (Mar 31, 2023):

Hey together, what am I doing wrong?

  • Raspberry Pi 3 B+

  • Bullseye OS 32-bit lite

  • installing motioneye according to the official instructions

  • follow the instructions from @gpambrozio

    • creating motion.sh an setting up chmod (sudo chmod +x motion.sh)
    • editing motioneye.conf by following the instructions.
    • start motioneye and added a V4L2 Camera
    • stop motioneye an edit camera-1.conf -> videodevice /dev/video0
    • start motioneye ...

but no picture in the preview.

Did you install the motioneye dev branch? https://github.com/motioneye-project/motioneye/tree/dev Also, did you install libcamera-tools? sudo apt install libcamera-tools

Hey @notabotscott

thank you very much, the wrong installation was the problem.
I had already installed the libcamera tools.
But i had to install the motioneye dev branch.

@B4n4n3 commented on GitHub (Mar 31, 2023): > > Hey together, what am I doing wrong? > > > > * Raspberry Pi 3 B+ > > * Bullseye OS 32-bit lite > > * installing motioneye according to the official [instructions](https://github.com/motioneye-project/motioneye/wiki/Install-on-Raspbian-Bullseye) > > * follow the instructions from @gpambrozio > > > > * creating motion.sh an setting up chmod (sudo chmod +x motion.sh) > > * editing `motioneye.conf` by following the instructions. > > * start motioneye and added a V4L2 Camera > > * stop motioneye an edit `camera-1.conf` -> `videodevice /dev/video0` > > * start motioneye ... > > > > but no picture in the preview. > > Did you install the motioneye dev branch? https://github.com/motioneye-project/motioneye/tree/dev Also, did you install libcamera-tools? `sudo apt install libcamera-tools` Hey @notabotscott thank you very much, the wrong installation was the problem. I had already installed the libcamera tools. But i had to install the motioneye dev branch.
Author
Owner

@BobSmithPi commented on GitHub (May 7, 2023):

Thank you for this workaround. I was able to get my camera module 3 working fine except for adding parameters in the config. Is there any way to change brightness, exposure and lens-position? I've tried adding them different ways in the config file and nothing seems to work. Any help would be greatly appreciated.

@BobSmithPi commented on GitHub (May 7, 2023): Thank you for this workaround. I was able to get my camera module 3 working fine except for adding parameters in the config. Is there any way to change brightness, exposure and lens-position? I've tried adding them different ways in the config file and nothing seems to work. Any help would be greatly appreciated.
Author
Owner

@bigOconstant commented on GitHub (May 15, 2023):

None of these worked for me on a rpi4 running latest 64 bit os. Really wish I could use this new camera.

@bigOconstant commented on GitHub (May 15, 2023): None of these worked for me on a rpi4 running latest 64 bit os. Really wish I could use this new camera.
Author
Owner

@m4rky-m4rk commented on GitHub (May 16, 2023):

I have few cameras lying idle because of the issue and lack of time to dig into the issues.

@m4rky-m4rk commented on GitHub (May 16, 2023): I have few cameras lying idle because of the issue and lack of time to dig into the issues.
Author
Owner

@strips commented on GitHub (May 16, 2023):

I never got the libcamerify to work but still feel it should have. Might give it a new try one day. Anyways the motion project is old and will never support the new cameras using libcamera. MotionEye should maybe start looking at transitioning to motionPlus (when python3 has reached maturity) as it seems a replacement wich is actively developed. motionPlus works with libcamera.

I found this solution online and you need screen and ngnix installed. I created a shell script to start by boot in crontab. This has been stable now for some months. This is the first time I ever used ngnix. The two processes use maybe 5% CPU in average. It can support a good FPS but I keep it low for motion detection.

# cat /root/start_rpicam3_stream.sh

#!/bin/bash -x

mkfifo /root/stream
chmod 777 /root/stream

screen -l -dmS libcamera /usr/bin/libcamera-vid -t 0 --width 1920 --height 1080 --codec h264 -n --hdr 1 --profile=high --framerate 5 -o /root/stream
screen -l -dmS ffmpeg /usr/bin/ffmpeg -y -i /root/stream -s 1920x1080 -r 5 -c:v copy -b:v 1500k -maxrate 5000k -bufsize 10000k -g 60 -f flv rtmp://localhost/live/stream

# crontab -l

# Edit this file to introduce tasks to be run by cron.
# m h  dom mon dow   command
@reboot sleep 60 && /root/start_rpicam3_stream.sh

# cat /etc/nginx/nginx.conf

rtmp {
        server {
                listen 1935;
                allow publish 127.0.0.1;
                deny publish all;
                timeout 60s;
                notify_method post;
                chunk_size 8192;


                application live {
                        live on;
                        record off;
                }
        }
}
  • MotionEye Camera device/URL
    netcam_url rtmp://localhost/live/stream

Change the FPS to what you want. 1920x1080 is maximum resolution for the RPI hw codec as I think it's used here.

@strips commented on GitHub (May 16, 2023): I never got the libcamerify to work but still feel it should have. Might give it a new try one day. Anyways the motion project is old and will never support the new cameras using libcamera. MotionEye should maybe start looking at transitioning to motionPlus (when python3 has reached maturity) as it seems a replacement wich is actively developed. motionPlus works with libcamera. I found this solution online and you need screen and ngnix installed. I created a shell script to start by boot in crontab. This has been stable now for some months. This is the first time I ever used ngnix. The two processes use maybe 5% CPU in average. It can support a good FPS but I keep it low for motion detection. `# cat /root/start_rpicam3_stream.sh` ``` #!/bin/bash -x mkfifo /root/stream chmod 777 /root/stream screen -l -dmS libcamera /usr/bin/libcamera-vid -t 0 --width 1920 --height 1080 --codec h264 -n --hdr 1 --profile=high --framerate 5 -o /root/stream screen -l -dmS ffmpeg /usr/bin/ffmpeg -y -i /root/stream -s 1920x1080 -r 5 -c:v copy -b:v 1500k -maxrate 5000k -bufsize 10000k -g 60 -f flv rtmp://localhost/live/stream ``` `# crontab -l` ``` # Edit this file to introduce tasks to be run by cron. # m h dom mon dow command @reboot sleep 60 && /root/start_rpicam3_stream.sh ``` `# cat /etc/nginx/nginx.conf` ``` rtmp { server { listen 1935; allow publish 127.0.0.1; deny publish all; timeout 60s; notify_method post; chunk_size 8192; application live { live on; record off; } } } ``` - MotionEye Camera device/URL `netcam_url rtmp://localhost/live/stream` Change the FPS to what you want. 1920x1080 is maximum resolution for the RPI hw codec as I think it's used here.
Author
Owner

@mgrn0 commented on GitHub (May 16, 2023):

@strips are you using this as a replacement for motioneye or 'just' (great idea :) ) as a streaming source / camera FOR motioneye?

@mgrn0 commented on GitHub (May 16, 2023): @strips are you using this as a replacement for motioneye or 'just' (great idea :) ) as a streaming source / camera FOR motioneye?
Author
Owner

@strips commented on GitHub (May 16, 2023):

@mgrn0, I'm using this with motionEye. Effectively creating a network stream from the camera and configuring motionEye to use the stream as a source. All running on the same RPI4.

@strips commented on GitHub (May 16, 2023): @mgrn0, I'm using this with motionEye. Effectively creating a network stream from the camera and configuring motionEye to use the stream as a source. All running on the same RPI4.
Author
Owner

@bigOconstant commented on GitHub (May 16, 2023):

I'm kinda confused on what you are using screen for here and why it's needed. But I like the concept of connecting to it as a network stream. That's a great idea I'll play with this this weekend.

@bigOconstant commented on GitHub (May 16, 2023): I'm kinda confused on what you are using screen for here and why it's needed. But I like the concept of connecting to it as a network stream. That's a great idea I'll play with this this weekend.
Author
Owner

@strips commented on GitHub (May 16, 2023):

@bigOconstant screen is a simple (ugly) way to run a background process. Could probably use nohup or set up proper daemon instead. I tried nohup but one of the commands did not like the limited environment and went back to screen.

@strips commented on GitHub (May 16, 2023): @bigOconstant screen is a simple (ugly) way to run a background process. Could probably use nohup or set up proper daemon instead. I tried nohup but one of the commands did not like the limited environment and went back to screen.
Author
Owner

@strips commented on GitHub (May 19, 2023):

I got libcamerify to partially work by compiling Motion from source. My next issue was that MotionEye did not seem to detect the running process of Motion when using the wrapper and got a lot of crash loops. So close, I decided to see if I could fix this in the code to eliminate the need for an external wrapper script. In my own fork I have implemented support for libcamerify and it can be configured in motioneye.conf. So far it seems to work pretty good. The only issue seems to be setting parameters for the camera. I'll probably create a PR for my fix. Anyways the code is here: https://github.com/strips/motioneye/tree/feature/libcamerify

@strips commented on GitHub (May 19, 2023): I got libcamerify to partially work by compiling Motion from source. My next issue was that MotionEye did not seem to detect the running process of Motion when using the wrapper and got a lot of crash loops. So close, I decided to see if I could fix this in the code to eliminate the need for an external wrapper script. In my own fork I have implemented support for libcamerify and it can be configured in motioneye.conf. So far it seems to work pretty good. The only issue seems to be setting parameters for the camera. I'll probably create a PR for my fix. Anyways the code is here: https://github.com/strips/motioneye/tree/feature/libcamerify
Author
Owner

@github-0 commented on GitHub (May 20, 2023):

@strips Thanks for the instructions for libcamera+ffmpeg combo as I couldn't get the libcamerify method to work with camera module 3 (1.1 worked fine) and what's more, with libcamerify there is no way(?) to set camera parameters which is a must in my use case.

I had to add -re parameter to ffmpeg -y -re -i /root/stream -s 1920x1080 -r 5 -c:v copy -b:v 1500k -maxrate 5000k -bufsize 10000k -g 60 -f flv rtmp://localhost/live/stream as otherwise ffmpeg was not reading the input in real time, reached end of file and quit.

One question about the named pipe (fifo) though - it seems this file (/root/stream) keeps increasing in size. How did you solve this?

@github-0 commented on GitHub (May 20, 2023): @strips Thanks for the instructions for libcamera+ffmpeg combo as I couldn't get the libcamerify method to work with camera module 3 (1.1 worked fine) and what's more, with libcamerify there is no way(?) to set camera parameters which is a must in my use case. I had to add -re parameter to _ffmpeg -y -re -i /root/stream -s 1920x1080 -r 5 -c:v copy -b:v 1500k -maxrate 5000k -bufsize 10000k -g 60 -f flv rtmp://localhost/live/stream_ as otherwise ffmpeg was not reading the input in real time, reached end of file and quit. One question about the named pipe (fifo) though - it seems this file (/root/stream) keeps increasing in size. How did you solve this?
Author
Owner

@strips commented on GitHub (May 21, 2023):

@github-0 np!
I found the link where I found the workaround: https://www.wetransco.de/debian-bullseye-libcamera-and-motion-on-a-raspberry-pi-with-the-new-camera-module-v3-a-great-workaround/

Using rtsp-simple-server should/could be a much simpler approach. I tested this for an hour before switching to libcarmerify and it worked at least as well. The advantage is that it's only one binary/command to run. If needed I could post the config file I made.

@strips commented on GitHub (May 21, 2023): @github-0 np! I found the link where I found the workaround: https://www.wetransco.de/debian-bullseye-libcamera-and-motion-on-a-raspberry-pi-with-the-new-camera-module-v3-a-great-workaround/ Using [rtsp-simple-server](https://github.com/aler9/rtsp-simple-server/) should/could be a much simpler approach. I tested this for an hour before switching to libcarmerify and it worked at least as well. The advantage is that it's only one binary/command to run. If needed I could post the config file I made.
Author
Owner

@bigOconstant commented on GitHub (May 21, 2023):

Thanks @strips I got it to work with your script in the same fashion and your 60 second sleep make it work after a minute on restart which is great.

Full instructions for others would involve, starting from blank rasbian os, installing nxinx, follow the install motion-eye instructions from dev branch, adding the nginx config file and then doing whats in the above comment and it works.

@bigOconstant commented on GitHub (May 21, 2023): Thanks @strips I got it to work with your script in the same fashion and your 60 second sleep make it work after a minute on restart which is great. Full instructions for others would involve, starting from blank rasbian os, installing nxinx, follow the install motion-eye instructions from dev branch, adding the nginx config file and then doing whats in the above comment and it works.
Author
Owner

@RippinAndTerran commented on GitHub (Jun 10, 2023):

Hey @strips if you had the chance to upload your config file for rtsp-simple-server that would be amazing! I am pretty new at all of this and after a few days of trying things it is hard to tell where I need to dedicate my efforts to get it up and running. I am about to go down the ngnix road but since rtsp-simple-server is supposed to be easier I am a little apprehensive since I can't even get that to work.

@RippinAndTerran commented on GitHub (Jun 10, 2023): Hey @strips if you had the chance to upload your config file for rtsp-simple-server that would be amazing! I am pretty new at all of this and after a few days of trying things it is hard to tell where I need to dedicate my efforts to get it up and running. I am about to go down the ngnix road but since rtsp-simple-server is supposed to be easier I am a little apprehensive since I can't even get that to work.
Author
Owner

@techd4ve commented on GitHub (Jun 14, 2023):

Hi Guys! Thanks for the workaround, it worked really well.
I also have the "apply" error bug but thing could be worse.

Do you may know how I can adjust the focus of the Cam module 3?
My Problem is that something is in front of the cam (left side ca. 25% of the image and top 40% of the image) and because of that, the Autofocus is not adjusted correctly. Is there any change I can set up a certain point for the autofocus or set it to manuell focus on that certain point?

I tried something with the tuning file but I didn't seem to work (maybe I also did it wrong)

Anybody an Idea how to fix it?

@techd4ve commented on GitHub (Jun 14, 2023): Hi Guys! Thanks for the workaround, it worked really well. I also have the "apply" error bug but thing could be worse. Do you may know how I can adjust the focus of the Cam module 3? My Problem is that something is in front of the cam (left side ca. 25% of the image and top 40% of the image) and because of that, the Autofocus is not adjusted correctly. Is there any change I can set up a certain point for the autofocus or set it to manuell focus on that certain point? I tried something with the tuning file but I didn't seem to work (maybe I also did it wrong) Anybody an Idea how to fix it?
Author
Owner

@renatomserra commented on GitHub (Jun 30, 2023):

thanks for the solution @strips with this approach does the HD picture on motion function work or is it just the video stream?

@renatomserra commented on GitHub (Jun 30, 2023): thanks for the solution @strips with this approach does the HD picture on motion function work or is it just the video stream?
Author
Owner

@strips commented on GitHub (Jul 3, 2023):

@RippinAndTerran

Sorry for the long delay. I put the file on github below. I haven't used MediaMTX since I tested it but I'lll probably go back to it. I'm having issues with libcamerify and keep having to restart the daemon.
github.com/strips/stuff@c8b10f50fa/hakkebo_rpi/MotionEyeConfig/mediamtx/mediamtx.yml

@strips commented on GitHub (Jul 3, 2023): @RippinAndTerran Sorry for the long delay. I put the file on github below. I haven't used MediaMTX since I tested it but I'lll probably go back to it. I'm having issues with libcamerify and keep having to restart the daemon. https://github.com/strips/stuff/blob/c8b10f50fa4aba3a685ad7890710de9c15716eb6/hakkebo_rpi/MotionEyeConfig/mediamtx/mediamtx.yml
Author
Owner

@strips commented on GitHub (Jul 3, 2023):

@RenatoSerra22

thanks for the solution @strips with this approach does the HD picture on motion function work or is it just the video stream?

Which of the 3 solutions are you referring to :-)

  1. Workaround with ffmpeg and nginx
    Works pretty well but a lot of moving parts. HD picture works in stream and motion. But when triggering a motion it slows down and lags alot.

  2. Workaround with rtsp-simple-server / MediaMTX
    Works pretty well and replaces both ffmpeg and nginx processes in the first workaround. HD picture works in stream and motion. But when triggering a motion it slows down and lags alot. The added benefit MediaMTX has a lot og options to control the camera. Seems they have exposed most of the settings in libcamera API. Still I have not testes many of the options.

  3. Libcamerify compatabilitylayer
    Rather unstable. I keep having to restart the motionEye daemon. Not really sure but it might be enough to just restart the motion process. It might be my motionEye patch that does not work properly and motionEye is not able to detect the issue and restart motion.

Personally I will go back to number 3.

@strips commented on GitHub (Jul 3, 2023): @RenatoSerra22 > thanks for the solution @strips with this approach does the HD picture on motion function work or is it just the video stream? Which of the 3 solutions are you referring to :-) 1. Workaround with ffmpeg and nginx Works pretty well but a lot of moving parts. HD picture works in stream and motion. But when triggering a motion it slows down and lags alot. 3. Workaround with rtsp-simple-server / MediaMTX Works pretty well and replaces both ffmpeg and nginx processes in the first workaround. HD picture works in stream and motion. But when triggering a motion it slows down and lags alot. The added benefit MediaMTX has a lot og options to control the camera. Seems they have exposed most of the settings in libcamera API. Still I have not testes many of the options. 4. Libcamerify compatabilitylayer Rather unstable. I keep having to restart the motionEye daemon. Not really sure but it might be enough to just restart the motion process. It might be my motionEye patch that does not work properly and motionEye is not able to detect the issue and restart motion. Personally I will go back to number 3.
Author
Owner

@kendoka15 commented on GitHub (Jul 5, 2023):

@strips Thanks for the ffmpeg+nginx method, works well. Something I noticed is that your libcamera-vid command for some reason includes --hdr 1 which gave me subtle horizontal lines in good lighting and highly visible ones in low light especially when boosting the gain. I removed it and all is fine.

Libcamerify didn't work for me because from what I gather I couldn't have access to all the libcamera settings. I haven't tried MediaMTX yet as I needed a solution pretty quickly but if everything is controllable including shutter speed and gain I'll be trying it soon.

I ended up feeding the stream from the camera Pi Zero W to a Pi 4 I'm also using for Home Assistant and Samba as the Pi Zero 2 W I was previously using with MotionEye OS couldn't run MotionEye at 1080p 10fps without overheating (the camera has to work well in 40C weather). MotionEye OS previously worked fine in those conditions at 720p but either the resolution bump is too much or there was some hardware accelerated special sauce in MotionEye OS that isn't there in MotionEye.

Anyway, thanks again

@kendoka15 commented on GitHub (Jul 5, 2023): @strips Thanks for the ffmpeg+nginx method, works well. Something I noticed is that your libcamera-vid command for some reason includes --hdr 1 which gave me subtle horizontal lines in good lighting and highly visible ones in low light especially when boosting the gain. I removed it and all is fine. Libcamerify didn't work for me because from what I gather I couldn't have access to all the libcamera settings. I haven't tried MediaMTX yet as I needed a solution pretty quickly but if everything is controllable including shutter speed and gain I'll be trying it soon. I ended up feeding the stream from the camera Pi Zero W to a Pi 4 I'm also using for Home Assistant and Samba as the Pi Zero 2 W I was previously using with MotionEye OS couldn't run MotionEye at 1080p 10fps without overheating (the camera has to work well in 40C weather). MotionEye OS previously worked fine in those conditions at 720p but either the resolution bump is too much or there was some hardware accelerated special sauce in MotionEye OS that isn't there in MotionEye. Anyway, thanks again
Author
Owner

@D-an-W commented on GitHub (Sep 22, 2023):

I found a way to make it work with the current motioneye version on a pi zero w with the new camera module 3.

First, create a file named motion.sh in /home/pi:

#!/bin/bash

/usr/bin/libcamerify /usr/bin/motion $@

Now, edit your motioneye.conf file (should be in /etc/motioneye) and make sure that the line with motion_binary looks like this:

motion_binary /home/pi/motion.sh

Depending on your debian distribution you might have to also install libcamera-tools with sudo apt-get install libcamera-tools

Now restart motioneye and you can configure your camera as a local camera on /dev/video0

The information that led me to this solution was found here

Got it working thanks, I had to change the permissions of the motion.sh file before it would show the camera however.

I used 755, not sure if thats the best choice?

@D-an-W commented on GitHub (Sep 22, 2023): > I found a way to make it work with the current motioneye version on a pi zero w with the new camera module 3. > > First, create a file named `motion.sh` in `/home/pi`: > > ``` > #!/bin/bash > > /usr/bin/libcamerify /usr/bin/motion $@ > ``` > > Now, edit your `motioneye.conf` file (should be in `/etc/motioneye`) and make sure that the line with `motion_binary` looks like this: > > ``` > motion_binary /home/pi/motion.sh > ``` > > Depending on your debian distribution you might have to also install `libcamera-tools` with `sudo apt-get install libcamera-tools` > > Now restart motioneye and you can configure your camera as a local camera on `/dev/video0` > > The information that led me to this solution was found [here](https://motion-project.github.io/motion_config.html#basic_setup_picam) Got it working thanks, I had to change the permissions of the `motion.sh` file before it would show the camera however. I used 755, not sure if thats the best choice?
Author
Owner

@Stepyon commented on GitHub (Oct 29, 2023):

Hi Guys! Thanks for the workaround, it worked really well. I also have the "apply" error bug but thing could be worse.

Do you may know how I can adjust the focus of the Cam module 3? My Problem is that something is in front of the cam (left side ca. 25% of the image and top 40% of the image) and because of that, the Autofocus is not adjusted correctly. Is there any change I can set up a certain point for the autofocus or set it to manuell focus on that certain point?

I tried something with the tuning file but I didn't seem to work (maybe I also did it wrong)

Anybody an Idea how to fix it?

Autofocus doesn't work for me at all with "libcamerify" script workaround. Have you found how to make it working?

@Stepyon commented on GitHub (Oct 29, 2023): > Hi Guys! Thanks for the workaround, it worked really well. I also have the "apply" error bug but thing could be worse. > > Do you may know how I can adjust the focus of the Cam module 3? My Problem is that something is in front of the cam (left side ca. 25% of the image and top 40% of the image) and because of that, the Autofocus is not adjusted correctly. Is there any change I can set up a certain point for the autofocus or set it to manuell focus on that certain point? > > I tried something with the tuning file but I didn't seem to work (maybe I also did it wrong) > > Anybody an Idea how to fix it? Autofocus doesn't work for me at all with "libcamerify" script workaround. Have you found how to make it working?
Author
Owner

@Ghosti10 commented on GitHub (Nov 9, 2023):

Ok guys , the trick is super easy.
The Module3 Cam has issues with motioneye.
but it is working perfcet with Spyglass. Here is the trick: Install spyglass, start run.py -r 800x600 which is creating a stream. (http://127.0.0.1:8080/stream) check this out for installation: https://robertmarks.cloud/posts/2023/02/setting-up-pi-camera-module-3-in-mainsailos/ (credits to Rob Marks)

then install Motioneye: https://github.com/motioneye-project/motioneye/wiki/Install-on-Raspbian-Bullseye

then DO NOT ADD MJPEG Cam in motioneye. Add a NETWORK Camera in motioneye,
and you have a perfect working motioneye with motion detection . And YES, autofocus is working as well. Enjoy

@Ghosti10 commented on GitHub (Nov 9, 2023): **Ok guys , the trick is super easy.** The Module3 Cam has issues with motioneye. but it is working perfcet with Spyglass. Here is the trick: Install spyglass, start run.py -r 800x600 which is creating a stream. (http://127.0.0.1:8080/stream) check this out for installation: https://robertmarks.cloud/posts/2023/02/setting-up-pi-camera-module-3-in-mainsailos/ (credits to Rob Marks) then install Motioneye: https://github.com/motioneye-project/motioneye/wiki/Install-on-Raspbian-Bullseye then DO NOT ADD MJPEG Cam in motioneye. Add a NETWORK Camera in motioneye, and you have a perfect working motioneye with motion detection . And YES, autofocus is working as well. Enjoy
Author
Owner

@pingufreak commented on GitHub (Nov 18, 2023):

Much easier:

https://github.com/motioneye-project/motioneye/issues/2812#issuecomment-1817391735

@pingufreak commented on GitHub (Nov 18, 2023): Much easier: https://github.com/motioneye-project/motioneye/issues/2812#issuecomment-1817391735
Author
Owner

@clds84 commented on GitHub (Nov 23, 2023):

I found a way to make it work with the current motioneye version on a pi zero w with the new camera module 3.

First, create a file named motion.sh in /home/pi:

#!/bin/bash

/usr/bin/libcamerify /usr/bin/motion $@

Now, edit your motioneye.conf file (should be in /etc/motioneye) and make sure that the line with motion_binary looks like this:

motion_binary /home/pi/motion.sh

Depending on your debian distribution you might have to also install libcamera-tools with sudo apt-get install libcamera-tools

Now restart motioneye and you can configure your camera as a local camera on /dev/video0

The information that led me to this solution was found here

Trying this now, but I don't have a 'pi' directory following /home to create a motion.sh file. Referencing other pi projects, pi would be a user, right? Is this critical if I'd be referencing it's path in the motioneye.conf file as something like /home/motion.sh?

@clds84 commented on GitHub (Nov 23, 2023): > I found a way to make it work with the current motioneye version on a pi zero w with the new camera module 3. > > First, create a file named `motion.sh` in `/home/pi`: > > ``` > #!/bin/bash > > /usr/bin/libcamerify /usr/bin/motion $@ > ``` > > Now, edit your `motioneye.conf` file (should be in `/etc/motioneye`) and make sure that the line with `motion_binary` looks like this: > > ``` > motion_binary /home/pi/motion.sh > ``` > > Depending on your debian distribution you might have to also install `libcamera-tools` with `sudo apt-get install libcamera-tools` > > Now restart motioneye and you can configure your camera as a local camera on `/dev/video0` > > The information that led me to this solution was found [here](https://motion-project.github.io/motion_config.html#basic_setup_picam) Trying this now, but I don't have a 'pi' directory following /home to create a motion.sh file. Referencing other pi projects, pi would be a user, right? Is this critical if I'd be referencing it's path in the motioneye.conf file as something like /home/motion.sh?
Author
Owner

@pingufreak commented on GitHub (Nov 23, 2023):

Hi,

just change the systemd config as described.

Kr

Pingufreak

On Thu, Nov 23, 2023, 6:27 AM clds84 @.***> wrote:

I found a way to make it work with the current motioneye version on a pi
zero w with the new camera module 3.

First, create a file named motion.sh in /home/pi:

#!/bin/bash

/usr/bin/libcamerify /usr/bin/motion $@

Now, edit your motioneye.conf file (should be in /etc/motioneye) and make
sure that the line with motion_binary looks like this:

motion_binary /home/pi/motion.sh

Depending on your debian distribution you might have to also install
libcamera-tools with sudo apt-get install libcamera-tools

Now restart motioneye and you can configure your camera as a local camera
on /dev/video0

The information that led me to this solution was found here
https://motion-project.github.io/motion_config.html#basic_setup_picam

Trying this now, but I don't have a 'pi' directory following /home to
create a motion.sh file. Referencing other pi projects, pi would be a user,
right?


Reply to this email directly, view it on GitHub
https://github.com/motioneye-project/motioneye/issues/2683#issuecomment-1823837144,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/APZW37OFCEZS5R3RA7BN7WLYF3NETAVCNFSM6AAAAAATVG7SCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRTHAZTOMJUGQ
.
You are receiving this because you commented.Message ID:
@.***>

@pingufreak commented on GitHub (Nov 23, 2023): Hi, just change the systemd config as described. Kr Pingufreak On Thu, Nov 23, 2023, 6:27 AM clds84 ***@***.***> wrote: > I found a way to make it work with the current motioneye version on a pi > zero w with the new camera module 3. > > First, create a file named motion.sh in /home/pi: > > #!/bin/bash > > /usr/bin/libcamerify /usr/bin/motion $@ > > Now, edit your motioneye.conf file (should be in /etc/motioneye) and make > sure that the line with motion_binary looks like this: > > motion_binary /home/pi/motion.sh > > Depending on your debian distribution you might have to also install > libcamera-tools with sudo apt-get install libcamera-tools > > Now restart motioneye and you can configure your camera as a local camera > on /dev/video0 > > The information that led me to this solution was found here > <https://motion-project.github.io/motion_config.html#basic_setup_picam> > > Trying this now, but I don't have a 'pi' directory following /home to > create a motion.sh file. Referencing other pi projects, pi would be a user, > right? > > — > Reply to this email directly, view it on GitHub > <https://github.com/motioneye-project/motioneye/issues/2683#issuecomment-1823837144>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/APZW37OFCEZS5R3RA7BN7WLYF3NETAVCNFSM6AAAAAATVG7SCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRTHAZTOMJUGQ> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Author
Owner

@Ghosti10 commented on GitHub (Nov 25, 2023):

@clds84: i tried this solution first, but motion detection was not proper. Hopefully your solution will work for you. :)

@Ghosti10 commented on GitHub (Nov 25, 2023): @clds84: i tried this solution first, but motion detection was not proper. Hopefully your solution will work for you. :)
Author
Owner

@Juanderer98 commented on GitHub (Nov 27, 2023):

Ok guys , the trick is super easy. The Module3 Cam has issues with motioneye. but it is working perfcet with Spyglass. Here is the trick: Install spyglass, start run.py -r 800x600 which is creating a stream. (http://127.0.0.1:8080/stream) check this out for installation: https://robertmarks.cloud/posts/2023/02/setting-up-pi-camera-module-3-in-mainsailos/ (credits to Rob Marks)

then install Motioneye: https://github.com/motioneye-project/motioneye/wiki/Install-on-Raspbian-Bullseye

then DO NOT ADD MJPEG Cam in motioneye. Add a NETWORK Camera in motioneye, and you have a perfect working motioneye with motion detection . And YES, autofocus is working as well. Enjoy


I gave this a try but had problems toward the end. I had set up a raspian Bullseye 64bit system on a RPi4b 4Gb machine and was able to view the RPi camera v3 preview but in following the instructions to install motioneye on Bullseye I wound up installing python 2 pip. Motioneye worked but then spyglass would no longer work. I tried entering:

~/spyglass $ ./run.py -r 1920x1080

in a terminal window, which had worked before the motioneye install, but now it gets an error from an incorrect version (I think) of python. Is there a way to direct the machine to use python3 for spyglass?

@Juanderer98 commented on GitHub (Nov 27, 2023): > **Ok guys , the trick is super easy.** The Module3 Cam has issues with motioneye. but it is working perfcet with Spyglass. Here is the trick: Install spyglass, start run.py -r 800x600 which is creating a stream. (http://127.0.0.1:8080/stream) check this out for installation: https://robertmarks.cloud/posts/2023/02/setting-up-pi-camera-module-3-in-mainsailos/ (credits to Rob Marks) > > then install Motioneye: https://github.com/motioneye-project/motioneye/wiki/Install-on-Raspbian-Bullseye > > then DO NOT ADD MJPEG Cam in motioneye. Add a NETWORK Camera in motioneye, and you have a perfect working motioneye with motion detection . And YES, autofocus is working as well. Enjoy ******************** I gave this a try but had problems toward the end. I had set up a raspian Bullseye 64bit system on a RPi4b 4Gb machine and was able to view the RPi camera v3 preview but in following the instructions to install motioneye on Bullseye I wound up installing python 2 pip. Motioneye worked but then spyglass would no longer work. I tried entering: ~/spyglass $ ./run.py -r 1920x1080 in a terminal window, which had worked before the motioneye install, but now it gets an error from an incorrect version (I think) of python. Is there a way to direct the machine to use python3 for spyglass?
Author
Owner

@strips commented on GitHub (Nov 28, 2023):

I gave this a try but had problems toward the end. I had set up a raspian Bullseye 64bit system on a RPi4b 4Gb machine and was able to view the RPi camera v3 preview but in following the instructions to install motioneye on Bullseye I wound up installing python 2 pip. Motioneye worked but then spyglass would no longer work. I tried entering:

Did you try Motioneye dev branch? It's based on Python 3. Not sure with the builds but I think they are based on the default (old) python2 version.

@strips commented on GitHub (Nov 28, 2023): > I gave this a try but had problems toward the end. I had set up a raspian Bullseye 64bit system on a RPi4b 4Gb machine and was able to view the RPi camera v3 preview but in following the instructions to install motioneye on Bullseye I wound up installing python 2 pip. Motioneye worked but then spyglass would no longer work. I tried entering: Did you try Motioneye dev branch? It's based on Python 3. Not sure with the builds but I think they are based on the default (old) python2 version.
Author
Owner

@Peuz85 commented on GitHub (Nov 30, 2023):

RaspiOs bookworm 64 bit with raspicam v3 (finally works)

sudo apt update && sudo apt upgrade -y

sudo apt --no-install-recommends install ca-certificates curl python3 python3-dev libcurl4-openssl-dev gcc libssl-dev

grep -q '\[global\]' /etc/pip.conf 2> /dev/null || printf '%b' '[global]\n' | sudo tee -a /etc/pip.conf > /dev/null

sudo sed -i '/^\[global\]/a\break-system-packages=true' /etc/pip.conf

sudo curl -sSfO 'https://bootstrap.pypa.io/get-pip.py'

sudo python3 get-pip.py

rm get-pip.py

sudo python3 -m pip install --pre motioneye

sudo apt install -y libcamera-v4l2

sudo apt install -y libcamera-tools

sudo motioneye_init

sudo sed -i 's/\/usr\/local\/bin\/meyectl/\/usr\/bin\/libcamerify \/usr\/local\/bin\/meyectl/' /etc/systemd/system/motioneye.service

sudo systemctl daemon-reload

sudo systemctl enable motioneye

sudo reboot

http://yourpiaddress:8765/

It can happen that when changes are made in the MotionEye, the message “unable to open video device” appears.
sudo reboot (takes a little longer) and then it works

Have fun ;-)

@Peuz85 commented on GitHub (Nov 30, 2023): **RaspiOs bookworm 64 bit with raspicam v3 (finally works)** `sudo apt update && sudo apt upgrade -y` `sudo apt --no-install-recommends install ca-certificates curl python3 python3-dev libcurl4-openssl-dev gcc libssl-dev` `grep -q '\[global\]' /etc/pip.conf 2> /dev/null || printf '%b' '[global]\n' | sudo tee -a /etc/pip.conf > /dev/null` `sudo sed -i '/^\[global\]/a\break-system-packages=true' /etc/pip.conf` `sudo curl -sSfO 'https://bootstrap.pypa.io/get-pip.py'` `sudo python3 get-pip.py` `rm get-pip.py` `sudo python3 -m pip install --pre motioneye` `sudo apt install -y libcamera-v4l2` `sudo apt install -y libcamera-tools` `sudo motioneye_init` `sudo sed -i 's/\/usr\/local\/bin\/meyectl/\/usr\/bin\/libcamerify \/usr\/local\/bin\/meyectl/' /etc/systemd/system/motioneye.service` `sudo systemctl daemon-reload` `sudo systemctl enable motioneye` `sudo reboot` http://yourpiaddress:8765/ It can happen that when changes are made in the MotionEye, the message “unable to open video device” appears. `sudo reboot` (takes a little longer) and then it works Have fun ;-)
Author
Owner

@MichaIng commented on GitHub (Nov 30, 2023):

Ah right. Note that this file will be restored on any Python update. There is a CLI option and hence a config option you can use to override the effect of EXTERNALLY-MANAGED:

echo -e '[global]\nbreak-system-packages=true' > /etc/pip.conf

We need to add this to our install docs.

Some background on this: In theory it is possible, if you install Python modules via apt and then the same module or its dependencies via pip, to create incompatibilities. Hence Debian decided to place this flag to prevent pip installs outside of venv/virtualenv. However, we literally never faced a case where a pip install broke another Python module installed via apt, since pip pulls all needed dependencies, puts them into different directories (/usr/local instead of /usr) where they override any previously installed APT package. And we are maintaining an own distribution which offers software installs like motionEye and does a lot of pip installs, so we have some significant sample size 😉. It is good to know about the different ways to install Python modules, and that modules installed via APT become redundant/obsolete when you install the same via pip, and that they in theory can conflict (to remember in case one really faces an issue). But blocking it in a way that one needs to search the web for workarounds/solutions is IMO wrong.

@MichaIng commented on GitHub (Nov 30, 2023): Ah right. Note that this file will be restored on any Python update. There is a CLI option and hence a config option you can use to override the effect of `EXTERNALLY-MANAGED`: ```sh echo -e '[global]\nbreak-system-packages=true' > /etc/pip.conf ``` We need to add this to our install docs. Some background on this: In theory it is possible, if you install Python modules via `apt` and then the same module or its dependencies via `pip`, to create incompatibilities. Hence Debian decided to place this flag to prevent `pip` installs outside of `venv`/`virtualenv`. However, we literally never faced a case where a `pip` install broke another Python module installed via `apt`, since `pip` pulls all needed dependencies, puts them into different directories (`/usr/local` instead of `/usr`) where they override any previously installed APT package. And we are maintaining an own distribution which offers software installs like motionEye and does a lot of `pip` installs, so we have some significant sample size 😉. It is good to know about the different ways to install Python modules, and that modules installed via APT become redundant/obsolete when you install the same via `pip`, and that they in theory can conflict (to remember in case one really faces an issue). But blocking it in a way that one needs to search the web for workarounds/solutions is IMO wrong.
Author
Owner

@D-an-W commented on GitHub (Dec 3, 2023):

@Peuz85, just trying your method thanks!

I see the message below, is that normal?

Also, what type of camera do I select please?

pi@MotionEye:~ $ sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service
sed: -e expression #1, char 8: unknown option to `s'
@D-an-W commented on GitHub (Dec 3, 2023): @Peuz85, just trying your method thanks! I see the message below, is that normal? Also, what type of camera do I select please? ``` pi@MotionEye:~ $ sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service sed: -e expression #1, char 8: unknown option to `s' ```
Author
Owner

@Peuz85 commented on GitHub (Dec 3, 2023):

I select the first cam in the drop down menu and it works.

I don't see that message... I just installed Motioneye again and didn't get any errors

@Peuz85 commented on GitHub (Dec 3, 2023): I select the first cam in the drop down menu and it works. I don't see that message... I just installed Motioneye again and didn't get any errors
Author
Owner

@D-an-W commented on GitHub (Dec 3, 2023):

I select the first cam in the drop down menu and it works.

I don't see that message... I just installed Motioneye again and didn't get any errors

Any idea what the error means or how to fix it as the camera doesn't currently work following your guide to the letter?

@D-an-W commented on GitHub (Dec 3, 2023): > I select the first cam in the drop down menu and it works. > > I don't see that message... I just installed Motioneye again and didn't get any errors Any idea what the error means or how to fix it as the camera doesn't currently work following your guide to the letter?
Author
Owner

@pingufreak commented on GitHub (Dec 3, 2023):

He copied just my answer... You need to escape the slashes.

On Sun, Dec 3, 2023, 8:03 AM D-an-W @.***> wrote:

@Peuz85 https://github.com/Peuz85, just trying your method thanks!

I see the message below, is that normal?

Also, what type of camera do I select please?

@.***:~ $ sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service
sed: -e expression #1, char 8: unknown option to `s'


Reply to this email directly, view it on GitHub
https://github.com/motioneye-project/motioneye/issues/2683#issuecomment-1837390747,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/APZW37IS3QDRRLT5YGNR743YHQP5RAVCNFSM6AAAAAATVG7SCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGM4TANZUG4
.
You are receiving this because you commented.Message ID:
@.***>

@pingufreak commented on GitHub (Dec 3, 2023): He copied just my answer... You need to escape the slashes. On Sun, Dec 3, 2023, 8:03 AM D-an-W ***@***.***> wrote: > @Peuz85 <https://github.com/Peuz85>, just trying your method thanks! > > I see the message below, is that normal? > > Also, what type of camera do I select please? > > ***@***.***:~ $ sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service > sed: -e expression #1, char 8: unknown option to `s' > > — > Reply to this email directly, view it on GitHub > <https://github.com/motioneye-project/motioneye/issues/2683#issuecomment-1837390747>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/APZW37IS3QDRRLT5YGNR743YHQP5RAVCNFSM6AAAAAATVG7SCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGM4TANZUG4> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Author
Owner

@D-an-W commented on GitHub (Dec 3, 2023):

He copied just my answer... You need to escape the slashes.

All working now, thank you!

@D-an-W commented on GitHub (Dec 3, 2023): > He copied just my answer... You need to escape the slashes. > […](#) All working now, thank you!
Author
Owner

@Peuz85 commented on GitHub (Dec 3, 2023):

He copied just my answer... You need to escape the slashes.

Du hast leider keine schritt für schritt anleitung geschrieben. Mit deiner "anleitung" so wie du sie geschrieben hast, ging leider gar nichts. Zudem kommt bei bookworm immer der fehler mit "... externally Environment" und dies muss man auch erst mal umgehen.
Danke für deine vorarbeit.

Lg und Grüsse aus Ö ;-)

@Peuz85 commented on GitHub (Dec 3, 2023): > He copied just my answer... You need to escape the slashes. Du hast leider keine schritt für schritt anleitung geschrieben. Mit deiner "anleitung" so wie du sie geschrieben hast, ging leider gar nichts. Zudem kommt bei bookworm immer der fehler mit "... externally Environment" und dies muss man auch erst mal umgehen. Danke für deine vorarbeit. Lg und Grüsse aus Ö ;-)
Author
Owner

@pingufreak commented on GitHub (Dec 3, 2023):

You are welcome.

On Sun, Dec 3, 2023, 11:06 AM D-an-W @.***> wrote:

He copied just my answer... You need to escape the slashes.
… <#m_419337762933316581_>

All working now, thank you!


Reply to this email directly, view it on GitHub
https://github.com/motioneye-project/motioneye/issues/2683#issuecomment-1837431270,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/APZW37PPU2V7P4K6QNHN2TLYHRFKJAVCNFSM6AAAAAATVG7SCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGQZTCMRXGA
.
You are receiving this because you commented.Message ID:
@.***>

@pingufreak commented on GitHub (Dec 3, 2023): You are welcome. On Sun, Dec 3, 2023, 11:06 AM D-an-W ***@***.***> wrote: > He copied just my answer... You need to escape the slashes. > … <#m_419337762933316581_> > > All working now, thank you! > > — > Reply to this email directly, view it on GitHub > <https://github.com/motioneye-project/motioneye/issues/2683#issuecomment-1837431270>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/APZW37PPU2V7P4K6QNHN2TLYHRFKJAVCNFSM6AAAAAATVG7SCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGQZTCMRXGA> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Author
Owner

@D-an-W commented on GitHub (Dec 3, 2023):

When using the Camera Module 3 and the working method above, what are the best camera and recording settings (Using a Zero 2 W currently) you have found?

@D-an-W commented on GitHub (Dec 3, 2023): When using the Camera Module 3 and the working method above, what are the best camera and recording settings (Using a Zero 2 W currently) you have found?
Author
Owner

@Stepyon commented on GitHub (Dec 4, 2023):

RaspiOs bookworm 64 bit with raspicam v3 (finally works)

sudo apt update && sudo apt upgrade -y

sudo rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED

sudo apt --no-install-recommends install ca-certificates curl python3 python3-distutils python3-dev libcurl4-openssl-dev gcc libssl-dev

curl -sSfO 'https://bootstrap.pypa.io/get-pip.py'

sudo python3 get-pip.py

sudo python3 -m pip install 'https://github.com/motioneye-project/motioneye/archive/dev.tar.gz'

sudo apt install -y libcamera-v4l2

sudo apt install -y libcamera-tools

sudo motioneye_init

sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service

sudo systemctl daemon-reload

sudo systemctl enable motioneye --now

sudo reboot

http://yourpiaddress:8765/

It can happen that when changes are made in the MotionEye, the message “unable to open video device” appears. sudo reboot (takes a little longer) and then it works

Have fun ;-)

This solution works except autofocus, is any way to make the autofocus working?

@Stepyon commented on GitHub (Dec 4, 2023): > **RaspiOs bookworm 64 bit with raspicam v3 (finally works)** > > > sudo apt update && sudo apt upgrade -y > > > sudo rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED > > > sudo apt --no-install-recommends install ca-certificates curl python3 python3-distutils python3-dev libcurl4-openssl-dev gcc libssl-dev > > > curl -sSfO 'https://bootstrap.pypa.io/get-pip.py' > > > sudo python3 get-pip.py > > > sudo python3 -m pip install 'https://github.com/motioneye-project/motioneye/archive/dev.tar.gz' > > > sudo apt install -y libcamera-v4l2 > > > sudo apt install -y libcamera-tools > > > sudo motioneye_init > > > sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service > > > sudo systemctl daemon-reload > > > sudo systemctl enable motioneye --now > > > sudo reboot > > http://yourpiaddress:8765/ > > It can happen that when changes are made in the MotionEye, the message “unable to open video device” appears. `sudo reboot` (takes a little longer) and then it works > > Have fun ;-) This solution works except autofocus, is any way to make the autofocus working?
Author
Owner

@axeljerabek commented on GitHub (Dec 5, 2023):

There are also easier ways to get a module3 stream into motion or motionplus.
Just updated my old article and I have this setup running:
https://www.wetransco.de/debian-bookworm-and-libcamera-module-3/

@axeljerabek commented on GitHub (Dec 5, 2023): There are also easier ways to get a module3 stream into motion or motionplus. Just updated my old article and I have this setup running: https://www.wetransco.de/debian-bookworm-and-libcamera-module-3/
Author
Owner

@Stepyon commented on GitHub (Dec 8, 2023):

This solution works except autofocus, is any way to make the autofocus working?

I was able to control the focus manually from the camera window by adding the action buttons:
image

  1. Create a zoom_in_1 script file (where "1" is camera number) in /etc/motioneye/ folder:
    sudo nano /etc/motioneye/zoom_in_1
#!/bin/bash

# Define the device
device="/dev/v4l-subdev1"

# Define the maximum focus value
max_focus=960

# Get the current focus value
current_focus=$(v4l2-ctl -d $device --get-ctrl=focus_absolute | awk '{print $2}>

# Check if current focus is a number
if ! [[ $current_focus =~ ^[0-9]+$ ]] ; then
   echo "Error: Failed to get current focus value" >&2; exit 1
fi

# Increment the focus value by 20
new_focus=$((current_focus + 20))

# Check if the new focus exceeds the maximum
if [ $new_focus -gt $max_focus ]; then
    new_focus=$max_focus
fi

# Set the new focus value
v4l2-ctl -d $device -c focus_absolute=$new_focus

Create zoom_out_1 script in the same folder:
sudo nano /etc/motioneye/zoom_out_1

#!/bin/bash

# Define the device
device="/dev/v4l-subdev1"

# Define the minimum focus value
min_focus=320

# Get the current focus value
current_focus=$(v4l2-ctl -d $device --get-ctrl=focus_absolute | awk '{print $2}>

# Check if current focus is a number
if ! [[ $current_focus =~ ^[0-9]+$ ]] ; then
   echo "Error: Failed to get current focus value" >&2; exit 1
fi

# Decrease the focus value by 20
new_focus=$((current_focus - 20))

# Check if the new focus is below the minimum
if [ $new_focus -lt $min_focus ]; then
    new_focus=$min_focus
fi

# Set the new focus value
v4l2-ctl -d $device -c focus_absolute=$new_focus

Make them executable:
sudo chmod +x zoom_in_1
sudo chmod +x zoom_out_1

  1. Autofocus even when it is not working will reset the focus value every time you are trying to change it, to fix that you need to modify your camera json file which located here: /usr/share/libcamera/ipa/rpi/vc4 (in my case it is imx708_noir.json). Remove or just rename "rpi.af" section. See more details here

Now you should be able to control the camera focus manually straight from the camera window.

@Stepyon commented on GitHub (Dec 8, 2023): > This solution works except autofocus, is any way to make the autofocus working? I was able to control the focus manually from the camera window by adding the action buttons: <img width="94" alt="image" src="https://github.com/motioneye-project/motioneye/assets/23343477/17317c48-3fb0-4ca0-82fd-cf70a72f7ed1"> 1) Create a **zoom_in_1** script file (where "1" is camera number) in /etc/motioneye/ folder: **sudo nano /etc/motioneye/zoom_in_1** ``` #!/bin/bash # Define the device device="/dev/v4l-subdev1" # Define the maximum focus value max_focus=960 # Get the current focus value current_focus=$(v4l2-ctl -d $device --get-ctrl=focus_absolute | awk '{print $2}> # Check if current focus is a number if ! [[ $current_focus =~ ^[0-9]+$ ]] ; then echo "Error: Failed to get current focus value" >&2; exit 1 fi # Increment the focus value by 20 new_focus=$((current_focus + 20)) # Check if the new focus exceeds the maximum if [ $new_focus -gt $max_focus ]; then new_focus=$max_focus fi # Set the new focus value v4l2-ctl -d $device -c focus_absolute=$new_focus ``` Create **zoom_out_1** script in the same folder: **sudo nano /etc/motioneye/zoom_out_1** ``` #!/bin/bash # Define the device device="/dev/v4l-subdev1" # Define the minimum focus value min_focus=320 # Get the current focus value current_focus=$(v4l2-ctl -d $device --get-ctrl=focus_absolute | awk '{print $2}> # Check if current focus is a number if ! [[ $current_focus =~ ^[0-9]+$ ]] ; then echo "Error: Failed to get current focus value" >&2; exit 1 fi # Decrease the focus value by 20 new_focus=$((current_focus - 20)) # Check if the new focus is below the minimum if [ $new_focus -lt $min_focus ]; then new_focus=$min_focus fi # Set the new focus value v4l2-ctl -d $device -c focus_absolute=$new_focus ``` Make them executable: **sudo chmod +x zoom_in_1 sudo chmod +x zoom_out_1** 2) Autofocus even when it is not working will reset the focus value every time you are trying to change it, to fix that you need to modify your camera json file which located here: /usr/share/libcamera/ipa/rpi/vc4 (in my case it is imx708_noir.json). Remove or just rename "rpi.af" section. See more details [here](https://forums.raspberrypi.com/viewtopic.php?t=353887) Now you should be able to control the camera focus manually straight from the camera window.
Author
Owner

@haklan commented on GitHub (Dec 18, 2023):

@Peuz85 I installed motion on Bookworm according to your instruction and trying to setup a RPI HQ camera but I got "UNABLE TO OPEN VIDEODEVICE" in the stream. Reboot does not help. Got "VIDIOC_STREAMON: Invalid argument" in systemctl status. Do you have any ideas?

● motioneye.service - motionEye Server
Loaded: loaded (/etc/systemd/system/motioneye.service; enabled; preset: enabled)
Active: active (running) since Mon 2023-12-18 15:44:51 CET; 8min ago
Main PID: 561 (meyectl)
Tasks: 10 (limit: 765)
CPU: 10min 22.668s
CGroup: /system.slice/motioneye.service
├─561 /usr/bin/python3 /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf
├─734 /usr/bin/python3 /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf
└─765 /usr/bin/motion -n -c /etc/motioneye/motion.conf -d 5

Dec 18 15:52:40 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] v4l2_mmap_set: Error starting stream. VIDIOC_STREAMON: Invalid argument
Dec 18 15:52:40 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] vid_start: V4L2 device failed to open
Dec 18 15:52:50 birdcam motion[765]: [1:ml1:Camera1] [WRN] [ALL] mlp_retry: Retrying until successful connection with camera
Dec 18 15:52:50 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] v4l2_fps_set: Error setting fps. Return code -1
Dec 18 15:52:50 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] v4l2_mmap_set: Error starting stream. VIDIOC_STREAMON: Invalid argument
Dec 18 15:52:50 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] vid_start: V4L2 device failed to open
Dec 18 15:53:00 birdcam motion[765]: [1:ml1:Camera1] [WRN] [ALL] mlp_retry: Retrying until successful connection with camera
Dec 18 15:53:00 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] v4l2_fps_set: Error setting fps. Return code -1
Dec 18 15:53:00 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] v4l2_mmap_set: Error starting stream. VIDIOC_STREAMON: Invalid argument
Dec 18 15:53:00 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] vid_start: V4L2 device failed to open

@haklan commented on GitHub (Dec 18, 2023): @Peuz85 I installed motion on Bookworm according to your instruction and trying to setup a RPI HQ camera but I got "UNABLE TO OPEN VIDEODEVICE" in the stream. Reboot does not help. Got "VIDIOC_STREAMON: Invalid argument" in systemctl status. Do you have any ideas? ● motioneye.service - motionEye Server Loaded: loaded (/etc/systemd/system/motioneye.service; enabled; preset: enabled) Active: active (running) since Mon 2023-12-18 15:44:51 CET; 8min ago Main PID: 561 (meyectl) Tasks: 10 (limit: 765) CPU: 10min 22.668s CGroup: /system.slice/motioneye.service ├─561 /usr/bin/python3 /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf ├─734 /usr/bin/python3 /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf └─765 /usr/bin/motion -n -c /etc/motioneye/motion.conf -d 5 Dec 18 15:52:40 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] v4l2_mmap_set: Error starting stream. VIDIOC_STREAMON: Invalid argument Dec 18 15:52:40 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] vid_start: V4L2 device failed to open Dec 18 15:52:50 birdcam motion[765]: [1:ml1:Camera1] [WRN] [ALL] mlp_retry: Retrying until successful connection with camera Dec 18 15:52:50 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] v4l2_fps_set: Error setting fps. Return code -1 Dec 18 15:52:50 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] v4l2_mmap_set: Error starting stream. VIDIOC_STREAMON: Invalid argument Dec 18 15:52:50 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] vid_start: V4L2 device failed to open Dec 18 15:53:00 birdcam motion[765]: [1:ml1:Camera1] [WRN] [ALL] mlp_retry: Retrying until successful connection with camera Dec 18 15:53:00 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] v4l2_fps_set: Error setting fps. Return code -1 Dec 18 15:53:00 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] v4l2_mmap_set: Error starting stream. VIDIOC_STREAMON: Invalid argument Dec 18 15:53:00 birdcam motion[765]: [1:ml1:Camera1] [ERR] [VID] vid_start: V4L2 device failed to open
Author
Owner

@JustGlowing commented on GitHub (Jan 2, 2024):

hello everyone, the instructions from @gpambrozio worked for me but I had to move motion.sh in /usr/bin and adjust the motioneye.conf accordingly. Hope this helps somebody :-)

Edit: While the camera worked, motion detection didn't as libcamerify/motion were going in segmentation fault. I downgraded to Buster and everything worked out of the box.

@JustGlowing commented on GitHub (Jan 2, 2024): hello everyone, the instructions from @gpambrozio worked for me but I had to move `motion.sh` in `/usr/bin` and adjust the `motioneye.conf` accordingly. Hope this helps somebody :-) Edit: While the camera worked, motion detection didn't as libcamerify/motion were going in segmentation fault. I downgraded to Buster and everything worked out of the box.
Author
Owner

@Nuuki9 commented on GitHub (Jan 10, 2024):

I previously tried Bookwork using instructions from @gpambrozio and had some success, but autofocus and changing settings didn't work, and I don't think motion detection did either.

Based on comments from @JustGlowing I've just tried Buster but I don't see any cameras listed at all when I select Local V4L2 Camera.

Clearly there are a lot of approaches being taken and all the work being put in is really appreciated. However with such a long thread and with differing methods its hard to nail down which ones work and with what caveats. Would it be feasible for us as a group to briefly write up any working methods in the wiki (or elsewhere), so we have a set of instructions that can be maintained and updated?

I bought the parts to make my mother a birdbox for her 80th, and so far its still on my workbench not working. As spring approaches I'd love to have this up and running for her.

@Nuuki9 commented on GitHub (Jan 10, 2024): I previously tried Bookwork using instructions from @gpambrozio and had some success, but autofocus and changing settings didn't work, and I don't think motion detection did either. Based on comments from @JustGlowing I've just tried Buster but I don't see any cameras listed at all when I select `Local V4L2 Camera`. Clearly there are a lot of approaches being taken and all the work being put in is really appreciated. However with such a long thread and with differing methods its hard to nail down which ones work and with what caveats. Would it be feasible for us as a group to briefly write up any working methods in the wiki (or elsewhere), so we have a set of instructions that can be maintained and updated? I bought the parts to make my mother a birdbox for her 80th, and so far its still on my workbench not working. As spring approaches I'd love to have this up and running for her.
Author
Owner

@JustGlowing commented on GitHub (Jan 10, 2024):

@Nuuki9 under buster the camera is listed under MMAL Camera, not V4L2 Camera.

@JustGlowing commented on GitHub (Jan 10, 2024): @Nuuki9 under buster the camera is listed under MMAL Camera, not V4L2 Camera.
Author
Owner

@Nuuki9 commented on GitHub (Jan 10, 2024):

@Nuuki9 under buster the camera is listed under MMAL Camera, not V4L2 Camera.

I'm pretty sure I checked that.

Currently Im testing the method @Peuz85 provided - that's actually working perfectly, expect the focus (as noted). I'll try adding the manual focus buttons and testing the motion capture, but hopefully it'll end up working.

@Nuuki9 commented on GitHub (Jan 10, 2024): > @Nuuki9 under buster the camera is listed under MMAL Camera, not V4L2 Camera. I'm pretty sure I checked that. Currently Im testing the method @Peuz85 provided - that's actually working perfectly, expect the focus (as noted). I'll try adding the manual focus buttons and testing the motion capture, but hopefully it'll end up working.
Author
Owner

@MichaIng commented on GitHub (Jan 23, 2024):

under buster the camera is listed under MMAL Camera, not V4L2 Camera

If you enable KMS (dtoverlay=vc4-kms-v3d), it is listed under V4L2. This is just the default since Bullseye. However, that way it is not working without libcamerify.

Lacking time to look into this right now: Does someone know whether this really is a motion issue, simply not supporting the new libcamera API, so that motionplus is required, or is there something else we can do our end to make it functional with motion without an API wrapper/emulator like libcamerify?

@MichaIng commented on GitHub (Jan 23, 2024): > under buster the camera is listed under MMAL Camera, not V4L2 Camera If you enable KMS (`dtoverlay=vc4-kms-v3d`), it is listed under V4L2. This is just the default since Bullseye. However, that way it is not working without `libcamerify`. Lacking time to look into this right now: Does someone know whether this really is a `motion` issue, simply not supporting the new libcamera API, so that `motionplus` is required, or is there something else we can do our end to make it functional with `motion` without an API wrapper/emulator like `libcamerify`?
Author
Owner

@strips commented on GitHub (Feb 4, 2024):

@MichaIng This is the only reference to libcamera in Motion I can find: https://motion-project.github.io/motion_config.html

The raspberry Pi camera is set up via an application called libcamera. libcamera provides access to the camera as a v4l2 device but this interface is only available when using a special application. Users must run Motion using the command libcamerify motion and then specify the /dev/videoX device in the Motion configuration file.

I believe I read somewhere that Motion will not get native support for libcamera. MotionPlus is the way to go forward. I'm using only MotionPlus now where I was using Motion with MotionEye before. Works pretty good after lots of fiddling with the config files. I miss the ease of MotionEye.

To create the confusion absolute the RPI-guys have renamed libcam to rpicam: https://www.raspberrypi.com/documentation/computers/camera_software.html

rpicam-apps applications have been renamed from libcamera-* to rpicam-*. Symbolic links are installed to allow users to keep using the old application names, but these will be deprecated in the future. Users are encouraged to adopt the new application names as soon as possible.

@strips commented on GitHub (Feb 4, 2024): @MichaIng This is the only reference to libcamera in Motion I can find: https://motion-project.github.io/motion_config.html > The raspberry Pi camera is set up via an application called libcamera. libcamera provides access to the camera as a v4l2 device but this interface is only available when using a special application. Users must run Motion using the command libcamerify motion and then specify the /dev/videoX device in the Motion configuration file. I believe I read somewhere that Motion will not get native support for libcamera. MotionPlus is the way to go forward. I'm using only MotionPlus now where I was using Motion with MotionEye before. Works pretty good after lots of fiddling with the config files. I miss the ease of MotionEye. To create the confusion absolute the RPI-guys have renamed libcam to rpicam: https://www.raspberrypi.com/documentation/computers/camera_software.html > rpicam-apps applications have been renamed from libcamera-* to rpicam-*. Symbolic links are installed to allow users to keep using the old application names, but these will be deprecated in the future. Users are encouraged to adopt the new application names as soon as possible.
Author
Owner

@axeljerabek commented on GitHub (Feb 4, 2024):

At the moment, I run motionplus and am quite happy with it. Still, from the Raspberries, I feed the stream directly from the libcamera-apps (or the newer version) into the rtmp module from nginx and feed motion(plus) with this stream as netcam. Makes the softwares a bit more independend and I can actually create the stream on the Raspberry directly as h264 stream and motion records without reencoding, that saves a lot of power on the Raspberry side, so that I even have a few small Raspberry Zeros as camera platforms, since the motion software runs on an Intel Nuc11 which has a lot more power and can pickup the streams of 6 cameras. As said, not to be reencoded, that is one big advantage, and also the Raspberries are not overcomputing any motion parts. Still you are free where you run your motion software, can also be on a Raspberry. My setup is partly documented here:
https://www.wetransco.de/2023/12/raspberry-pi-zero-2w-debian-bookworm-und-libcamera-module-2-3-streaming/

@axeljerabek commented on GitHub (Feb 4, 2024): At the moment, I run motionplus and am quite happy with it. Still, from the Raspberries, I feed the stream directly from the libcamera-apps (or the newer version) into the rtmp module from nginx and feed motion(plus) with this stream as netcam. Makes the softwares a bit more independend and I can actually create the stream on the Raspberry directly as h264 stream and motion records without reencoding, that saves a lot of power on the Raspberry side, so that I even have a few small Raspberry Zeros as camera platforms, since the motion software runs on an Intel Nuc11 which has a lot more power and can pickup the streams of 6 cameras. As said, not to be reencoded, that is one big advantage, and also the Raspberries are not overcomputing any motion parts. Still you are free where you run your motion software, can also be on a Raspberry. My setup is partly documented here: https://www.wetransco.de/2023/12/raspberry-pi-zero-2w-debian-bookworm-und-libcamera-module-2-3-streaming/
Author
Owner

@mishramahim commented on GitHub (Feb 10, 2024):

RaspiOs bookworm 64 bit with raspicam v3 (finally works)

sudo apt update && sudo apt upgrade -y

sudo rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED

sudo apt --no-install-recommends install ca-certificates curl python3 python3-distutils python3-dev libcurl4-openssl-dev gcc libssl-dev

curl -sSfO 'https://bootstrap.pypa.io/get-pip.py'

sudo python3 get-pip.py

sudo python3 -m pip install 'https://github.com/motioneye-project/motioneye/archive/dev.tar.gz'

sudo apt install -y libcamera-v4l2

sudo apt install -y libcamera-tools

sudo motioneye_init

sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service

sudo systemctl daemon-reload

sudo systemctl enable motioneye --now

sudo reboot

http://yourpiaddress:8765/
It can happen that when changes are made in the MotionEye, the message “unable to open video device” appears. sudo reboot (takes a little longer) and then it works
Have fun ;-)

This solution works except autofocus, is any way to make the autofocus working?


Hi I tried this process MotioneyeOS is working under camera showing unicam using /dev/video0 but it is still showing “unable to open video device”

using aarch64
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debia

libcamera-hello is giving msg
Unable to set format: Device or resource busy
v4l2-ctl --list-devices
unicam (platform:3f801000.csi):
/dev/video0
/dev/video1
/dev/media3

sudo v4l2-ctl --device=/dev/video1 --all
Driver Info:
Driver name : unicam
Card type : unicam
Bus info : platform:3f801000.csi
Driver version : 6.1.73
Capabilities : 0xa5a00001
Video Capture
Metadata Capture
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x25a00000
Metadata Capture
Read/Write
Streaming
Extended Pix Format
Media Driver Info:
Driver name : unicam
Model : unicam
Serial :
Bus info : platform:3f801000.csi
Media version : 6.1.73
Hardware revision: 0x00000000 (0)
Driver version : 6.1.73

Need support struggling on this from long time. Not and expert but love to work with PI

@mishramahim commented on GitHub (Feb 10, 2024): > > **RaspiOs bookworm 64 bit with raspicam v3 (finally works)** > > > sudo apt update && sudo apt upgrade -y > > > > > > > sudo rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED > > > > > > > sudo apt --no-install-recommends install ca-certificates curl python3 python3-distutils python3-dev libcurl4-openssl-dev gcc libssl-dev > > > > > > > curl -sSfO 'https://bootstrap.pypa.io/get-pip.py' > > > > > > > sudo python3 get-pip.py > > > > > > > sudo python3 -m pip install 'https://github.com/motioneye-project/motioneye/archive/dev.tar.gz' > > > > > > > sudo apt install -y libcamera-v4l2 > > > > > > > sudo apt install -y libcamera-tools > > > > > > > sudo motioneye_init > > > > > > > sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service > > > > > > > sudo systemctl daemon-reload > > > > > > > sudo systemctl enable motioneye --now > > > > > > > sudo reboot > > > > > > http://yourpiaddress:8765/ > > It can happen that when changes are made in the MotionEye, the message “unable to open video device” appears. `sudo reboot` (takes a little longer) and then it works > > Have fun ;-) > > This solution works except autofocus, is any way to make the autofocus working? ------------------------------------------------------------------------------------------------------------------------------------------ Hi I tried this process MotioneyeOS is working under camera showing unicam using /dev/video0 but it is still showing “unable to open video device” using aarch64 PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debia libcamera-hello is giving msg Unable to set format: Device or resource busy v4l2-ctl --list-devices unicam (platform:3f801000.csi): /dev/video0 /dev/video1 /dev/media3 sudo v4l2-ctl --device=/dev/video1 --all Driver Info: Driver name : unicam Card type : unicam Bus info : platform:3f801000.csi Driver version : 6.1.73 Capabilities : 0xa5a00001 Video Capture Metadata Capture Read/Write Streaming Extended Pix Format Device Capabilities Device Caps : 0x25a00000 Metadata Capture Read/Write Streaming Extended Pix Format Media Driver Info: Driver name : unicam Model : unicam Serial : Bus info : platform:3f801000.csi Media version : 6.1.73 Hardware revision: 0x00000000 (0) Driver version : 6.1.73 Need support struggling on this from long time. Not and expert but love to work with PI
Author
Owner

@mishramahim commented on GitHub (Feb 10, 2024):

Tried this command
sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service

getting msg
sed: -e expression #1, char 8: unknown option to `s'

@mishramahim commented on GitHub (Feb 10, 2024): Tried this command sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service getting msg sed: -e expression #1, char 8: unknown option to `s'
Author
Owner

@pingufreak commented on GitHub (Feb 10, 2024):

Hi,

you need to escape the / with /.

Kr

pingu

Von: mishramahim @.>
Gesendet: Samstag, 10. Februar 2024 18:47
An: motioneye-project/motioneye @.
>
Cc: pingufreak @.>; Comment @.>
Betreff: Re: [motioneye-project/motioneye] RPi Camera 3 compatibility (Issue #2683)

Tried this command
sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service

getting msg
sed: -e expression #1 https://github.com/motioneye-project/motioneye/issues/1 , char 8: unknown option to `s'


Reply to this email directly, view it on GitHub https://github.com/motioneye-project/motioneye/issues/2683#issuecomment-1937081191 , or unsubscribe https://github.com/notifications/unsubscribe-auth/APZW37KMGJ2SKVLNYYS2F6TYS6XCZAVCNFSM6AAAAAATVG7SCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXGA4DCMJZGE .
You are receiving this because you commented. https://github.com/notifications/beacon/APZW37JYGF3ZRBV45PEE3ODYS6XCZA5CNFSM6AAAAAATVG7SCGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTTOWBWO.gif Message ID: @.*** @.***> >

@pingufreak commented on GitHub (Feb 10, 2024): Hi, you need to escape the / with \/. Kr pingu Von: mishramahim ***@***.***> Gesendet: Samstag, 10. Februar 2024 18:47 An: motioneye-project/motioneye ***@***.***> Cc: pingufreak ***@***.***>; Comment ***@***.***> Betreff: Re: [motioneye-project/motioneye] RPi Camera 3 compatibility (Issue #2683) Tried this command sudo sed -i 's//usr/local/bin/meyectl//usr/bin/libcamerify /usr/local/bin/meyectl/' /etc/systemd/system/motioneye.service getting msg sed: -e expression #1 <https://github.com/motioneye-project/motioneye/issues/1> , char 8: unknown option to `s' — Reply to this email directly, view it on GitHub <https://github.com/motioneye-project/motioneye/issues/2683#issuecomment-1937081191> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/APZW37KMGJ2SKVLNYYS2F6TYS6XCZAVCNFSM6AAAAAATVG7SCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXGA4DCMJZGE> . You are receiving this because you commented. <https://github.com/notifications/beacon/APZW37JYGF3ZRBV45PEE3ODYS6XCZA5CNFSM6AAAAAATVG7SCGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTTOWBWO.gif> Message ID: ***@***.*** ***@***.***> >
Author
Owner

@mishramahim commented on GitHub (Feb 15, 2024):

It was working with the solution shared but camera stop working after 5 to 6hrs of operation and it start showing issues. Raspberry Pi 2 W Zero was heating up I shifted to 4B with good heatsink but is is still working 5 to 6 hours.
Any other method of using camera module 3 with bookwork Raspberry pi 4B

@mishramahim commented on GitHub (Feb 15, 2024): It was working with the solution shared but camera stop working after 5 to 6hrs of operation and it start showing issues. Raspberry Pi 2 W Zero was heating up I shifted to 4B with good heatsink but is is still working 5 to 6 hours. Any other method of using camera module 3 with bookwork Raspberry pi 4B
Author
Owner

@mishramahim commented on GitHub (Feb 18, 2024):

Hi can anyone help My camera is getting detected but not working. I used other camera(RPI 1.3) with same cable and same is working fine.
Screenshot 2024-02-19 014110
Screenshot

@mishramahim commented on GitHub (Feb 18, 2024): Hi can anyone help My camera is getting detected but not working. I used other camera(RPI 1.3) with same cable and same is working fine. ![Screenshot 2024-02-19 014110](https://github.com/motioneye-project/motioneye/assets/43771502/13e339ef-3585-44ed-853f-3a4f3de6757b) ![Screenshot](https://github.com/motioneye-project/motioneye/assets/43771502/fd10cc32-0ac8-47ef-b9fb-2c9e48280599)
Author
Owner

@MichaIng commented on GitHub (May 13, 2024):

Btw, an alternative to libcamerify is to create a local network stream via rpicam-vid (previously raspivid) and attach that as network camera to motionEye: https://www.raspberrypi.com/documentation/computers/camera_software.html#network-streaming
But not sure about performance implications.

@MichaIng commented on GitHub (May 13, 2024): Btw, an alternative to `libcamerify` is to create a local network stream via `rpicam-vid` (previously `raspivid`) and attach that as network camera to motionEye: https://www.raspberrypi.com/documentation/computers/camera_software.html#network-streaming But not sure about performance implications.
Author
Owner

@raspberrypicoder1 commented on GitHub (May 15, 2024):

I've just read through this, and am really confused. Can anyone give a step-by-step tutorial for Raspberry Pi OS 64bit, on a raspberry pi 4? I am using the camera module 3.

@raspberrypicoder1 commented on GitHub (May 15, 2024): I've just read through this, and am really confused. Can anyone give a step-by-step tutorial for Raspberry Pi OS 64bit, on a raspberry pi 4? I am using the camera module 3.
Author
Owner

@MichaIng commented on GitHub (Jul 3, 2024):

@raspberrypicoder1
After following the motionEye install instructions: https://github.com/motioneye-project/motioneye?tab=readme-ov-file#installation

apt install libcamera-v4l2 libcamera-tools
sed -i 's|^ExecStart=/usr/local/bin/meyectl|ExecStart=/usr/bin/libcamerify /usr/local/bin/meyectl|' /etc/systemd/system/motioneye.service
systemctl daemon-reload
systemctl restart motioneye
@MichaIng commented on GitHub (Jul 3, 2024): @raspberrypicoder1 After following the motionEye install instructions: https://github.com/motioneye-project/motioneye?tab=readme-ov-file#installation ```sh apt install libcamera-v4l2 libcamera-tools sed -i 's|^ExecStart=/usr/local/bin/meyectl|ExecStart=/usr/bin/libcamerify /usr/local/bin/meyectl|' /etc/systemd/system/motioneye.service systemctl daemon-reload systemctl restart motioneye ```
Author
Owner

@letkan commented on GitHub (Jul 4, 2024):

apt install libcamera-v4l2 libcamera-tools
sed -i 's|^ExecStart=/usr/local/bin/meyectl|ExecStart=/usr/bin/libcamerify /usr/local/bin/meyectl|' /etc/systemd/system/motioneye.service
systemctl daemon-reload
systemctl restart motioneye

Hi, it took me a while to find these commands but now my camera 3 works with motioneye, thanks.
The next thing to figure out is how to enable autofocus in this context (not being a programmer).
Any help would be appreciated.

@letkan commented on GitHub (Jul 4, 2024): > ```shell > apt install libcamera-v4l2 libcamera-tools > sed -i 's|^ExecStart=/usr/local/bin/meyectl|ExecStart=/usr/bin/libcamerify /usr/local/bin/meyectl|' /etc/systemd/system/motioneye.service > systemctl daemon-reload > systemctl restart motioneye > ``` Hi, it took me a while to find these commands but now my camera 3 works with motioneye, thanks. The next thing to figure out is how to enable autofocus in this context (not being a programmer). Any help would be appreciated.
Author
Owner

@MichaIng commented on GitHub (Jul 4, 2024):

It is not enabled by default?

This guide seems complete: https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2
Not sure whether this is in scope for motionEye. Probably if someone is just in mood and has the time to implement a nice GUI to toggle it, using this or another picamera Python module. On my end, I'll implement libcamerify first, so that it is offered to be installed automatically, when libcamera API is detected on Raspberry Pi, and probably calling the internal motion instances with libcamerify, instead of the whole meyectl process. But not sure yet which one is better, performance-wise of for other reasons. The benefit of wrapping meyectl itself is, that the RPi camera module appears as regular V4L2 camera 🤔.

@MichaIng commented on GitHub (Jul 4, 2024): It is not enabled by default? This guide seems complete: https://www.tomshardware.com/how-to/raspberry-pi-camera-module-3-python-picamera-2 Not sure whether this is in scope for motionEye. Probably if someone is just in mood and has the time to implement a nice GUI to toggle it, using this or another picamera Python module. On my end, I'll implement `libcamerify` first, so that it is offered to be installed automatically, when libcamera API is detected on Raspberry Pi, and probably calling the internal `motion` instances with `libcamerify`, instead of the whole `meyectl` process. But not sure yet which one is better, performance-wise of for other reasons. The benefit of wrapping `meyectl` itself is, that the RPi camera module appears as regular V4L2 camera 🤔.
Author
Owner

@letkan commented on GitHub (Jul 9, 2024):

As per my test, autofocus is not implemented by default. The guide you mention is complete but the requirements are both libcamera and picamera2 and I haven't seen a way to use them with Motioneye.

from picamera2 import Picamera2
from libcamera import controls
picam2 = Picamera2()
picam2.start(show_preview=True)
picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous})

Meanwhile I switched to Motionplus which plays much nicer with this camera and allows option for continuous autofocus and all. To me it looks like the way forward is libcamera instead of v4l2. I don't like loosing the nice web interface of Motioneye to config files but overall, the final setup works better in my case. Motionplus has a web interface also but it is rudimentary by comparison.

@letkan commented on GitHub (Jul 9, 2024): As per my test, autofocus is not implemented by default. The guide you mention is complete but the requirements are both libcamera and picamera2 and I haven't seen a way to use them with Motioneye. ``` from picamera2 import Picamera2 from libcamera import controls picam2 = Picamera2() picam2.start(show_preview=True) picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous}) ``` Meanwhile I switched to Motionplus which plays much nicer with this camera and allows option for continuous autofocus and all. To me it looks like the way forward is libcamera instead of v4l2. I don't like loosing the nice web interface of Motioneye to config files but overall, the final setup works better in my case. Motionplus has a web interface also but it is rudimentary by comparison.
Author
Owner

@shooftie commented on GitHub (Jul 9, 2024):

RPi 3 Model A+ (aarch64) – DietPi v9.6.1 – RPi Camera Module v3 Noir

I tried everything in this thread and the only thing that worked for me was:

  • install dev branch (I did this via dietpi-software)
  • apt install libcamera-v4l2 libcamera-tools
  • sed -i 's/\/usr\/local\/bin\/meyectl/\/usr\/bin\/libcamerify \/usr\/local\/bin\/meyectl/' /etc/systemd/system/motioneye.service

This was the key for me.

Pretty sure that this was a fresh install of Diet-Pi, too. I will give it another flash and report back if otherwise.

@shooftie commented on GitHub (Jul 9, 2024): RPi 3 Model A+ (aarch64) – DietPi v9.6.1 – RPi Camera Module v3 Noir I tried everything in this thread and the only thing that worked for me was: - install `dev` branch (I did this via `dietpi-software`) - `apt install libcamera-v4l2 libcamera-tools` - `sed -i 's/\/usr\/local\/bin\/meyectl/\/usr\/bin\/libcamerify \/usr\/local\/bin\/meyectl/' /etc/systemd/system/motioneye.service` [This](https://github.com/motioneye-project/motioneye/issues/2812#issuecomment-1817391735) was the key for me. Pretty sure that this was a fresh install of Diet-Pi, too. I will give it another flash and report back if otherwise.
Author
Owner

@letkan commented on GitHub (Jul 9, 2024):

I'm on the same OS/version, are you saying with the above settings (which I've also used) you got autofocus working without any other config settings, "out-of-the-box", so to speak?
For libcamera:autofocus there are 3 states:

  • manual
  • auto (whatever that means)
  • continuous

which need to be set either by code i.e.
picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous})
or in a .conf file as in Motionplus. That's what I've learned so far.

@letkan commented on GitHub (Jul 9, 2024): I'm on the same OS/version, are you saying with the above settings (which I've also used) you got autofocus working without any other config settings, "out-of-the-box", so to speak? For libcamera:autofocus there are 3 states: - manual - auto (whatever that means) - continuous which need to be set either by code i.e. `picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous})` or in a .conf file as in Motionplus. That's what I've learned so far.
Author
Owner

@Hedi2525 commented on GitHub (Oct 15, 2024):

How do you install the Dev Branch without using the dietpi software?
Thanks in advance.

@Hedi2525 commented on GitHub (Oct 15, 2024): How do you install the Dev Branch without using the dietpi software? Thanks in advance.
Author
Owner

@xandark commented on GitHub (Apr 3, 2025):

You can install the latest motioneye right from git like this:

sudo python3 -m pip install --break-system-packages git+https://github.com/motioneye-project/motioneye.git

Makes the installation easy again.

@xandark commented on GitHub (Apr 3, 2025): You can install the latest motioneye right from git like this: `sudo python3 -m pip install --break-system-packages git+https://github.com/motioneye-project/motioneye.git` Makes the installation easy again.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/motioneye#2350
No description provided.