Open Firesphere opened 1 year ago
I just try RPI3b (MotionEyeOS) + RPI Camera 3, It's not work and still find the solution.
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
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 withmotion_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 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
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!
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.
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.
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 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.
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
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.
@gpambrozio It works ! Many thanks !
My setup :
Some additional advices/observations:
For those who have gotten this workaround to work:
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
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.
Hey together, what am I doing wrong?
motioneye.conf
by following the instructions.camera-1.conf
-> videodevice /dev/video0
but no picture in the preview.
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?
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 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.
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.
None of these worked for me on a rpi4 running latest 64 bit os. Really wish I could use this new camera.
I have few cameras lying idle because of the issue and lack of time to dig into the issues.
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;
}
}
}
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 are you using this as a replacement for motioneye or 'just' (great idea :) ) as a streaming source / camera FOR motioneye?
@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.
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 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.
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 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 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.
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.
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.
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?
thanks for the solution @strips with this approach does the HD picture on motion function work or is it just the video stream?
@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
@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 :-)
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.
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.
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 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
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 withmotion_binary
looks like this:motion_binary /home/pi/motion.sh
Depending on your debian distribution you might have to also install
libcamera-tools
withsudo 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?
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?
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 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 withmotion_binary
looks like this:motion_binary /home/pi/motion.sh
Depending on your debian distribution you might have to also install
libcamera-tools
withsudo 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?
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: @.***>
@clds84: i tried this solution first, but motion detection was not proper. Hopefully your solution will work for you. :)
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?
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.
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
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 ;-)
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.
@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'
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
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?
Will MotionEye, in its current state, be compatible with the new RPi cam 3? https://www.raspberrypi.com/news/new-autofocus-camera-modules/