Skip to content

Commit e1d060d

Browse files
committed
docs(readme): link the stats overlay example to irl-stats.lua instead of inlining it
The README carried a full copy of the script, which had already drifted from the file (the copy still polled every frame). Point at the file so there is one script to keep current.
1 parent f8d2641 commit e1d060d

1 file changed

Lines changed: 1 addition & 57 deletions

File tree

README.md

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -103,63 +103,7 @@ Earlier versions exposed Min/Max Buffer, PTS gap thresholds, Network Buffer and
103103

104104
The plugin exposes live stats that a Lua or Python script can read, so you can put a status overlay on your own stream or on a monitor.
105105

106-
Create a Text (GDI+) source called `IRL Stats`, then add this as a Lua script in OBS:
107-
108-
```lua
109-
obs = obslua
110-
111-
function script_description()
112-
return "Updates a text source with IRL Source stats"
113-
end
114-
115-
function script_update(settings)
116-
end
117-
118-
function script_tick(seconds)
119-
local source = obs.obs_get_source_by_name("IRL Source (irlserver.com)")
120-
if not source then return end
121-
122-
local ph = obs.obs_source_get_proc_handler(source)
123-
local cd = obs.calldata_create()
124-
obs.proc_handler_call(ph, "get_stats", cd)
125-
126-
local buf_ms = obs.calldata_int(cd, "buffer_fill_ms")
127-
local speed = obs.calldata_float(cd, "current_speed")
128-
local ctrl = obs.calldata_bool(cd, "adaptive_latency_control")
129-
local reconnecting = obs.calldata_bool(cd, "reconnecting")
130-
local video = obs.calldata_int(cd, "total_video_frames")
131-
local audio = obs.calldata_int(cd, "total_audio_frames")
132-
local repairs = obs.calldata_int(cd, "pts_repairs")
133-
local silence = obs.calldata_int(cd, "silence_insertions")
134-
local underruns = obs.calldata_int(cd, "audio_underruns")
135-
local resync_skips = obs.calldata_int(cd, "audio_resync_skipped_chunks")
136-
local hidden_trims = obs.calldata_int(cd, "audio_hidden_trimmed_chunks")
137-
local quality_events = obs.calldata_int(cd, "audio_quality_events")
138-
local audio_flushes = obs.calldata_int(cd, "audio_decoder_flushes")
139-
local video_flushes = obs.calldata_int(cd, "video_decoder_flushes")
140-
local delay = obs.calldata_int(cd, "stream_delay_ms")
141-
142-
obs.calldata_destroy(cd)
143-
obs.obs_source_release(source)
144-
145-
local status = reconnecting and "RECONNECTING" or "LIVE"
146-
local text = string.format(
147-
"Status: %s\nDelay: %dms\nBuffer: %dms\nControl: %s\nCorrection: %.3fx\nFrames: %d/%d (v/a)\nPTS Repairs: %d\nAudio Quality: %d events\nSilence/Underruns: %d/%d\nHidden Trims: %d\nResync Skips: %d\nDecoder Flushes: %d/%d (a/v)",
148-
status, delay, buf_ms, ctrl and "on" or "off", speed, video, audio,
149-
repairs, quality_events, silence, underruns, hidden_trims,
150-
resync_skips, audio_flushes, video_flushes
151-
)
152-
153-
local text_source = obs.obs_get_source_by_name("IRL Stats")
154-
if text_source then
155-
local settings = obs.obs_data_create()
156-
obs.obs_data_set_string(settings, "text", text)
157-
obs.obs_source_update(text_source, settings)
158-
obs.obs_data_release(settings)
159-
obs.obs_source_release(text_source)
160-
end
161-
end
162-
```
106+
Create a Text (GDI+) source called `IRL Stats`, then add [`irl-stats.lua`](irl-stats.lua) as a Lua script in OBS (Tools → Scripts). It polls the source's `get_stats` proc handler once a second and writes the formatted stats into the text source. Edit the two source names in `update_stats` if yours differ.
163107

164108
The full list of readable fields is in [Stats reference](#stats-reference).
165109

0 commit comments

Comments
 (0)