Spout for Python

At some point, when  I was learning how to use OpenGL in python + pygame I decided to send stuff rendered directly to the Resolume in real-time. There is SpoutSDK available for C++ and I found a .pyd library that supported SpoutSDK API directly in Python, unfortunately, this lib was compiled only for x86 architecture and I was unable to use it in my x64 project. I tried to compile it by following the instructions located in repository README but failed to do so, and after a little struggle I managed to compile it by myself.


Visual Studio – download link

Boost (I personally used version 1.71 and it worked just fine) – download link

Source code of Spout-for-Python cloned or downloaded – repository link

Python3 – download link

Prepare Boost

Unpack boost

Open boost directory in terminal and type

Note: --with-python can be used to determine any python version, so feel free to change this flag to any version you wish to use Spout-for-Python with.

Next, create user-config.jam file and add this:

where C:\\bin\\Python\\3.7.4 is path to your python

Next, in boost directory run following:

This will create a static python library for x32 and x64 in stage/lib directory.

Now you have to run Visual Studio and open Spout-for-Python

Prepare Visual Studio project

Before compiling library we have to set configuration scope and platform and add additional directories in the properties

In Visual Studio: Right-click on SpoutSDK and select scope and platform:

Add Additional Include Directories

In Visual Studio: Right-click on SpoutSDK -> navigate to C/C++ -> General -> Additional Include Directories and add your boost root dir and python /include dir – see screenshot

Add Additional Library Directories

In Visual Studio: Right-click on SpoutSDK -> navigate to Linker -> General -> Additional Library Directories and add your boost stage/lib dir and python /libsdir – see screenshot

Everything is now set up and ready to be compiled. The last thing to do is to select which scope and platform you want to compile:

Press CTRL + SHIFT + B and .dll should build:

Copy SpoutSDK.dll to your python’s project and rename it to SpoutSDK.pyd, so it can be imported directly. Using it is as simple as:

Start the Discussion!

Your email address will not be published. Required fields are marked *