help with obs python script (play video source at certain timestamp)

dasneyland

New Member
have a python script for OBS that makes a scene and loads a video and tries to play it. The script looks something like this:

import obspython as obs import math, time, os, random hotkey_id = obs.OBS_INVALID_HOTKEY_ID is_active = 0 def script_description(): return """Random Script""" def scene_exists(scene_name): scene_names = obs.obs_frontend_get_scene_names() for name in scene_names: if name.lower() == scene_name.lower(): return True return False def create_scene(): print("making scene") scene_name = "Scene" pos=0 while scene_exists(scene_name): pos+=1 scene_name = "Scene-"+str(pos).zfill(3) new_scene = obs.obs_scene_create(scene_name) obs.obs_frontend_set_current_scene(obs.obs_scene_get_source(new_scene)) current_scene = obs.obs_frontend_get_current_scene() scene = obs.obs_scene_from_source(current_scene) obs.obs_scene_release(new_scene) obs.obs_scene_release(scene) def load_pictures(): current_scene = obs.obs_frontend_get_current_scene() scene = obs.obs_scene_from_source(current_scene) path = r"C:\Videos.mkv" settings = obs.obs_data_create() obs.obs_data_set_string(settings,"local_file",path) source = obs.obs_source_create_private("ffmpeg_source",os.path.split(path)[1],settings) item = obs.obs_scene_add(scene,source) obs.obs_data_release(settings) obs.obs_source_release(source) print("done") create_scene() load_pictures()

The problem I have is that it starts playing at 0:00; is there a way for it to start at a certain point / timestamp?
Also, is there a way to get how long the video is so that if i script it, it doesnt go over?
Thanks
 
Top