编码方式较多,avi 的编码方式就有很多,现有的视频可以用格式工厂转化,
建议安装xvid编码器。
https://www.xvidmovies.com/codec/
在
capture = cv.VideoCapture('z:/222.avi')
height = capture.get(cv.CAP_PROP_FRAME_HEIGHT)
width = capture.get(cv.CAP_PROP_FRAME_WIDTH)
sourcecc=cv.VideoWriter_fourcc('X', 'V', 'I', 'D')
out = cv.VideoWriter('z:/mtcnn_demo.avi',sourcecc , 15, (np.int(width), np.int(height)), True)
while True:
ret, frame = capture.read()
print()
if ret is True:
frame = cv.flip(frame, 1)
cv.imshow("frame", frame)
rgb = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
result = detection(rgb)
out.write(result)
c = cv.waitKey(10)
if c == 27:
break
else:
break
capture.release()