Python cv2.VideoCapture from subprocess.PIPE?
Hi, I am trying to capture video from a subprocess (which outputs stream to stdout).
Eg:
.
..
videopipe = subprocess.Popen(externalcmd, stdout=subprocess.PIPE)
capture = cv2.VideoCapture(videopipe.stdout)
...
Obviously snippet from above does not work.... Where the external command will be generating raw video stream...
How does captures video from a pipe with python cv2?
Thanks a lot!
Sergei.
VideoCapture wants either a string(a filename or url) or a number (cam-id) as input.
what did you try to achieve with your pipe ?
I want to capture from an external process, so the external process handles the source (codec/format) and converts it into rawvideo format. The idea is that for example avconv can handle reliably all video cams, as I have problems with cv2.VideoCapture an rtsp stream reliably (there are a lot of h264 errors). I am attempting in using named pipe as input for VideoCapture (at this stage without success). Ideally it would be nice to do this: someprocess | videocapture.py, where someprocess provides a rawvideo stream and videocapture.py does OpenCV stuff regardless what is the source of video (motion detection, face detection etc.).
Oh, it is for linux.