TouchDesigner and OBS are excellent tools for virtual production and streaming content. I am here to present an alternative to the current workflow of using NDI to share video streams between the two. We will be using Spout to share real-time video textures between TouchDesigner and OBS. This does limit us to have OBS and TouchDesigner be running on the same Windows machine since Spout leverages the graphics card to share the video textures between Windows applications, but it greatly reduces the CPU overhead that comes with using NDI.
Before we get started let's talk about how we are using OBS and TouchDesigner.
We will be using two instances of OBS, the first one will be used to ingest our remote video sources using the Browser sources and OBS.ninja. This instance will then share its video to TouchDesigner where we can perform all the operations that we want. The second instance is used to receive the Spout capture from TouchDesigner and stream that out to the interwebs.
The first thing we need to do is make sure that OBS is set up to send and receive spout capture.
- Install OBS Studio
- Install Spout
- Install the OBS Spout plugin
- Install the latest OBS Virtual Camera plugin
Once we have OBS set up with spout, we need to create the scenes that will be shared with TouchDesigner. In this instance, we will be using the Browser source to add a group chat to our OBS scene.
To obtain the URLs for the Browser source we will be using https://obs.ninja/ to create a chat room where our participants can share their camera and desktop capture and share their audio as well. We can create a room link and share that with the participants and once they join the room, we can obtain their links from the control center and add it to the source.
We have now set up our first instance of OBS to ingest the video sources from our guests. We now need to share this with TouchDesigner. We can do that by using the VirtualCam plugin in the tools to start a virtual camera.
Now that we have OBS sharing the video texture as a Virtual Camera, it is time to move to TouchDesigner where we can start working with this texture.
We can simply access this video texture in TouchDesigner by using a videodevicein TOP and setting the device parameter to OBS-Camera.
We can now work with this like any other TOP inside TouchDesigner. The size of the TOP in this case is 3840x2160 which corresponds to the canvas size that we have set for OBS. This allows us to set up multiple sources in one scene at a smaller resolution and pass them in the same texture.
Once we have our network completed in TouchDesigner, we can use the syphonspoutout TOP to create a spout source.
We can now start setting up our second instance of OBS. We will be using the Spout capture source to obtain the spout stream from TouchDesigner. We can either use the first available sender or select the stream that we created in TouchDesigner.
We have now set up the ingestion of video sources in one instance of OBS, passing that to TouchDesigner for processing and then sharing our output from TouchDesigner to a second instance of OBS to be streamed to the web. We can see something that is missing though, our input scenes have audio sources associated with the video, but that audio doesn’t reach our scene in the second instance. We can get around this easily by using VB Audio Cable (https://vb-audio.com/Cable/) to route the audio from one scene to the other.
Once we have the virtual cable drivers installed and the system rebooted, we can set the first instance of OBS to route all the audio sources to the Cable Input. We can set that up by changing the advanced audio properties of the source to Monitor only and set the default monitoring device to the Cable Input.
We can then use the second instance of OBS to create an audio input capture source and use the cable output as our audio source in the scene.
We have now successfully shared audio captured from our incoming video sources and very easily shared that to the instance of OBS that will be streaming to the web.
This is one way to set up TouchDesigner and OBS for streaming real-time content. Spout allows for leveraging the GPU for texture sharing and bypasses the need for using CPU intensive protocols like NDI. It limits us from distributing the application on the network and requires that applications must run on the same computer, but it reduces the lag in communication between them.