Unable to open the output.mp4 file using vlc or Quick time player in MAC OS Mojave : Duration of file is 00:00
Code:
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()
please read doc and try samples. tutorial : how to read and write a video
@sukanyar.
out.write
is missing. You cannot put insideif/else
condition blockprint, imshow
andwaitkkey
Use @LBerger link.I tried using the program to save the video from the documentation - https://docs.opencv.org/master/dd/d43... and i still get the same issue , duration shows 00:00. Tried saving different formats still thes ame issue.
I referred to this youtube video to learn. The only difference that i see is that i am using mac os. I tried using quicktime player and vlc both and also tried different files mp4, avi. All provides me with the same result.
You can't convert from
*XVID
tomp4