我看到了一些将视频设置为墙纸的应用,但它们并非免费。我没有很多钱,所以我决定用python创建自己的!
我认为这很容易创建!不幸的是,这个脚本让我完全疯狂地使用了处理器!
实际上,背景的改变,因为我确实向explorer.exe询问了很多资源
所以,我希望您能提供帮助,并希望您能从处理器上获得30 fps的帮助。
这是我的脚本,很短:
from time import sleep
import ctypes, os
imagePath = [os.path.normpath("C:/Users/Administrateur/Pictures/bg/output ({}).jpg".format(i)) for i in range(250)]
while True :
for i in range(250):
ctypes.windll.user32.SystemParametersInfoW(20, 0, imagePath[i], 0)
sleep(0.04) # only 25 fps !
谢谢!
通过定期设置图像,您将无法获得这种性能。脚本中的瓶颈不是Python代码,而是墙纸更改时Windows必须执行的加载。
要获得所需的内容,您需要播放实际的视频;视频在整个空间中被压缩,编解码器通常具有硬件支持,因此在处理器上更容易获得下一帧。我没有尝试,但显然VLC should be able to do it。