1 2 3 4 5 6 |
import numpy as np import cv2 cap = cv2.VideoCapture('video.avi') result = cap.isOpened() print result |
1 |
mencoder.exe in.avi -nosound -ovc raw -vf format=i420 -o out.avi |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import numpy as np import cv2 cap = cv2.VideoCapture('out.avi') result = cap.isOpened() # print result while(cap.isOpened()): flag, frame = cap.read() # auto loop if flag==0: cap.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, 1) continue # frame image manipulation #gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # full screen, have a remain unsolve white border #cv2.namedWindow("frame", cv2.WND_PROP_FULLSCREEN) #cv2.setWindowProperty("frame", cv2.WND_PROP_FULLSCREEN, cv2.cv.CV_WINDOW_FULLSCREEN) cv2.imshow('frame', frame) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows() |