gpt4 book ai didi

python - 我怎样才能让视频在录制时暂停/继续?

转载 作者:太空宇宙 更新时间:2023-11-03 21:25:44 29 4
gpt4 key购买 nike

<分区>

如何在 OpenCV Python 中录制视频时暂停/继续?

import numpy as np
import cv2
cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480))

while (cap):
# Capture frame-by-frame
ret, frame = cap.read()

out.write(frame)
# Display the resulting frame
cv2.imshow('video recording', frame)

if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
out.release()
cv2.destroyAllWindows()

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com