I have a webcam which supports YUYV (raw) and MJPEG (compressed) formats. When I capture video stream - cap = cv2.VideoCapture(0)
, openCV takes YUYV as default.
I want to use MJPEG (MJPG). I found here that it is possible. I try to set it by command: cap.set(7, ('M', 'J', 'P', 'G'))
, but it doesn't work. How can I choose which video format I want to get in OpenCV?
请尝试以下行。
cap.set(8, ('M', 'J', 'P', 'G'))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.