Question / Help Creating OBS plugin questions

kampiuceris

New Member
Hello,

I want to create a plugin which would display screen with image modifications. Mostly paints things on top depending on the given screen image. I'm a decent C# programmer, but have zero knowledge on video stuff and how all these plugins works. Currently I've written a "wrapper" for OBS: a simple program which loops the screen image capture and displays it with image modifications and then I can add it as "Window Capture" to OBS. Ofc this is very inefficient way since screen capture uses GDI and is very slow. I've even tried the DirectX with SlimDX ( http://www.codeproject.com/Articles/274461/Very-fast-screen-capture-using-DirectX-in-Csharp ) but still low frame rate. Resume: my pc does double work using slow methods. I'm sure it's shouldn't be hard to create such plugin. Could somebody provide for me with a plain framework in which I could simply implement my image modifications or at least point me where I should be headed since googling didn't help me in this case.

Thank You.
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
I'd have to know what type of image modifications you're doing in order to give you the best advice of what to do. Making a plugin isn't too difficult, though it's not trivial to modify an existing source. Modifying other sources is much easier in the new version (multiplatform version), but it won't be available on windows for quite some time still.
 
Last edited:

kampiuceris

New Member
The image must be as it is (I mean not after codec does it's work and reduces quality). Checking the colors of selected pixels and screen areas and then drawing transparent images on top.

C# quick pseudo code:

...

Bitmap bitmapToDrawOnTop = new ... // get image which will be painted on top
Rectangle Bounds = Screen.GetBounds(); // get screen bounds for e.g. (0,0, 1920, 1080)
Bitmap bitmap = new Bitmap(Bounds.Width, Bounds.Height); // build image which will me displayed in program
Graphics graphics = Graphics.FromImage(bitmap); // get images graphics

...

//in a loop:

// get print screen
graphics.CopyFromScreen(new Point(Bounds.X, Bounds.Y), new Point(0, 0), new Size(bitmap.Width, bitmap.Height));
// check pixel colors or average colors of certain areas
if (RequiresModification(bitmap))
{
// paint image on top
graphics.DrawImage(bitmapToDrawOnTop, position.X - Bounds.X - 35, position.Y - Bounds.Y - 35, bitmapToDrawOnTop.Width, bitmapToDrawOnTop.Height);
}

// display bitmap to the user
...
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Well like I said you can't really easily modify existing sources in the current version of OBS for windows (which will eventually get deprecated for the new version). The new version you can modify existing sources however, as I was saying, so you may have to wait until it's available to do what you're trying to do. You could however modify the existing code to do the stuff you want, but most likely not with C#
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
It's technically already released, but filter support hasn't been released yet.
 
Top