# Pixel format of incoming image is unsupported by OpenCV

**URL:** <https://forum.opencv.org/t/pixel-format-of-incoming-image-is-unsupported-by-opencv/3227>\
**Category:** Uncategorized\
**Created:** [May 8, 2021, 3:27pm UTC](https://forum.opencv.org/t/pixel-format-of-incoming-image-is-unsupported-by-opencv/3227 "2021-05-08T15:27:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaatrash](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/aaatrash/32/2055_2.png) [@aaatrash](https://forum.opencv.org/u/aaatrash)\
**Post date:** [May 8, 2021, 3:27pm UTC](https://forum.opencv.org/t/pixel-format-of-incoming-image-is-unsupported-by-opencv/3227/1 "2021-05-08T15:27:25Z")

</div>

I am trying to get a video stream from a camera on my RPI 4. When I try to run this simple video capture script as a test to stream from /dev/video0, I get the following error:

```
import cv2
print("starting")
cap = cv2.VideoCapture(0)
if cap.isOpened():
    print("streaming!")

```

Error:

```
VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

```

When running v4l2-ctl --device /dev/video0 --list-formats-ext, I get this output:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/1/1e1c99162aea3e29b6172b0f8180c13535279b76.png)

Although I am not sure how this can be used.  
I don’t know where to begin fixing this problem. Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [May 9, 2021, 12:02am UTC](https://forum.opencv.org/t/pixel-format-of-incoming-image-is-unsupported-by-opencv/3227/2 "2021-05-09T00:02:15Z")

</div>

> [@aaatrash](#):
>
> `Pixel format of incoming image is unsupported by OpenCV`

congrats, you found a place where OpenCV is “incomplete”.

> <https://github.com/opencv/opencv/blob/68d15fc62edad980f1ffa15ee478438335f39cc3/modules/videoio/src/cap_v4l.cpp#L722-L726>

> <https://github.com/opencv/opencv/blob/68d15fc62edad980f1ffa15ee478438335f39cc3/modules/videoio/src/cap_v4l.cpp#L540-L590>

---

<div class="post-metadata">

**Author:** ![aaatrash](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/aaatrash/32/2055_2.png) [@aaatrash](https://forum.opencv.org/u/aaatrash)\
**Post date:** [May 9, 2021, 12:31am UTC](https://forum.opencv.org/t/pixel-format-of-incoming-image-is-unsupported-by-opencv/3227/3 "2021-05-09T00:31:12Z")

</div>

Is there any way to force my camera to use a supported pixel format?

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [May 9, 2021, 9:52am UTC](https://forum.opencv.org/t/pixel-format-of-incoming-image-is-unsupported-by-opencv/3227/4 "2021-05-09T09:52:49Z")

</div>

there is, probably.

I’ve heard of `v4l-ctl` or `v4l2-ctl`, a command line utility. see if you can set the device’s pixel format using that.

try getting `CAP_PROP_FORMAT` and see if that’s an interesting value.

you could try setting `CAP_PROP_FOURCC` of the cv::VideoCapture instance. sometimes that can be a pixel format instead of a codec.

related:

- [How to do I change the USB camera resolution? - eLinux.org](https://elinux.org/Thread:Talk:Jetson/Cameras/How_to_do_I_change_the_USB_camera_resolution%3F/reply)
- [V4L2: Add V4L2\_PIX\_FMT\_Y12 (12 bit grey) support by firebladed · Pull Request #16626 · opencv/opencv · GitHub](https://github.com/opencv/opencv/pull/16626)
- [https://answers.opencv.org/question/226432/videoio-error-v4l2-pixel-format-of-incoming-image-is-unsupported-by-opencv/](https://answers.opencv.org/question/226432/videoio-error-v4l2-pixel-format-of-incoming-image-is-unsupported-by-opencv/)
