2014-07-29 04:32:15 -0600 | received badge | ● Necromancer (source) |
2014-07-29 03:08:13 -0600 | answered a question | Python cv2.VideoCapture from subprocess.PIPE? I found a way to pipe a stream to VideoCapture for windows, because openCV is based on FFmpeg, that supports named pipe. Here is a quick example: #!/usr/bin/env python import cv2 import win32pipe, win32file from threading import Thread def runPipe(): p = win32pipe.CreateNamedPipe(r'\\.\pipe\myNamedPipe', win32pipe.PIPE_ACCESS_DUPLEX, win32pipe.PIPE_TYPE_MESSAGE | win32pipe.PIPE_WAIT, 1, 1024, 1024, 0, None) win32pipe.ConnectNamedPipe(p, None) with open("D:\\Streams\\mystream.ts", 'rb') as input: while True: data = input.read(1024) if not data: break win32file.WriteFile(p, data) def extract(): cap = cv2.VideoCapture(r'\\.\pipe\myNamedPipe') fnum = 0 while(True): # Capture frame-by-frame ret, frame = cap.read() print fnum, "pts:", cap.get(cv2.cv.CV_CAP_PROP_POS_MSEC) fnum = fnum + 1 # When everything done, release the capture cap.release() if __name__ == "__main__": thr = Thread(target=extract) thr.start() runPipe() print "bye" |
2014-07-24 07:16:11 -0600 | commented answer | Python cv2.VideoCapture from subprocess.PIPE? The goal is to pipe a compressed video stream (like MP4 or Mpeg2TS) to cv2.VideoCapture. You propose another way to do it? |
2014-07-24 04:49:24 -0600 | received badge | ● Editor (source) |
2014-07-24 04:48:28 -0600 | answered a question | Python cv2.VideoCapture from subprocess.PIPE? Hi, I would like to do exactly the same under windows. Do you know if it is possible to pipe a video stream to cv2.VideoCapture? Thanks, Nicolas. |
2014-07-22 09:38:05 -0600 | asked a question | cv2.VideoCapture get stride Hi, I would like to know how I can retrieve the stride (or line size) value from a python VideoCapture? I am only able to get width and height from the capabilities like this: Stride is always equal to width with VideoCapture? |