Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4615

Camera board • Cannot enumerate frame intervals for Pi camera

$
0
0
Hello,

I'm trying to use an open source library (https://github.com/kekyo/FlashCap) for interacting with a Pi camera.
Under Linux the library uses the V4L2 api to interact with camera devices.

I first tried using this library on a PI Model 3B+ running bullseye (lite) with an attached Pi Camera v1.3
Unfortunately the FlashCap library wouldn't enumerate the camera.

To eliminate a faulty/legacy camera being the issue, I bought a PI Model 4 and a Pi Camera Module v3. I installed the latest version of bookworm (lite).
Again, the FlashCap library wouldn't enumerate the new camera either.
However this command suggests the camera is attached correctly:

Code:

pi@raspberrypi:~ $ libcamera-hello --list-camerasAvailable cameras-----------------0 : imx708_wide [4608x2592 10-bit RGGB] (/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]
Clearly the problem lies with FlashCap, so I spent some time hacking around with the FlashCap source, adding some diagnostics tracing to help understand where things were going wrong.

It soon became clear the the problem is that the FlashCap library tries to build up the various combinations of characteristics that the camera supports by first querying for devices and their general capabilities using ioctl(VIDIOC_QUERYCAP); then querying the formats supported by each device using ioctl(VIDIOC_ENUM_FMT); then the frame sizes using ioctl(VIDIOC_ENUM_FRAMESIZES) and finally the frame intervals using ioctl(VIDIOC_ENUM_FRAMEINTERVALS).

The capability, frame formats and frame sizes queries all seem to return plausible values. However the frame interval query always seems to fail (returning Inappropriate ioctl for device) regardless of the frame format or frame size being queried.

I also tried the following v4l2-ctl commands and again the frame intervals query does not seem to return anything.

Code:

pi@raspberrypi:~ $ v4l2-ctl --device /dev/video0 --list-formatsioctl: VIDIOC_ENUM_FMT        Type: Video Capture        [0]: 'YUYV' (YUYV 4:2:2)        [1]: 'UYVY' (UYVY 4:2:2)        [2]: 'YVYU' (YVYU 4:2:2)        [3]: 'VYUY' (VYUY 4:2:2)        [4]: 'RGBP' (16-bit RGB 5-6-5)        [5]: 'RGBR' (16-bit RGB 5-6-5 BE)        [6]: 'RGBO' (16-bit A/XRGB 1-5-5-5)        [7]: 'RGBQ' (16-bit A/XRGB 1-5-5-5 BE)        [8]: 'RGB3' (24-bit RGB 8-8-8)        [9]: 'BGR3' (24-bit BGR 8-8-8)        [10]: 'RGB4' (32-bit A/XRGB 8-8-8-8)        [11]: 'BA81' (8-bit Bayer BGBG/GRGR)        [12]: 'GBRG' (8-bit Bayer GBGB/RGRG)        [13]: 'GRBG' (8-bit Bayer GRGR/BGBG)        [14]: 'RGGB' (8-bit Bayer RGRG/GBGB)        [15]: 'pBAA' (10-bit Bayer BGBG/GRGR Packed)        [16]: 'BG10' (10-bit Bayer BGBG/GRGR)        [17]: 'pGAA' (10-bit Bayer GBGB/RGRG Packed)        [18]: 'GB10' (10-bit Bayer GBGB/RGRG)        [19]: 'pgAA' (10-bit Bayer GRGR/BGBG Packed)        [20]: 'BA10' (10-bit Bayer GRGR/BGBG)        [21]: 'pRAA' (10-bit Bayer RGRG/GBGB Packed)        [22]: 'RG10' (10-bit Bayer RGRG/GBGB)        [23]: 'pBCC' (12-bit Bayer BGBG/GRGR Packed)        [24]: 'BG12' (12-bit Bayer BGBG/GRGR)        [25]: 'pGCC' (12-bit Bayer GBGB/RGRG Packed)        [26]: 'GB12' (12-bit Bayer GBGB/RGRG)        [27]: 'pgCC' (12-bit Bayer GRGR/BGBG Packed)        [28]: 'BA12' (12-bit Bayer GRGR/BGBG)        [29]: 'pRCC' (12-bit Bayer RGRG/GBGB Packed)        [30]: 'RG12' (12-bit Bayer RGRG/GBGB)        [31]: 'pBEE' (14-bit Bayer BGBG/GRGR Packed)        [32]: 'BG14' (14-bit Bayer BGBG/GRGR)        [33]: 'pGEE' (14-bit Bayer GBGB/RGRG Packed)        [34]: 'GB14' (14-bit Bayer GBGB/RGRG)        [35]: 'pgEE' (14-bit Bayer GRGR/BGBG Packed)        [36]: 'GR14' (14-bit Bayer GRGR/BGBG)        [37]: 'pREE' (14-bit Bayer RGRG/GBGB Packed)        [38]: 'RG14' (14-bit Bayer RGRG/GBGB)        [39]: 'GREY' (8-bit Greyscale)        [40]: 'Y10P' (10-bit Greyscale (MIPI Packed))        [41]: 'Y10 ' (10-bit Greyscale)        [42]: 'Y12P' (12-bit Greyscale (MIPI Packed))        [43]: 'Y12 ' (12-bit Greyscale)        [44]: 'Y14P' (14-bit Greyscale (MIPI Packed))        [45]: 'Y14 ' (14-bit Greyscale)pi@raspberrypi:~ $ v4l2-ctl --device /dev/video0 --list-framesizes YUYVioctl: VIDIOC_ENUM_FRAMESIZES        Size: Stepwise 16x16 - 16376x16376 with step 1/1        pi@raspberrypi:~ $ v4l2-ctl --device /dev/video0 --list-frameintervals height=640,width=480,pixelformat=YUYVioctl: VIDIOC_ENUM_FRAMEINTERVALS      

So, my questions are:
  • Should the VIDIOC_ENUM_FRAMEINTERVALS query be returning a valid value?
  • Does the VIDIOC_ENUM_FRAMEINTERVALS query work for others (ie: is this a hardware problem with two separate cameras? seems unlikely?)
  • Is it reasonable for a library like FlashCap to make an assumption about supported frame intervals/rates if VIDIOC_ENUM_FRAMEINTERVALS does not return a valid value?
  • Is there some other gotcha with calling VIDIOC_ENUM_FRAMEINTERVALS that FlashCap is overlooking?
Thanks
Greg

Statistics: Posted by gplwhite — Sun Jan 21, 2024 3:00 am — Replies 1 — Views 93



Viewing all articles
Browse latest Browse all 4615

Trending Articles