openCV video saving in python -


i trying save video it's not working. followed instructions opencv documentation.

import numpy np import cv2  cap = cv2.videocapture(0)  fourcc = cv2.videowriter_fourcc(*'xvid') out = cv2.videowriter('output.avi', fourcc, 20.0, (640,480))  while(cap.isopened()):     ret, frame = cap.read()     if ret==true:         frame = cv2.flip(frame,0)           out.write(frame)          cv2.imshow('frame',frame)         if cv2.waitkey(1) & 0xff == ord('q'):             break     else:         break cap.release()  out.release()  cv2.destroyallwindows() 

what wrong?

try . it's working me.

import numpy np import cv2  cap = cv2.videocapture(0)  # define codec , create videowriter object #fourcc = cv2.cv.cv_fourcc(*'divx') #out = cv2.videowriter('output.avi',fourcc, 20.0, (640,480)) out = cv2.videowriter('output.avi', -1, 20.0, (640,480))  while(cap.isopened()):     ret, frame = cap.read()     if ret==true:         frame = cv2.flip(frame,0)          # write flipped frame         out.write(frame)          cv2.imshow('frame',frame)         if cv2.waitkey(1) & 0xff == ord('q'):             break     else:         break  # release if job finished cap.release() out.release() cv2.destroyallwindows() 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -