Open Firesphere opened 1 year ago
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: @.***>
He copied just my answer... You need to escape the slashes. …
All working now, thank you!
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 Ö ;-)
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. … <#m419337762933316581>
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: @.***>
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?
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
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 worksHave fun ;-)
This solution works except autofocus, is any way to make the autofocus working?
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/
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:
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
Now you should be able to control the camera focus manually straight from the camera window.
@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
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.
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 under buster the camera is listed under MMAL Camera, not V4L2 Camera.
@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.
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 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.
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/
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
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'
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: @. @.> >
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
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.
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.
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 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
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.
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 🤔.
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.
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:
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.
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:
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.
How do you install the Dev Branch without using the dietpi software? Thanks in advance.
Will MotionEye, in its current state, be compatible with the new RPi cam 3? https://www.raspberrypi.com/news/new-autofocus-camera-modules/