Spout

Devloping a Spout Solution

Hi there, I would like to either find or develop an application that lets one detect & share videos into Touchdesigner. Where and how do I begin?

I specificaly want to send video thats played in Reaper to Touchdesigner. Reaper uses VLC or ffmpeg for video decoding.

Hi @deseipel

Presumably you would use the TouchDesigner Spout In TOP, with Spout output from the video player.

I would start by investigating how you could use VLC or FFmpeg. Both of these would first need either an OpenGL context or a DirectX device which can be established with Spout functions.

Then you need an uncompressed RGBA pixel image for each frame of the video for the SendImage function. There is more involved of course but too much detail to cover here.

When I looked at building a VLC module it was too complex for me, but you might want to have a look at possibilities. Also, if Reaper uses a command line for for FFmpeg.exe, you might be able to modify that to use an output pipe.

I would then suggest using DirectX in favour of OpenGL with the latest DirectX methods in Beta 2.007. I can send you an example project using FFmpeg with a pipe if you find that there are possibilities. Just send me a private message here or use the email contact on GitHub.

Thanks for the detailed response. I’ve been able to find a temporary solution to my project. Ffmpeg allows window capture and I found a command that sends that capture to Touchdesigner via UDP. There is some minimal latency but I think it will work.

Please send the example you mentioned, I may revisit this soon.

Ok that’s good.

The other possibility I forgot to mention was NDI which has a module for VLC and could be a simple solution if window capture/UDP is fast enough for you. I am not sure which combination would be best without timing tests.

The project I mentioned was intended as an example and I set it aside as too complicated, but I had another look and I think it could be simple enough.

I have included it in the Develop branch for now too see how it fits.

Edit - There’s also the Openframeworks Spout video player project if that is of any use for you.

I tried NDI in the VLC settings and unfortunately it didn’t work. I suspect Reaper has the VLC command hard coded with the -ignoreconfig option. I even tried adding -vout=NDI to the VLC entry in the registry, nope.

Thanks, I’ll look at your link.

OK, it looks like a Reaper problem then. At least you have a solution you can get working with. I hope the example code might be of some use for further work.

I may have jinxed it, I’m having issues with my UDP stream, sometimes it doesn’t work in TD.

I’m having trouble wrapping my head around SpoutCam; is it a sender as well as a receiver? And if so, what about using ffmpeg to capture a window and then sending that to SpoutCam? I can’t seem to get the syntax correct in ffmpeg.

SpoutCam is a DirectShow filter that looks like a webcam. It is a Spout receiver, and doesn’t “send”, but rather DirectShow hosts can access it’s output.
There was another post about using it in FFmpeg and I found it in the list of devices using that command. If you can get a normal webcam working it should be the same.