osx - OpenCV (3.1.0) video saving in Python (3.5.1) on Mac -


i following opencv documentation on video saving using following code.

import numpy np import cv2  cap = cv2.videocapture(0) height = int(cap.get(4)) width = int(cap.get(3)) fourcc = cv2.videowriter_fourcc(*'xvid') out = cv2.videowriter('output.avi', fourcc, 20.0, (width, height))  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() 

when run it, works fine video file saved can't opened vlc/quick time etc.

from opencv video saving in python i've noticed can change fourcc -1 allowing pick codec if on windows machine. can't on mac (osx 10.11.12).

i have tried bunch of other fourcc options, none seem work on mac.

any suggestions?


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -