python을 사용하여 openCv에서 videocapture 객체를 사용하여 비디오를 저장하려고합니다. 그러나 'q'를 누르면 동영상은 'output.avi'로 저장되지만 크기는 0KB로 표시됩니다. 도움이 필요하고 오류를 찾을 수 없습니다. 여기동영상이 저장 중이지만 0KB 만 표시합니다. OpenCv의 이러한 코드에서 발생할 수있는 오류는 무엇입니까
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
#1.2. Gui Features in OpenCV 25
#OpenCV-Python Tutorials Documentation, Release 1
# Define the codec and create VideoWriter object
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)
# write the flipped frame
out.write(frame)
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
# Release everything if job is finished
cap.release()
out.release()
cv2.destroyAllWindows()
그 type.you 어떤 codics를 확인해야 Codics에 문제가 주어진 미디어 타입이 제대로 작동 –