CESNET / UltraGrid

UltraGrid low-latency audio and video network transmission system
http://www.ultragrid.cz
Other
504 stars 53 forks source link

Capturing a device and then send it via Network AND send it via Spout/Syphon #210

Closed maybites closed 1 year ago

maybites commented 2 years ago

Hi

This is a feature-request.

Currently (to my understanding) it is not possible to capture from a device and send the stream via network and simultaneously send it to spout or syphon (or NDI).

It would be nice if it was possible to do so.

cheers

martin

MartinPulec commented 2 years ago

Hi

Currently (to my understanding) it is not possible to capture from a device and send the stream via network and simultaneously send it to spout or syphon (or NDI).

Yes, at least not directly - you can send it to localhost and there split the signal with reflector, something like:

uv -t syphon localhost
hd-rum 8M 5004 -P 6004 localhost <remote_addr>
uv -P 6004 -d gl

(1st and 3rd command may be combined into one with port configuration -P 6004:5004, however see below)

It would be nice if it was possible to do so.

It may be possible to make a capture filter for that. But it will not work correctly for Syphon on macOS (similarly combining command 1), 3) above) because both display thread (GL/SDL, not eg. DeckLink) and Syphon need main thread, which is mutually exclusive. It would work for NDI, however, as well as in any other case – forbidden combination is Syphon + GL/SDL (on macOS, which obvious from Syphon presence).

cheers

martin

maybites commented 2 years ago

thank you for this tip. It will not work for my current setup, but I understand that not everything is possible :-)

MartinPulec commented 2 years ago

In continuous version of UltraGrid, capture filter display arrived. I believe that it may more or less what you were looking for, use is quite simple:

uv --capture-filter display:ndi -c libavcodec <receiver>

Anyways, there are few restrictions, still – captured signal should be uncompressed (but only a few capture devices produce already compressed input, eg. V4L2). Spout and hopefully NDI should work, not entirely sure about Syphon (because of some architectonic reasons – just in case you try, it would be great if you let me know).

MartinPulec commented 1 year ago

Closing for inactivity, I believe that either the proposed solution works or the issue was dismissed. Feel free to reopen if it is not the case.

maybites commented 1 year ago

Neither is the case, but I was unable to reliably reproduce the issue with your proposed approach so far. I will keep trying and report on this channel if this changes..

MartinPulec commented 1 year ago

Ah, I see thanks for the info, I'll give it try with SPOUT/Syphon again.

I didn't test much that time, just that --capture-filter display:ndi worked for me (at least on Linux). I've assumed that then adding -d spout or -d syphon will work, but I didn't test and didn't get a feedback that it didn't. I'll give it a try once again today (or at a beginning of the next week if I don't manage it today).

MartinPulec commented 1 year ago

Okay, so I've re-tested a setup, which I suppose is your target use-case, using NDI as a capture-filter and SPOUT/Syphon as a display. Actually it seems that it works correctly, what I've tested:

Windows

\uv.exe -F display:ndi -t testcard -d spout
\uv.exe -t ndi -d gl # NDI preview
\uv.exe -t spout -d gl # SPOUT preview

macOS

/Applications/uv-qt.app/Contents/MacOS/uv -F display:ndi -t testcard -d syphon
/Applications/uv-qt.app/Contents/MacOS/uv -t ndi -d gl # NDI preview
/Applications/uv-qt.app/Contents/MacOS/uv -t syphon -d gl # Syphon preview

Besides UG own NDI/Spout/Syphon preview, I've also tried sample receiver applications from Spout and Syphon and also NDI Video Monitor from NDI Core Suite.

So from my perspective it is working correctly – please let me know if there is something that is not working. I think that this can be tested very easily (of course you'll use something different than testcard at the end of the day, but this basic setup is supposed to work).

MartinPulec commented 1 year ago

Well, I'll close it again for now, feel free to reopen again with new info or open an another issue.

If it doesn't work, as you indicated, the steps to reproduce doesn't necessarily need to be the above if it doesn't exhibit the problem (although it would be a good case), but I'll certainly need more information, at least used command-line and relevant part of the UG terminal output from the problematic instance.