Ask Your Question

Revision history [back]

Unable to open the output.mp4 file using vlc or Quick time player in MAC OS Mojave : Duration of file is 00:00 but

import cv2

videocapture = cv2.VideoCapture('SampleVideo.mp4')

fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('output.mp4', fourcc, 20.0, (640,480) )

while(videocapture.isOpened()): v1, video1 = videocapture.read()

if v1 == True:
    gray = cv2.cvtColor(video1, cv2.COLOR_BGR2GRAY)

    print(videocapture.get(cv2.CAP_PROP_FRAME_WIDTH))
    print(videocapture.get(cv2.CAP_PROP_FRAME_HEIGHT))

    cv2.imshow('frame', gray)

    if cv2.waitKey() == ord('q'):
        break
else:
    break

out.release() videocapture.release() cv2.destroyAllWindows()

Unable to open the output.mp4 file using vlc or Quick time player in MAC OS Mojave : Duration of file is 00:00 but00:00

import cv2Code:

 import cv2

videocapture = cv2.VideoCapture('SampleVideo.mp4')

cv2.VideoCapture('SampleVideo.mp4')

fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('output.mp4', fourcc, 20.0, (640,480) )

)

while(videocapture.isOpened()): v1, video1 = videocapture.read()

videocapture.read()
 if v1 == True:
     gray = cv2.cvtColor(video1, cv2.COLOR_BGR2GRAY)

     print(videocapture.get(cv2.CAP_PROP_FRAME_WIDTH))
     print(videocapture.get(cv2.CAP_PROP_FRAME_HEIGHT))

     cv2.imshow('frame', gray)

     if cv2.waitKey() == ord('q'):
         break
 else:
     break

out.release()
videocapture.release()
cv2.destroyAllWindows()

out.release() videocapture.release() cv2.destroyAllWindows()