Python script, image loading performance

Xunkar

New Member
I am writing a script that dynamically changes the file loaded in an image source. Whenever the image is modified, it creates a visible lag on stream. Is there any better way to achieve this? I'm not convinced this is threaded. For reference, here's what I'm doing:

Python:
settings = obs.obs_data_create()
obs.obs_data_set_string(settings, "file", image_path)
obs.obs_source_update(image_source, settings)
obs.obs_data_release(settings)
obs.obs_source_release(image_source)
 

izabellaeffertz

New Member
The lag occurs because obs_source_update runs on OBS's main thread, blocking rendering during file access.
To reduce lag, preload the image in a separate thread, then update the source once it's ready.
OBS isn't threaded for source updates by default, so managing timing manually helps avoid frame drops.
 
Top