-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
cv2.VideoCapture(device) blocks indefinitely if device is in use #15782
Copy link
Copy link
Closed
Milestone
Description
System information (version)
- OpenCV => 4.1.2
- Operating System / Platform => Arch Linux
- Compiler => GCC 9.2.0
Detailed description
When creating a cv2.VideoCapture object, if the device is in use then the call will block until the device is released. This doesn't seem to the intended behavior, due to the existent of the isOpened method and multiple answers to questions which seem to indicate this was not always the behavior: 1 2 3 4 5
Steps to reproduce
Python 3.7.4 (default, Oct 4 2019, 06:57:26)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> print(cv2.__version__)
4.1.2
>>> x = cv2.VideoCapture(0)
[ WARN:0] global /build/opencv/src/opencv-4.1.2/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
>>> y = cv2.VideoCapture(0)
[ WARN:0] global /build/opencv/src/opencv-4.1.2/modules/videoio/src/cap_gstreamer.cpp (1756) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src1 reported: Device '/dev/video0' is busy
[ WARN:0] global /build/opencv/src/opencv-4.1.2/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /build/opencv/src/opencv-4.1.2/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
(blocks until original camera released)
Reactions are currently unavailable