1

I am trying to find a way to set a video as my desktop background, and possibly in the future some kind of image stream from a web url. I was thinking that I would try and do this with Python just because it is easy to write. I followed this answer and found a way to set my desktop background to an image from NASA's image of the day API. This worked and so I wanted to test out if I could actually set it many times and get a video. So I also used this answer to get each frame of the sample video and save them. Then I used a while loop to continuously set my desktop background about 20 times per second:

import ctypes
import time


SPI_SETDESKWALLPAPER = 20

frames = 738
current_frame = 0

while 1:
    if current_frame > frames:
        current_frame = 0
    ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, "C:\\Users\\Bill\\Documents\\vscode\\NASA-Web-API\\frames\\frame%d.bmp" % current_frame, 0)
    time.sleep(0.05)
    current_frame += 1

Is there even a way to do this in Python or will I have to do it in C# or another language more suited to interface with Windows? I know that there is a better way to do this because the performance of this method seems to not be great, and applications like WallpaperEngine and VLC media player can display videos and other things as desktop backgrounds while not using as many resources. Any help is appreciated.

user140052
  • 176
  • 10

1 Answers1

0

Just a theory, If you take a 10 seconds video cut it into 10 frames, save it with frame numbering {1..10}. Then do something like SPI_SETDESKWALLPAPER == current_frame and set a refresh timer thingy to make it look like a video.

Doubt this is going to help or anything but hey at least i tried to help in anyway :D

Penguin
  • 71
  • 1
  • 12