Previous topicNext topic

Spout2 to OBS Not working

Questions, comments, feedback, etc.
Post Reply
chabuku
Posts: 16
Joined: Tue Apr 27, 2021 6:39 pm

Spout2 to OBS Not working

Post by chabuku »

I'm having an issue where using Spout to output to OBS is causing some glitches in OBS.

I opened an issue on the Off-World Spout-OBS github, and have installed a clean OBS (without any other plugins - only Spout-obs), but that did not seem to work at all.

The issue started with OBS 26 (over a month ago) and the previous stable version of Spout-OBS. The version of MMV I'm using is 2.31

Looking for ideas on how to fix this issue.

It only seems to happen directly when importing into OBS from MMV. If I use the Spout Sender from the SpoutSDK into OBS it works, if I use the Spout Receiver to check what is coming out of MMV it works.

The workaround I've been using for the last month is Spouting out from MMV into TouchDesigner works fine, and Spouting out from TouchDesigner to OBS works fine as well. Obviously I don't want to have to run a middle program just to get MMV into OBS.

For my system I'm running AMD CPU & GPU: Ryzen 5 3600X & Radeon RX 6700 XT
Attachments
Distortion happening from Spout MMV -> OBS
Distortion happening from Spout MMV -> OBS
obs-mmv-issue1.png (786.22 KiB) Viewed 16443 times
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Spout2 to OBS Not working

Post by Magic »

This is a known issue with Spout and some AMD graphics cards. There are several posts on here about it. I do not know if there is a solution.
leadedge
Posts: 33
Joined: Fri Mar 06, 2015 6:47 am

Re: Spout2 to OBS Not working

Post by leadedge »

The graphics corruption appears to be a problem with the AMD driver and the NVIDIA OpenGL/DirectX extension.

This experimental link program receives and sends the result out again. It was made to solve a format issue with DirectX 9, but it might might work for you because it does not use OpenGL.

Let me know how it goes.
Valis
Posts: 21
Joined: Thu Feb 11, 2021 6:37 am

Re: Spout2 to OBS Not working

Post by Valis »

Try Spout2NDI (on the Spout downloads page) and the obs-ndi plugin:

https://github.com/Palakis/obs-ndi/releases
https://obsproject.com/forum/resources/ ... tudio.528/

Set Spout v2 in Magic if using that of course, and Alpha iirc is fully supported. I typically use this to run Magic on one machine, send NDI over the network to a Resolume machine which then outputs again via NDI to OBS, so not sure if your AMD bug is a factor here or not (those are all Nvidia machines).
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Spout2 to OBS Not working

Post by Magic »

When sending video between different apps on the same computer, NDI is much less efficient than Spout. Using NDI is only a good idea if you're sending video between two different computers.
Valis
Posts: 21
Joined: Thu Feb 11, 2021 6:37 am

Re: Spout2 to OBS Not working

Post by Valis »

Which is why I personally use it, but it might also solve his issues. There's also the NDI module for this app if I recall, but I had some problems with instability using that. And though trending further OT for saying so, there are also hardware NDI converters from Magewell & other vendors that work quite well. The biggest issue in my experience with going through Spout > NDI > Network or a capture card is that the latency can add up, especially if FOH is using a scalar+spider+LED brain to drive their panels (meaning too much latency on my end often pushes things over the threshold where it's obvious).

In any case, I'll digress. ;)
chabuku
Posts: 16
Joined: Tue Apr 27, 2021 6:39 pm

Re: Spout2 to OBS Not working

Post by chabuku »

leadedge wrote: Let me know how it goes.
This link program works great, actually. One piece of information I forgot to mention is that I am using a MMV Plugin given to me by Scottie Fox that allows you to Spout out and name the source. You'll have to forgive me for neglecting to give that bit of info as well. I have included a link to a screenshot on what my workflow looks like for outputting to Spout. The workflow includes some NDI outputs because I've been going between Spout and NDI to try to figure this issue out (they are currently on bypass).

Screenshot: http://chabuku.com/screenshots/mmv-outputs.png

I have tested using multiple open copies of SpoutLink and can pull each output source exactly as expected and bring them in to OBS as expected as well.

I was only using TD as a link so I can now eliminate TD until I am actually using it for visuals. The things I want to do with TD involve the requirement of an Nvidia card, so that will be a totally unknown amount of time in the future.

NDI has a noticeable lag when used on the same machine though, so Spout is my preference. It also does not consistently work in the same way that the SpoutSender does where it will send the entire Magic source out instead of only the source input that it is in line with.

I super appreciate everyone's involvement in trying to solve this with me (OffWorldLive, Spout, & MMV folks as well), since this is a problem with AMD if there is a way for me to connect the actual source of the issue - AMD and their driver support - I'm going to look for that contact information as well and try to file a bug report through that. I haven't even begun in that direction though.

Edit: if there was anyway for me to set a flag on a shortcut to change the title or the output title for each instance of the SpoutLink it would help me with the output organization naming.
leadedge
Posts: 33
Joined: Fri Mar 06, 2015 6:47 am

Re: Spout2 to OBS Not working

Post by leadedge »

You have confirmed a problem with your AMD graphics for Spout with OpenGL. We assume it is a driver issue with the NVIDIA GL/DX interop, but I don't have a faulting system to confirm this or set up any tests.

That MMV Spout sender plugin you are using is an old one before Magic had Spout output. I can't promise to support it due to lack of time, but I still have the code if anybody wants to do that.

For multiple instances of SpoutLink you should get senders SpoutLink, SpoutLink_1, SpoutLink_2 etc. in the sequence that they are opened. The name can't be changed other than that.

I don't have any AMD contacts, so your bug report is appreciated.
Valis
Posts: 21
Joined: Thu Feb 11, 2021 6:37 am

Re: Spout2 to OBS Not working

Post by Valis »

My suggestion clearly wouldn't work for your workflow, so thanks for the screenshot to clarify.
chabuku wrote:
leadedge wrote: Let me know how it goes.
NDI has a noticeable lag when used on the same machine though, so Spout is my preference. It also does not consistently work in the same way that the SpoutSender does where it will send the entire Magic source out instead of only the source input that it is in line with.
This might be the implementation for Magic? When implemented in hardware they tout 16 scan lines or one field of latency, and even implementations prior to 2016 were one frame (not one field, though this is less of a differentiator in the progressive scan era).

I was never able to handle both NDI input & output at the same time using the builds that were available for Magic when I tested it, and similarly when I was using the modules in parallel as you're using them there was some instability as well. So I didn't use it enough to notice any latency issues. To be sure Spout2NDI and NDI2Spout are likely going to have some sort of queue depth internally to handle the translation, even if the buffer is only 1-2 frames. In practice NDI performs so much better over typical gigabit networks that I find I prefer it, and its flexibility to handle floating point audio and different video encodings (YUV, higher bit depths etc) means it's very useful alongside tools like Notch and Smode.

In any case, I don't mean to pull your thread too far OT and I do hope you find a solution for your GPU issues. Updated builds of both the Spout and NDI modules would be very much appreciated here as well, and it's why this thread caught my eye and has me checking back. So glad to see the Spout dev dropping by, and hopefully my interested gets noted as well.
chabuku
Posts: 16
Joined: Tue Apr 27, 2021 6:39 pm

Re: Spout2 to OBS Not working

Post by chabuku »

leadedge wrote:That MMV Spout sender plugin you are using is an old one before Magic had Spout output. I can't promise to support it due to lack of time, but I still have the code if anybody wants to do that.
That's good to know. That may be the cause of some other issues I've noticed with this sender also ignoring some adjustment modules like gamma correction, exposure adjustment, et cetera. I'm not a C programmer otherwise I'd take a crack at it.

leadedge wrote:For multiple instances of SpoutLink you should get senders SpoutLink, SpoutLink_1, SpoutLink_2 etc. in the sequence that they are opened. The name can't be changed other than that.
I think due to my last stream I had so many performance issues I'm going to maybe try to convert my workflow to only use one Magic output at a time. Unfortunately that will be preventing me from added some layered effects that I was hoping to do and also requires me to try to script some changes through Lioranboard and OSC. I'm having trouble finding OSC set up guides though.

I appreciate everyone that put eyes on this issue, and submitted a couple bug reports through various channels. I'm not sure where those reports go though I'm going to continue to seek a more direct contact to file and track this bug.
leadedge
Posts: 33
Joined: Fri Mar 06, 2015 6:47 am

Re: Spout2 to OBS Not working

Post by leadedge »

Here is an update and re-build of the Magic Spout sender plugin.

Can you receive into OBS from the plugin output, or do you get the same glitch effect?

For the colour adjustments you mention, try inserting the modules before the sender plugin. I tested it this way and the ISF modules work OK.

I am looking into the different results you have found. We assume that it's an issue with the AMD driver GL/DX interop extension, but it could be something else.

Some time back we narrowed this down to a problem with alpha and Eric added a "Send alpha channel" option for the Spout output. Try checking that option off to see what happens for OBS.
chabuku
Posts: 16
Joined: Tue Apr 27, 2021 6:39 pm

Re: Spout2 to OBS Not working

Post by chabuku »

leadedge wrote: Can you receive into OBS from the plugin output, or do you get the same glitch effect?
I tested a bit with the new MagicSpoutSender.dll (thanks for that by the way).

If I pull into OBS directly the output from the sender: no glitches.
The only issue though is that the output is not consistent. See attached screenshot for an example I'll describe here:

* I have two scenes "Trail Enhancement" & "CRT-VHS".
* I name the sender Output1 and Output 2 (respectively)
* I make a third scene for output (we'll call it "Output")
* I add the other two scenes as modules
* I connect them each to their own sender
* I connect the sender for each to the Magic window directly (no crossing or connecting of scenes or senders).

This is what happens when I use the Spout OBS input for each:
* Magic Main Sender: Glitch
* Output 2 at top node connected to Magic Module:
* Bring Output1 into OBS and it works (and only sends Output 1).
* Bring Output 2 into OBS it has both Output 1 and Output 2 - No Glitches
* Output 1 at top node:
* Output 2 works (only Output 2)
* Output 1 has both Output 1 and 2 - No Glitches
* Color is as expected as long as I use Opaque on the OBS Source & use a Luma key filter on the source

With Spout Link:
* Exact same behavior as above
* Both Output1 & Output2 are slightly different in the SpoutLink
* SpoutLink will also import into OBS without issue as long as I use opaque and add luma key as filter

Definitely getting somewhere with this testing. Odd though that the prior SpoutSender would send only the path before it and the new one will send everything in the window connecting to the Magic Module unless it's the second one (I haven't tested with a third yet). The other odd thing is about having to import Spout and not use the Alpha channel that is sent over.

I'm still trying to figure out how to connect to OSC to switch scenes simultaneously with OBS scene switching and then I'd have a workflow that is functioning without running extra programs just to middleman the input/output. Running into issues with OSC.
Attachments
Scene with two other scenes as input - with SpoutSender Output before Magic Module
Scene with two other scenes as input - with SpoutSender Output before Magic Module
magic-spoutsender-test.png (34.41 KiB) Viewed 16363 times
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Spout2 to OBS Not working

Post by Terry Payman »

Similar oddities for me with an NVIDIA GTX 1070 GPU, unfortunately no time to investigate them in detail them at the moment. The first instance of MagicSpoutSender is sending the Magic Main Sender output instead of its own feed. Same result in Resolume or the Spout Demo Receiver.

:D :D :D Very many thanks for this sender :D :D :D
My use cases
1) I need it for sending simultaneous 64-bit Magic scenes to Resolume Arena so combinations of the streams can be externally blended/layered/selected etc. Also, Resolume offers significantly more capability than Magic when building video feedback loops, as one video stream can act as a mask to another and further effects can be included in the loop.

2) Building internal video feedback loops within Magic, as I used to do with the your 32-bit senders, enabling a succession of modules including masking to be used within a loop. Eric tells me that such application will have undefined behaviour, but Resolume Wire now offers such functionality with the proviso that a 1-frame delay must be incorporated. It would be awesome if this could be reliably implemented within Magic environment.
leadedge
Posts: 33
Joined: Fri Mar 06, 2015 6:47 am

Re: Spout2 to OBS Not working

Post by leadedge »

Terry,

the first question I would ask is "Is this a laptop"? If so, there is the Optimus Intel/Nvidia complication. It could be related to the current problem if you notice the same sort of thing in OBS.

I can see that multiple output modules could be useful. I can't guarantee to support it, but will create a repository for the plugin so that anybody can make changes as required.

chabuku

I also noticed that the top "Output 2" sends the equivalent of the Main Magic output. You should be able to get around this by connecting "Output 2" and "Output 1" to a blend module in "Add mode".

In fact, if you connect another MagicSpoutSender module after the blend you will have the output you require for OBS. Removing "Output 2" and "Output 1" won't affect it.

The reason for the corruption remains a mystery. The underlying OpenGL methods in the Spout functions have not changed.

I assume that it's isolated to AMD/Magic/OBS, or do other receiving programs show the problem?

The OBS plugin uses DirectX, but the main difference is that it moves data from GPU to CPU for the OBS image. The method for this could be something to investigate. If I think of something I will report on the OffWorldLive OBS plugin repo so please keep an eye on that or we will have no means of knowing whether any code change has an effect.

Also was there any difference at all when you checked "Window > Magic Window Options > Send Alpha Channel" off?
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Spout2 to OBS Not working

Post by Magic »

I'm going to add a tweak for the Send Alpha Channel option. I will release the next version of Magic soon because it will have only minor bug fixes. Stay tuned.
chabuku
Posts: 16
Joined: Tue Apr 27, 2021 6:39 pm

Re: Spout2 to OBS Not working

Post by chabuku »

leadedge wrote: I also noticed that the top "Output 2" sends the equivalent of the Main Magic output. You should be able to get around this by connecting "Output 2" and "Output 1" to a blend module in "Add mode".

In fact, if you connect another MagicSpoutSender module after the blend you will have the output you require for OBS. Removing "Output 2" and "Output 1" won't affect it.
I will give this a shot, I'm pretty happy it's all working fairly well now and am switching around playlist items through Lioranboard + command line calls through OSC.
leadedge wrote: I assume that it's isolated to AMD/Magic/OBS, or do other receiving programs show the problem?
No other program seems to do this. Even Spouting from another program like TouchDesigner doesn't do this anywhere.

leadedge wrote: The OBS plugin uses DirectX, but the main difference is that it moves data from GPU to CPU for the OBS image. The method for this could be something to investigate. If I think of something I will report on the OffWorldLive OBS plugin repo so please keep an eye on that or we will have no means of knowing whether any code change has an effect.

Also was there any difference at all when you checked "Window > Magic Window Options > Send Alpha Channel" off?
FYI I opened a bug report over at the Off-world repository if you do end up looking at that repo: https://github.com/Off-World-Live/obs-s ... /issues/20

I don't recall there being any difference with that option on or off, but I will test further. I am actually about to go on vacation for a week this upcoming weekend, so I will check back in when I can this week or when I get back.
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Spout2 to OBS Not working

Post by Terry Payman »

Brief answers/comments for all the questions, more details of odd behaviour to follow.
leadedge wrote: "Is this a laptop"?
No, a desktop with Intel CPU, but Magic is using the NVIDIA GTX 1070 GPU with the most recent Studio Driver 462.59. Here's Magic's OpenGL Info window:
Magic Nvidia.jpg
Magic Nvidia.jpg (22.57 KiB) Viewed 16323 times
leadedge wrote:...I assume that it's isolated to AMD/Magic/OBS...
My problems show identically with the SPOUT-2007e Spout Demo Receiver suggesting issues in the sending, not receiving.
leadedge wrote:was there any difference at all when you checked "Window > Magic Window Options > Send Alpha Channel" off?
No difference in the odd behaviour when I toggle Magic's Send Alpha Channel.

However MagicSpoutSender only respects Send Alpha Channel setting if Magic's Spout Output is enabled.
The alpha channel is always sent by the MagicSpoutSender if Magic's Spout Output is disabled. Perhaps this anomaly will be addressed in Eric's tweak.
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Spout2 to OBS Not working

Post by Magic »

Lynn, I just went to your website because I remembered that other AMD owners were having the same problem with different apps like TouchDesigner or Max, and indeed after browsing through your forums, it does seem like my memory is correct. So although I may be able to find a workaround for Magic, it appears that the main problem is with the AMD driver.

Here is an example: https://spout.discourse.group/t/spout-s ... work/245/2
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Spout2 to OBS Not working

Post by Terry Payman »

Multiple output modules - oddities
It would be awesome if these could be made to work reliably, but I'm fairly certain it would be way beyond my abilities :( :oops:
Perhaps this further description of odd behaviour will shine a light on the cause. The oddites show up identically in the Spout Demo Receiver, but I mainly used Resolume which has the advantage of continuous displaying a live list of all Spout Servers

I made a Magic project (attached) with five numbered scenes, each of which had a MagicSpoutSender. In addition a sixth scene combined their individual Magic outputs. "Keep Scene in Graphics Memory" was checked for all the scenes. A Resolume 6 composition was used for testing, having separate columns for each of the five MagicSpoutSenders plus a column for The Magic Main Sender. The Resolume Avenue/Arena 6 project is attached, change the MagicSpoutSender.txt file extension from "txt" to "avc".

Observations
"Keep Scene in Graphics Memory" is checked for all scenes
The five MagicSpoutSenders (MSSs) all show up in Resolume's Spout Server list

MSS's output from each of the five scenes is frozen unless that scene is selected by tab or playlist. This is perhaps because the Magic scenes are presumed to be inactive despite being in graphics memory and Spout sending is not being recognised as activity.

1) Oddities arise if the sixth "combined" scene is selected, that scene having ColorHSB and Translate modules feeding the Magic module output.
All five MSSs become active, as expected. However the color and translation of the sixth module then appear on each individual MSS's outputs too, as well as strange superimpositions:
  • MSS 5's output shows, but with the color and displacement from the sixth scene.
    MSS 4's output shows, with the color and displacement plus MSS 5's output superimposed.
    MSS 3's output shows, with the color and displacement plus MSS 4's & MSS 5's outputs superimposed.
    MSS 2's output shows, with the color and displacement plus MSS 3's, MSS 4's & MSS 5's outputs superimposed.
    MSS 1's output shows, with the color and displacement plus MSS 2's, MSS 3's, MSS 4's & MSS 5's outputs superimposed.
2) When Magic's Spout Output is enabled the MSS's respect Magic's Send Alpha Channel setting, but MSS's always send alpha if Magic's Spout Output is disabled.
Attachments
MagicSpoutSender.magic
Magic project with multiple MagicSpoutSender modules
(3.89 KiB) Downloaded 387 times
Resolume Spout Receiver.txt
Resolume Avenue/Arena 6 project for testing the MagicSpoutSender module. Change ".txt" file extension to ".avc"
(43.19 KiB) Downloaded 378 times
leadedge
Posts: 33
Joined: Fri Mar 06, 2015 6:47 am

Re: Spout2 to OBS Not working

Post by leadedge »

Thanks for the information in all these replies.

chabuku, thanks for confirming Magic>OBS. I can't see why right now but will look into possibilities. Have a good holiday..

Eric, yes I am certain that this is an AMD driver issue confirmed by observations by others. We have assumed that it's a fault in the GL/DX interop extension. But the fact that it can work seems to indicate a more general problem. The possible alpha issue came up because the old demo programs worked and they don't use alpha. But they are also old OpenGL.

I think you can remove Spout1 support. For me it freezes if "Use Spout 2" is not selected. Your changes to alpha will be interesting.

I have just moved the entire Beta branch to Master, so the same code that I used for the sender module is there. I have also created a separate repository for it. Its basically a one-liner, so you can look at that for your next revision.

Terry, I don't think much can be done within the plugin for super-impositions or other conversions. Yes I observe that if a scene is de-activated by changing to another, the Spout output within that scene freezes, but if the scene is put as a module into another scene, the output is active. It makes sense to me that a hidden scene is not rendering. I don't know enough about Magic functionality to make further comment. Thanks for the projects and I will try them.

It seems to me that this is still AMD specific but of uncertain cause. I can't see any difference with the OpenGL functions so I am suspecting a DirectX shared texture access problem. I will think on that a little further before contacting the OffWorldLive people.
Post Reply