-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libcamerify seems to work partly, but motion isn't able to open the device #69
Comments
Can you paste the whole logs with I suspect the failure is here:
|
Is there anything specific in your motion.conf? Or can I test this by simply installing 'motion' ? |
Can motion be configured to output logs to the stdout/stderr to interleave them with the libcamera logs? The output you have is confusing - and seems like not all the calls I would expect to run in the v4l2 layer are being called. |
Specifically, the querycap should be calling into the v4l2 layer at And that function is /really/ short and only returns success... |
libcamerify -d -d ./src/motion -d ALL
The 'open' call is being made through the v4l2-adaption layer - but the other ioctls are not. I wonder if it's trying to use libv4l or something which is intercepting the calls and breaking the libcamera v4l2 layer. |
Hi, pi@raspberrypi:~ $ libcamerify -d -d motion -c /home/pi/.motion/motion.conf -l /media/pi/USBVIDEO/motion.log I attached also the log of motion (level all == 9) and also my motion config file. I made a fresh bullseye installation an also motion was a fresh install, so nothing special involved which could interfere as far as i know. Thanks |
[1:ml1] [DBG] [ALL] [Feb 27 09:00:25] util_parms_add: Parsed: >input< >-1< |
In motion file video_common.c I found the following function:
} So the part /* Now add any missing default items */ explains to me why in the motion log those lines show up without been given in the motion.conf |
Ok - your logs looks similar to the ones I made. Could you raise this somewhere with motion to ask if they do anything that would otherwise prevent an LD_PRELOAD library from intercepting ioctls to a V4L2 video device? (That's what I think is failing) |
Ok I will do as you proposed. Thanks for your analyze in the meanwhile |
(Please report back here too of course, or cross link the issues so I can subscribe to see / discuss on the motion side) |
I left a comment for the same topic, as far as I assume and gave them a link to our discussion. |
Starting motion with the libcamerify helper script leads to the following behavior:
libcamerify -d motion -c /home/pi/.motion/motion.conf -l /media/pi/USBVIDEO/motion.log
[0:motion] [NTC] [ALL] conf_load: Processing thread 0 - config file /home/pi/.motion/motion.conf
[0:motion] [ALR] [ALL] conf_cmdparse: Unknown config option "
"
[0:motion] [NTC] [ALL] motion_startup: Logging to file (/media/pi/USBVIDEO/motion.log)
[0:29:40.002029132] [5366] INFO Camera camera_manager.cpp:299 libcamera v0.0.3+40-9b860a66
[0:29:40.128392311] [5367] INFO RPI raspberrypi.cpp:1425 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media4 and ISP device /dev/media0
[0:29:40.128564532] [5366] DEBUG V4L2Compat v4l2_compat_manager.cpp:79 Started camera manager
[0:29:40.128704328] [5366] DEBUG V4L2Compat v4l2_camera_proxy.cpp:50 [] open()
[0:29:40.129057344] [5366] DEBUG V4L2Compat v4l2_compat_manager.cpp:163 Opened /dev/video0 -> fd 8
[0:29:40.129230602] [5366] DEBUG V4L2Compat v4l2_camera_proxy.cpp:739 [/dev/video0 (fd:8)] vidioc_streamoff()
[0:29:40.129259879] [5366] DEBUG V4L2Compat v4l2_camera_proxy.cpp:85 [/dev/video0 (fd:8)] close()
[0:29:40.217066672] [5366] DEBUG V4L2Compat v4l2_camera_proxy.cpp:50 [] open()
[0:29:40.217502299] [5366] DEBUG V4L2Compat v4l2_compat_manager.cpp:163 Opened /dev/video0 -> fd 8
[0:29:40.217595446] [5366] DEBUG V4L2Compat v4l2_camera_proxy.cpp:739 [/dev/video0 (fd:8)] vidioc_streamoff()
[0:29:40.217622780] [5366] DEBUG V4L2Compat v4l2_camera_proxy.cpp:85 [/dev/video0 (fd:8)] close()
[0:29:49.955948844] [5366] DEBUG V4L2Compat v4l2_camera_proxy.cpp:50 [] open()
[0:29:49.956718228] [5366] DEBUG V4L2Compat v4l2_compat_manager.cpp:163 Opened /dev/video0 -> fd 8
[0:29:49.956928208] [5366] DEBUG V4L2Compat v4l2_camera_proxy.cpp:739 [/dev/video0 (fd:8)] vidioc_streamoff()
[0:29:49.956983263] [5366] DEBUG V4L2Compat v4l2_camera_proxy.cpp:85 [/dev/video0 (fd:8)] close()
and my motion log shows:
....
[1:ml1] [NTC] [ALL] [Feb 26 18:03:30] motion_init: Camera 0 started: motion detection Enabled
[1:ml1] [NTC] [VID] [Feb 26 18:03:30] vid_start: Opening V4L2 device
[1:ml1] [DBG] [ALL] [Feb 26 18:03:30] util_parms_add: Parsed: >palette< >17<
[1:ml1] [DBG] [ALL] [Feb 26 18:03:30] util_parms_add: Parsed: >input< >-1<
[1:ml1] [DBG] [ALL] [Feb 26 18:03:30] util_parms_add: Parsed: >norm< >0<
[1:ml1] [DBG] [ALL] [Feb 26 18:03:30] util_parms_add: Parsed: >frequency< >0<
[1:ml1] [NTC] [VID] [Feb 26 18:03:30] v4l2_device_open: Using videodevice /dev/video0 and input -1
[1:ml1] [ERR] [VID] [Feb 26 18:03:30] v4l2_device_capability: Not a V4L2 device?
[1:ml1] [DBG] [VID] [Feb 26 18:03:30] v4l2_device_close: close
[1:ml1] [DBG] [VID] [Feb 26 18:03:30] v4l2_device_cleanup: vid_source
[1:ml1] [ERR] [VID] [Feb 26 18:03:30] vid_start: V4L2 device failed to open
.......
It seems the call to xioctl(vid_source, VIDIOC_QUERYCAP, &vid_source->cap) in motion leads to a negative ret code:
.\motion-master\src\video_v4l2.c line 1496
....
static int v4l2_device_capability(struct video_dev *curdev)
{
....
The camera (Camer V3 with imx708) works fine when I check this with libcamera-vid. And feeding the data through a nginx server (rmtp) which can the motion read from does also work but it's slow in regard to fps and it needs nearly 100% cpu of an raspi4.
So not my prefered solution :(.
My device is a Raspi4 with 64 Bit bullseye, with motion [0:motion] [NTC] [ALL] [Feb 26 18:03:30] motion_startup: Motion 4.5.1 Started
Any idea for a fix or a work-around?
The text was updated successfully, but these errors were encountered: