ioctl(VIDIOC_QUERYCAP): Inappropriate ioctl for device on Raspberry PI Zero W Raspbian Trixie with IMX219

Open
#333 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
cpp, raspberry-pi
Domain
embedded-iot

Research direction

Start by reproducing the failure with libcamerify ffmpeg and ustreamer, then compare their behavior with the working rpicam-hello and MediaMTX commands on the Raspberry Pi Zero W. Done means identifying the cause of the VIDIOC_QUERYCAP error and making the affected libcamerify path work with the IMX219 camera, with the reported commands succeeding.

Written by the indexing model from the issue text.

Description

pi@pizerow:~ $ libcamerify ffmpeg -f v4l2 -framerate 24 -i /dev/video0 output.mp4
ffmpeg version 7.1.3-0+deb13u1+rpt1 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 14 (Raspbian 14.2.0-19+rpi1)
  configuration: --prefix=/usr --extra-version=0+deb13u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --disable-libmfx --disable-mmal --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --disable-libvpl --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-vout-drm --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sand --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.101 / 61. 19.101
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
[0:03:44.122832904] [775]  INFO Camera camera_manager.cpp:340 libcamera v0.7.0+rpt20260205
[0:03:47.481243283] [780]  INFO IPAProxy ipa_proxy.cpp:180 Using tuning file /usr/share/libcamera/ipa/rpi/vc4/imx219.json
[0:03:47.561517832] [780]  INFO Camera camera_manager.cpp:223 Adding camera '/base/soc/i2c0mux/i2c@1/imx219@10' for pipeline handler rpi/vc4
[0:03:47.563535820] [780]  INFO RPI vc4.cpp:445 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media0 and ISP device /dev/media1
[video4linux2,v4l2 @ 0x234b7a0] ioctl(VIDIOC_QUERYCAP): Inappropriate ioctl for device
[in#0 @ 0x234b640] Error opening input: Inappropriate ioctl for device
Error opening input file /dev/video0.
Error opening input files: Inappropriate ioctl for device

libcamerify ustreamer --device /dev/video0 --host :: --port 8889 --encoder=m2m-image -r 1640x1232 --debug also doesn't work, it throws the same Inappropriate ioctl for device.

However, rpicam-hello works:

pi@pizerow:~ $ rpicam-hello
[0:13:31.734110649] [787]  INFO Camera camera_manager.cpp:340 libcamera v0.7.0+rpt20260205
[0:13:32.671382328] [790]  INFO IPAProxy ipa_proxy.cpp:180 Using tuning file /usr/share/libcamera/ipa/rpi/vc4/imx219.json
[0:13:32.784960168] [790]  INFO Camera camera_manager.cpp:223 Adding camera '/base/soc/i2c0mux/i2c@1/imx219@10' for pipeline handler rpi/vc4
[0:13:32.788708163] [790]  INFO RPI vc4.cpp:445 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media0 and ISP device /dev/media1
[0:13:32.790456160] [790]  INFO RPI pipeline_base.cpp:1117 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
Made DRM preview window
Preview window unavailable
Mode selection for 1640:1232:12:P
    SRGGB10_CSI2P,640x480/0 - Score: 4504.81
    SRGGB10_CSI2P,1640x1232/0 - Score: 1000
    SRGGB10_CSI2P,1920x1080/0 - Score: 1541.48
    SRGGB10_CSI2P,3280x2464/0 - Score: 1718
    SRGGB8,640x480/0 - Score: 5504.81
    SRGGB8,1640x1232/0 - Score: 2000
    SRGGB8,1920x1080/0 - Score: 2541.48
    SRGGB8,3280x2464/0 - Score: 2718
[0:13:32.834654098] [787]  INFO Camera camera.cpp:1215 configuring streams: (0) 1640x1232-YUV420/sYCC (1) 1640x1232-SBGGR10_CSI2P/RAW
[0:13:32.838167093] [790]  INFO RPI vc4.cpp:620 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1640x1232-SBGGR10_1X10/RAW - Selected unicam format: 1640x1232-pBAA/RAW
#7 (0.00 fps) exp 6956.00 ag 1.00 dg 1.00
#8 (30.01 fps) exp 6975.00 ag 1.00 dg 1.00
#9 (30.00 fps) exp 6975.00 ag 1.00 dg 1.00
#10 (30.01 fps) exp 6975.00 ag 1.00 dg 1.00
#11 (15.00 fps) exp 6956.00 ag 1.00 dg 1.00
#12 (30.01 fps) exp 6956.00 ag 1.00 dg 1.00
#13 (30.01 fps) exp 6956.00 ag 1.00 dg 1.00
#14 (30.00 fps) exp 6956.00 ag 1.00 dg 1.00
#15 (30.00 fps) exp 6956.00 ag 1.00 dg 1.00
#16 (30.01 fps) exp 6956.00 ag 1.00 dg 1.00
#17 (30.00 fps) exp 6956.00 ag 1.00 dg 1.00
#18 (30.01 fps) exp 6956.00 ag 1.00 dg 1.00
#19 (30.01 fps) exp 6956.00 ag 1.00 dg 1.00
#20 (30.00 fps) exp 6956.00 ag 1.00 dg 1.00
<snip>

MediaMTX also works, which does not use libcamerify.
I am running a Raspberry Pi Zero W with Raspbian Trixie, and I have a Raspberry Pi Camera v2 connected.

pi@pizerow:~ uname -a
Linux rpizerow 6.12.75+rpt-rpi-v6 #1 Raspbian 1:6.12.75-1+rpt1 (2026-03-11) armv6l GNU/Linux
Dominant language
C++
Stars
480
Forks
188
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/libcamera

All issues in raspberrypi/libcamera

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.