Skip to content

Instantly share code, notes, and snippets.

@Windows81
Created December 30, 2025 07:31
Show Gist options
  • Select an option

  • Save Windows81/76c13c3ec634d4c28ea27323c7da8eab to your computer and use it in GitHub Desktop.

Select an option

Save Windows81/76c13c3ec634d4c28ea27323c7da8eab to your computer and use it in GitHub Desktop.
Lua script for Advanced Scene Switcher (on OBS) to make the video scale fully to "Display Capture"
obs = obslua
function run()
local source = obs.obs_frontend_get_current_scene()
local scene = obs.obs_scene_from_source(source)
local sceneitem = obs.obs_scene_find_source(scene,"Display Capture")
obs.obs_source_release(source)
local source = obs.obs_sceneitem_get_source(sceneitem)
local width = obs.obs_source_get_width(source)
local height = obs.obs_source_get_height(source)
local video_info = obs.obs_video_info()
obs.obs_get_video_info(video_info)
video_info.base_width = width
video_info.base_height = height
obs.obs_reset_video(video_info)
local transform_info = obs.obs_transform_info()
obs.vec2_set(transform_info.scale, 1, 1)
obs.vec2_set(transform_info.pos, 0, 0)
transform_info.alignment = 5 -- OBS_ALIGN_LEFT | OBS_ALIGN_TOP
obs.obs_sceneitem_set_info2(sceneitem, transform_info)
-- obs.script_log(obs.LOG_WARNING, tostring(obs.OBS_ALIGN_LEFT))
return true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment