我的脚本打算显示YouTube直播
from vidgear.gears import CamGear
import cv2
url = 'https://youtu.be/o0Ryp4iWgOg'
stream = CamGear(source=url, y_tube =True, time_delay=1, logging=True).start()
# YouTube Video URL as input
print(stream.framerate)
while True:
frame = stream.read()
if frame is None:
break
b = cv2.resize(frame, (800, 600), fx=0, fy=0, interpolation=cv2.INTER_CUBIC)
cv2.imshow("LiveVid", b)
key = cv2.waitKey(1) & 0xFF
if key == ord("q"):
break
cv2.destroyAllWindows()
stream.stop
几秒钟后,流停止。我认为高帧频会导致此问题。所以我想更改帧速率。我怎么做?
最佳答案
如果您想运行此代码,则必须将网址转换为其他YouTube直播流网址
关于python - 如何使用Camgear更改python中的帧率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58609181/