import time
import cv2 as cv
out_win=‘vediotest_roger’
cv.namedWindow(out_win, cv.WINDOW_NORMAL)
cv.setWindowProperty(out_win, cv.WND_PROP_FULLSCREEN, cv.WINDOW_FULLSCREEN)
#cv.namedWindow(“vediotest_roger”, 0) # 0可调大小,注意:窗口名必须imshow里面的一窗口名一直
#cv.resizeWindow(“vediotest_roger”, 800, 600) # 设置长和宽
while 1:
cap = cv.VideoCapture(‘C:\Program Files\nodejs\vedio\panda.mp4’)
fps=cap.get(cv.CAP_PROP_FPS)
while cap.isOpened():
ret, frame = cap.read()
if(ret0): #如果ret=0不返回继续播放会异常
break
cv.imshow(‘vediotest_roger’, frame)
key=cv.waitKey(int(fps))& 0xFF #等待时间
if(key == ord(“q”)):
break
if(keyord(" ")):
cv2.waitKey(0)
if(key == ord(“q”)):#按q退出全屏播放
break
time.sleep(1)
cap.release()
cv.destroyAllWindows()