Need help on starting Python scripting


New Member
I I took at look at this and I wanted to know how to get started with Python scripting. Here's what I know, some questions, and what I wanna do.

What I know:
  • There is an API for python scripting
  • Where is the API library? Does it come with OBS or do I need to download it?
  • Where is the documentation for this API?
  • How do I get started with Scripting?
    • Do I just import and go to work, or is there another file I need, or initialization steps that wouldn't be obvious from documentation?
What I wanna do:
  • Hide and un-hide specific images already on the overlay by reading from a text file
  • [If possible] Add an existing python GUI to the OBS GUI (Not Window Capture)
  • Read how long OBS has been recording (Which is shown in the OBS window, so I know it's somewhere)

Thanks in advance for any help.


Forum Admin
The Library comes with OBS. They are Python bindings for the OBS API. The documentation is here:

You'll find that in those docs there are a lot of C and C++ functions. Since the Python library provides bindings to these functions, there are virtually identical versions of these function calls in the Python library.

I recommend reading the Python script that ships with OBS to see an example of how Python scripting works:

For example, toward the top of that script, there is a call to obs.obs_get_source_by_name. That is a call to the Python binding to this function.

The main caveat to keep in mind is that since these are C/C++ bindings, you still have to do memory management manually, so you will need to free memory that you have allocated. Notice in the documentation that obs_get_source_by_name increments the reference counter, so before you end your script you will need to be sure to call obs_source_release() on the return value of obs_get_source_by_name.
Last edited:


New Member
Thanks a lot! I'll get started with this, hopefully it won't be too difficult to work with, but it looks to be pretty straightforward, at least for my purposes.


New Member
Hi, I have a question about that.

Where can I find the keywords for the functions?

For Example:
In the ccript is the function "obs.obs_data_set_string(settings, "text", text)".

I found it in the doc:
void obs_data_set_string(obs_data_t *data, const char *name, const char *val)

And where are the possible keywords for the parameter const char *name ("text") ?

In an other script i found the function:
obs.obs_data_set_int(s, "speed_percent", 200)
Where can I find the keyword "speed_percent" ?


New Member
I am unable to import obspython library which is at the top of I tried installing that library but it says there is nothing like obspython.
I have few questions regarding python scripting:
1. What does file do, does it help to stream from URL to destination like Youtube, Twitch, Facebook, etc, if yes how?
2. how to setup source for streaming?
3. How to install "obspython" library?
Thank You


Forum Admin
obspython is a library that only exists inside OBS. It's available if you run a script inside OBS. It's not something you install from PyPI.


New Member
I added the script( to OBS via Tools -> Scripts -> +
but what to do after that?
And what does script do?