How to create OBS Studio plugins

Lain

Forum Admin
Lain
Forum Moderator
Developer
Not yet. Basically it all comes down to what you want to make.

Here's a very brief rundown of how to make a plugin:

1.) Everything for making plugins is in libobs/obs-module.h. obs-module.h include all the other necessary plugin-related headers. You include obs-module.h in your plugin where ever you need, and then use the provided macros within to define it. A brief example is in the top comment of obs-module.h. You use OBS_DECLARE_MODULE() to declare the module and all necessary functions, and obs_module_load function to define the initialization function and use it to register obs objects, such as sources/outputs/etc. obs_register_source for example. You only use those once of course. All necessary OBS functions are in obs-module.h and obs.h.

2.) If for example you want to make a video/audio input source, take a look at libobs/obs-source.h to see the structure used for registering a source, the 'obs_source_info' structure.
For outputs, libobs/obs-output.h. For encoders, libobs/obs-encoder.h.

3.) Create functions to define that structure, then register that structure with obs_register_*.

Outside of docs, distribution is the only other issue at the moment. There's a plugin manager planned though it's been continually floating at "some time in the next two or three patches" for a while now, which means it's sort of medium-high priority but not highest priority yet. The only way to get a third-party plugin working is by manually copying it in to the plugins/data dirs, similar to obs1, which sucks. So instead I'm more aggressively merging new good plugins so we can work around the issue until the plugin manager actually is put in.

As for examples of how to create plugins, every core source/output/etc is already done via plugins, so there are examples of how to make functioning plugins in the plugins subdir. They are all exactly how you would make plugins.

Now, if you're making a UI-based plugin or a plugin that controls UI, adds UI, or receives user interface callbacks (for things like automatic scene switchers, OBS Remote, etc), that's coming soon, needs a special API for controlling/monitoring the UI. 0.16.0 is when that's planned, next patch as of this writing.
 

Vouk

New Member
I recently wrote a custom encoder, but i noticed everything around the muxers / recording formats seems to be hardcoded. Will there be a plugin interface too? I'd like to add some non-h264 lossless recording functionality.
 

ek926m

New Member
I have to develop an obs studio plugin now. I still can't find docs or advanced tutorials. Anything changed?
 

Marcedo

Member
maybe you just could to use the python/lua script interface - looking at the scripts section may be a good start.
 
Top