Skip to content

"Unable to start capturing: Invalid argument" on Raspberry Pi 2B #139

Description

@fphammerle

Hi,

I get "Unable to start capturing: Invalid argument" on a Raspberry Pi 2B running Raspberry Pi OS Bullseye:

$ sudo -g video ustreamer --resolution 1920x1080
-- INFO  [13606.486      main] -- Using internal blank placeholder
-- INFO  [13606.487      main] -- Listening HTTP on [127.0.0.1]:8080
-- INFO  [13606.488    stream] -- Using V4L2 device: /dev/video0
-- INFO  [13606.488    stream] -- Using desired FPS: 0
-- INFO  [13606.488      http] -- Starting HTTP eventloop ...
================================================================================
-- INFO  [13606.493    stream] -- Device fd=8 opened
-- INFO  [13606.493    stream] -- Using input channel: 0
-- INFO  [13606.493    stream] -- Using resolution: 1920x1080
-- INFO  [13606.493    stream] -- Using pixelformat: YUYV
-- INFO  [13606.493    stream] -- Querying HW FPS changing is not supported
-- INFO  [13606.493    stream] -- Using IO method: MMAP
-- INFO  [13606.523    stream] -- Requested 5 device buffers, got 5
-- ERROR [13606.524    stream] -- Unable to start capturing: Invalid argument
-- INFO  [13606.542    stream] -- Device fd=8 closed
-- INFO  [13606.542    stream] -- Sleeping 1 seconds before new stream init ...
================================================================================
-- INFO  [13607.548    stream] -- Device fd=8 opened
-- INFO  [13607.548    stream] -- Using input channel: 0
-- INFO  [13607.548    stream] -- Using resolution: 1920x1080
-- INFO  [13607.548    stream] -- Using pixelformat: YUYV
-- INFO  [13607.548    stream] -- Querying HW FPS changing is not supported
-- INFO  [13607.548    stream] -- Using IO method: MMAP
-- INFO  [13607.578    stream] -- Requested 5 device buffers, got 5
-- ERROR [13607.580    stream] -- Unable to start capturing: Invalid argument
-- INFO  [13607.597    stream] -- Device fd=8 closed
-- INFO  [13607.597    stream] -- Sleeping 1 seconds before new stream init ...
^C-- INFO  [13608.282      main] -- ===== Stopping by SIGINT =====
-- INFO  [13608.283      http] -- HTTP eventloop stopped
-- INFO  [13608.598      main] -- Bye-bye
$ journalctl --lines=3 -o cat
   someone : TTY=pts/1 ; PWD=/home/someone ; USER=someone ; GROUP=video ; COMMAND=/usr/bin/ustreamer>
unicam 3f801000.csi: Failed to start media pipeline: -22
unicam 3f801000.csi: Failed to start media pipeline: -22
$ cat /proc/cpuinfo | tail -n 4 | grep -v Serial
Hardware	: BCM2835
Revision	: a01041
Model		: Raspberry Pi 2 Model B Rev 1.1
$ cat /etc/issue
Raspbian GNU/Linux 11 \n \l
$ sudo -g video v4l2-ctl --info
Driver Info:
	Driver name      : unicam
	Card type        : unicam
	Bus info         : platform:3f801000.csi
	Driver version   : 5.10.92
	Capabilities     : 0xa5a00001
		Video Capture
		Metadata Capture
		Read/Write
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x25200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
Media Driver Info:
	Driver name      : unicam
	Model            : unicam
	Serial           : 
	Bus info         : platform:3f801000.csi
	Media version    : 5.10.92
	Hardware revision: 0x00000000 (0)
	Driver version   : 5.10.92
Interface Info:
	ID               : 0x03000005
	Type             : V4L Video
Entity Info:
	ID               : 0x00000003 (3)
	Name             : unicam-image
	Function         : V4L2 I/O
	Flags         : default
	Pad 0x01000004   : 0: Sink
	 Link 0x02000007: from remote pad 0x1000002 of entity 'ov5647 10-0036': Data, Enabled, Immutable
$ sudo -g video v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Type: Video Capture

	[0]: 'YUYV' (YUYV 4:2:2)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[1]: 'UYVY' (UYVY 4:2:2)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[2]: 'YVYU' (YVYU 4:2:2)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[3]: 'VYUY' (VYUY 4:2:2)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[4]: 'RGBP' (16-bit RGB 5-6-5)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[5]: 'RGBR' (16-bit RGB 5-6-5 BE)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[6]: 'RGBO' (16-bit A/XRGB 1-5-5-5)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[7]: 'RGBQ' (16-bit A/XRGB 1-5-5-5 BE)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[8]: 'RGB3' (24-bit RGB 8-8-8)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[9]: 'BGR3' (24-bit BGR 8-8-8)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[10]: 'RGB4' (32-bit A/XRGB 8-8-8-8)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[11]: 'BA81' (8-bit Bayer BGBG/GRGR)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[12]: 'GBRG' (8-bit Bayer GBGB/RGRG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[13]: 'GRBG' (8-bit Bayer GRGR/BGBG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[14]: 'RGGB' (8-bit Bayer RGRG/GBGB)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[15]: 'pBAA' (10-bit Bayer BGBG/GRGR Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[16]: 'BG10' (10-bit Bayer BGBG/GRGR)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[17]: 'pGAA' (10-bit Bayer GBGB/RGRG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[18]: 'GB10' (10-bit Bayer GBGB/RGRG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[19]: 'pgAA' (10-bit Bayer GRGR/BGBG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[20]: 'BA10' (10-bit Bayer GRGR/BGBG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[21]: 'pRAA' (10-bit Bayer RGRG/GBGB Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[22]: 'RG10' (10-bit Bayer RGRG/GBGB)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[23]: 'pBCC' (12-bit Bayer BGBG/GRGR Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[24]: 'BG12' (12-bit Bayer BGBG/GRGR)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[25]: 'pGCC' (12-bit Bayer GBGB/RGRG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[26]: 'GB12' (12-bit Bayer GBGB/RGRG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[27]: 'pgCC' (12-bit Bayer GRGR/BGBG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[28]: 'BA12' (12-bit Bayer GRGR/BGBG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[29]: 'pRCC' (12-bit Bayer RGRG/GBGB Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[30]: 'RG12' (12-bit Bayer RGRG/GBGB)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[31]: 'pBEE' (14-bit Bayer BGBG/GRGR Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[32]: 'BG14' (14-bit Bayer BGBG/GRGR)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[33]: 'pGEE' (14-bit Bayer GBGB/RGRG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[34]: 'GB14' (14-bit Bayer GBGB/RGRG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[35]: 'pgEE' (14-bit Bayer GRGR/BGBG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[36]: 'GR14' (14-bit Bayer GRGR/BGBG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[37]: 'pREE' (14-bit Bayer RGRG/GBGB Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[38]: 'RG14' (14-bit Bayer RGRG/GBGB)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[39]: 'GREY' (8-bit Greyscale)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[40]: 'Y10P' (10-bit Greyscale (MIPI Packed))
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[41]: 'Y10 ' (10-bit Greyscale)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[42]: 'Y12P' (12-bit Greyscale (MIPI Packed))
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[43]: 'Y12 ' (12-bit Greyscale)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[44]: 'Y14P' (14-bit Greyscale (MIPI Packed))
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[45]: 'Y14 ' (14-bit Greyscale)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
$ sudo -g video libcamera-vid --list-cameras 
[4:13:48.035845093] [4230]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3384-44d59841
[4:13:48.083237034] [4231] ERROR CameraSensor camera_sensor.cpp:535 'ov5647 10-0036': Camera sensor does not support test pattern modes.
[4:13:48.166319146] [4231]  INFO RPI raspberrypi.cpp:1313 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
Available cameras
-----------------
0 : ov5647 [2592x1944] (/base/soc/i2c0mux/i2c@1/ov5647@36)
    Modes: 'SGBRG10_CSI2P' : 640x480 1296x972 1920x1080 2592x1944 
           'SGBRG8' : 640x480 

I installed ustreamer from "deb http://raspbian.raspberrypi.org/raspbian/ bullseye":

$ ustreamer --version
3.16
$ apt-cache show ustreamer | grep Version:
Version: 3.16-1

I tried upgrading to ustreamer v4.11 (source build), but the error persists.
According to strace, the error occurs in ioctl(8, VIDIOC_STREAMON, [V4L2_BUF_TYPE_VIDEO_CAPTURE]):

$ ./ustreamer --version
4.11
$ sudo -g video strace -f -e ioctl ./ustreamer --resolution 1920x1080 --format=uyvy
ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0
-- INFO  [14867.371      main] -- Using internal blank placeholder
-- INFO  [14867.376      main] -- Listening HTTP on [127.0.0.1]:8080
strace: Process 4210 attached
strace: Process 4211 attached
-- INFO  [14867.378    stream] -- Using V4L2 device: /dev/video0
-- INFO  [14867.379    stream] -- Using desired FPS: 0
================================================================================
-- INFO  [14867.393      http] -- Starting HTTP eventloop ...
-- INFO  [14867.396    stream] -- Device fd=8 opened
[pid  4210] ioctl(8, VIDIOC_QUERYCAP, {driver="unicam", card="unicam", bus_info="platform:3f801000.csi", version=KERNEL_VERSION(5, 10, 92), capabilities=V4L2_CAP_VIDEO_CAPTURE|V4L2_CAP_EXT_PIX_FORMAT|V4L2_CAP_META_CAPTURE|V4L2_CAP_READWRITE|V4L2_CAP_STREAMING|V4L2_CAP_DEVICE_CAPS|0x20000000, device_caps=V4L2_CAP_VIDEO_CAPTURE|V4L2_CAP_EXT_PIX_FORMAT|V4L2_CAP_READWRITE|V4L2_CAP_STREAMING|0x20000000}) = 0
-- INFO  [14867.398    stream] -- Using input channel: 0
[pid  4210] ioctl(8, VIDIOC_S_INPUT, [0]) = 0
[pid  4210] ioctl(8, VIDIOC_S_FMT, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE, fmt.pix={width=1920, height=1080, pixelformat=v4l2_fourcc('U', 'Y', 'V', 'Y') /* V4L2_PIX_FMT_UYVY */, field=V4L2_FIELD_ANY, bytesperline=3840, sizeimage=0, colorspace=V4L2_COLORSPACE_DEFAULT}} => {fmt.pix={width=1920, height=1080, pixelformat=v4l2_fourcc('U', 'Y', 'V', 'Y') /* V4L2_PIX_FMT_UYVY */, field=V4L2_FIELD_NONE, bytesperline=3840, sizeimage=4147200, colorspace=V4L2_COLORSPACE_SMPTE170M}}) = 0
-- INFO  [14867.399    stream] -- Using resolution: 1920x1080
-- INFO  [14867.400    stream] -- Using pixelformat: UYVY
[pid  4210] ioctl(8, VIDIOC_G_PARM, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 ENOTTY (Inappropriate ioctl for device)
-- INFO  [14867.401    stream] -- Querying HW FPS changing is not supported
-- INFO  [14867.401    stream] -- Using IO method: MMAP
[pid  4210] ioctl(8, VIDIOC_REQBUFS, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE, memory=V4L2_MEMORY_MMAP, count=5 => 5}) = 0
-- INFO  [14867.425    stream] -- Requested 5 device buffers, got 5
[pid  4210] ioctl(8, VIDIOC_QUERYBUF_TIME32, 0x76a97824) = 0
[pid  4210] ioctl(8, VIDIOC_QUERYBUF_TIME32, 0x76a97824) = 0
[pid  4210] ioctl(8, VIDIOC_QUERYBUF_TIME32, 0x76a97824) = 0
[pid  4210] ioctl(8, VIDIOC_QUERYBUF_TIME32, 0x76a97824) = 0
[pid  4210] ioctl(8, VIDIOC_QUERYBUF_TIME32, 0x76a97824) = 0
[pid  4210] ioctl(8, VIDIOC_QBUF_TIME32, 0x76a98e38) = 0
[pid  4210] ioctl(8, VIDIOC_QBUF_TIME32, 0x76a98e38) = 0
[pid  4210] ioctl(8, VIDIOC_QBUF_TIME32, 0x76a98e38) = 0
[pid  4210] ioctl(8, VIDIOC_QBUF_TIME32, 0x76a98e38) = 0
[pid  4210] ioctl(8, VIDIOC_QBUF_TIME32, 0x76a98e38) = 0
[pid  4210] ioctl(8, VIDIOC_STREAMON, [V4L2_BUF_TYPE_VIDEO_CAPTURE]) = -1 EINVAL (Invalid argument)
-- ERROR [14867.433    stream] -- Unable to start capturing: Invalid argument
-- INFO  [14867.449    stream] -- Device fd=8 closed
-- INFO  [14867.450    stream] -- Sleeping 1 seconds before new stream init ...
^Cstrace: Process 4209 detached
strace: Process 4210 detached
strace: Process 4211 detached
-- INFO  [14867.921      main] -- ===== Stopping by SIGINT =====
-- INFO  [14867.921      http] -- HTTP eventloop stopped

libcamera-vid works fine.

Any ideas how to solve this issue?

Thank you!

Metadata

Metadata

Assignees

Labels

type:bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions