# VideoCapture not working on Raspberry Bullseye

**URL:** <https://forum.opencv.org/t/videocapture-not-working-on-raspberry-bullseye/7036>\
**Category:** Python\
**Tags:** raspberrypi\
**Created:** [January 8, 2022, 10:33am UTC](https://forum.opencv.org/t/videocapture-not-working-on-raspberry-bullseye/7036 "2022-01-08T10:33:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andys](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@andys](https://forum.opencv.org/u/andys)\
**Post date:** [January 8, 2022, 10:33am UTC](https://forum.opencv.org/t/videocapture-not-working-on-raspberry-bullseye/7036/1 "2022-01-08T10:33:48Z")

</div>

Hey there:-)  
I´m trying to capture Videos… with no sucess. “libcamera-hello” is working perfectly, but if i try to run this code, it doesn´t

```auto
import cv2
print("Package imported")
cap=cv2.VideoCapture(0)
while True:
    sucess, img=cap.read()
    cv2.imshow("Video",img)
    if cv2.waitKey(1) & 0xFF==ord('q'):
        break

```

[WARN:0@12.692] global /tmp/pip-wheel-mqp59bja/opencv-python\_d3c31dc7802240788618bfcd2774f816/opencv/modules/videoio/src/cap\_v4l.cpp (1000) tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.  
Traceback (most recent call last):  
File “/home/pi/MyProjects/test.py”, line 13, in   
cv2.imshow(“Video”,img)  
cv2.error: OpenCV(4.5.5) /tmp/pip-wheel-mqp59bja/opencv-python\_d3c31dc7802240788618bfcd2774f816/opencv/modules/core/src/array.cpp:2494: error: (-206:Bad flag (parameter or structure field)) Unrecognized or unsupported array type in function ‘cvGetMat’

raspberry 3. using python 3.9.2, opencv 4.5.5

Can u help me?

kr  
Andy

---

<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:** [January 8, 2022, 11:17am UTC](https://forum.opencv.org/t/videocapture-not-working-on-raspberry-bullseye/7036/2 "2022-01-08T11:17:15Z")

</div>

assert `cap.isOpened()` _once_ right after creating the VideoCapture

---

<div class="post-metadata">

**Author:** ![andys](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@andys](https://forum.opencv.org/u/andys)\
**Post date:** [January 8, 2022, 12:23pm UTC](https://forum.opencv.org/t/videocapture-not-working-on-raspberry-bullseye/7036/3 "2022-01-08T12:23:19Z")

</div>

> [@crackwitz](#):
>
> assert `cap.isOpened()`

thx for your fast reply!  
there is no improvement… still facing the same issue…  
cap.isOpened() gives me true in debugging

---

<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:** [January 8, 2022, 1:08pm UTC](https://forum.opencv.org/t/videocapture-not-working-on-raspberry-bullseye/7036/4 "2022-01-08T13:08:43Z")

</div>

> [@andys](#):
>
> `sucess`

```auto
if not sucess: break

```

and when that passes okay, you might wanna check `img.shape` and `img.dtype`

does capturing/playback with ffmpeg/ffplay/vlc/guvcview work okay?

do you have everything installed so the camera is an actual V4L device? it used to be that cameras attached to raspberry pi via MIPI CSI weren’t exposed through V4L

---

<div class="post-metadata">

**Author:** ![andys](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@andys](https://forum.opencv.org/u/andys)\
**Post date:** [January 8, 2022, 3:46pm UTC](https://forum.opencv.org/t/videocapture-not-working-on-raspberry-bullseye/7036/5 "2022-01-08T15:46:38Z")

</div>

if not sucess: break does not help, i get the same timeout issue.  
due to i´m not that good with linux… how do i check if may cam is working properly. Again: “libcamera-hello” works  
[this is my camera](https://www.zoodmall.az/en/product/15758037/for-raspberry-pi-camera-night-vision-camera-module-5mp-ov5647-webcam-adjustable-camera-video-1080p/)

---

<div class="post-metadata">

**Author:** ![Lukaspfitscher](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@Lukaspfitscher](https://forum.opencv.org/u/Lukaspfitscher)\
**Post date:** [August 26, 2022, 1:06pm UTC](https://forum.opencv.org/t/videocapture-not-working-on-raspberry-bullseye/7036/6 "2022-08-26T13:06:20Z")

</div>

How about my video guide, for me it was fairly simple:

[![](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/4/4f40b2724340794290552a26b8bdfe707f5de0b0.jpeg "OpenCV installation on Raspberry Pi Bullseye") ](https://www.youtube.com/watch?v=KdsEo-_lnnY)

hope it helps
