# Dev/video0 doesn't work for cv2.VideoCapture(0)

**URL:** <https://forums.developer.nvidia.com/t/dev-video0-doesnt-work-for-cv2-videocapture-0/164143>\
**Category:** DeepStream SDK\
**Tags:** camera\
**Created:** [December 19, 2020, 7:33pm UTC](https://forums.developer.nvidia.com/t/dev-video0-doesnt-work-for-cv2-videocapture-0/164143 "2020-12-19T19:33:22Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [December 28, 2020, 6:01am UTC](https://forums.developer.nvidia.com/t/dev-video0-doesnt-work-for-cv2-videocapture-0/164143/3 "2020-12-28T06:01:39Z")

</div>

Hi,  
You need to run a gstream pipeline in _cv2.VideoCapture()_. Please refer to

> [@OpenCV Video Capture with GStreamer doesn't work on ROS-melodic](https://forums.developer.nvidia.com/t/opencv-video-capture-with-gstreamer-doesnt-work-on-ros-melodic/113147/3):
>
> Hi, Once you confirm the source is valid, you may also try this simple code: import sys import cv2 def read\_cam(): cap = cv2.VideoCapture("nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=(string)NV12, framerate=(fraction)30/1 ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! appsink") if cap.isOpened(): cv2.namedWindow("demo", cv2.WINDOW\_AUTOSIZE) while True: ret\_val, img = cap.read(); cv2.ims…

---

_[View the full topic](https://forums.developer.nvidia.com/t/dev-video0-doesnt-work-for-cv2-videocapture-0/164143)._
