brunoherbelin / vimix

Live Video Mixer
GNU General Public License v3.0
282 stars 27 forks source link

streaming in local network #56

Closed polymorphicengine closed 1 year ago

polymorphicengine commented 2 years ago

Hello, is it possible to access the local network stream on an other application (for example to view it in VLC mediaplayer?) if so, what is the address where the stream is sent over?

ultimately i would like to be able to stream from vimix directly into hydra, which is based on webrtc and has a similar feature, where it is able to share between instances. Do you think this is possible at all?

Unfortunately, I don't know enough about these streaming protocols..

brunoherbelin commented 2 years ago

Hi ! The local network stream is a specific feature of vimix with two instances of vimix 'discussing' between each others to decide on which protocol to use on which network port to talk.

What you ask is however totally possible in vimix with SRT ; https://github.com/brunoherbelin/vimix/wiki/SRT-stream-I-O SRT is a very flexible protocol but may not be available in other programs.

webrtc is however possibly supported with gstreamer : could you try to run a gst pipeline that sends output to hydra in the way you'd like it to work : with that, I could try to port it to vimix. e.g. see https://gstreamer.freedesktop.org/documentation/rswebrtc/index.html?gi-language=c#webrtcsink-page

polymorphicengine commented 2 years ago

Unfortunately, I can't seem to get webrtcsink to work..

hydra uses the following to manage the webrtc conncetions: https://github.com/ojack/rtc-patch-bay

so maybe once vimix is sending out a webrtc stream it is easy to connect from it to hydra, i guess

brunoherbelin commented 2 years ago

humm... no idea how this works and what hydra is expecting as video stream. if there are examples online on how to stream from one app into hydra, I could try to do test.

BTW, did you try to do live coding inside vimix with ShaderToy input ? https://github.com/brunoherbelin/vimix/wiki/Filters-and-ShaderToy#custom-filter-with-shadertoy-coding

brunoherbelin commented 1 year ago

Hi! I inspected further the question of WebRTC : seems interesting but

So, I looked at other options. Using HTTP Live Streaming (HLS) seems interesting! You can follow this tutorial for example and let me know if this could do the link you need.

polymorphicengine commented 1 year ago

Hey Bruno, thanks for looking into this!

I followed the tutorial, but the hard part was actually getting the stream into Hydra as a source, which I managed. I just need it to point to a .m3u8 file and it works, so I was actually able to run the example and get the video from my camera into hydra like that.

the only thing is that there is a very big delay (more than 10 seconds), do you think this could be reduced? I mean, for it really to be usable I would need it to run in realtime..

brunoherbelin commented 1 year ago

the only thing is that there is a very big delay (more than 10 seconds),

Yes indeed: I also experienced this delay, and didn't seems like changing parameters improved a lot... (you can try to reduce target-duration to 1 and max-files to 2).

The alternative remains a direct streaming of an RTP stream on a UDP socket (see gst examples)

The problem is that then vimix (as sender) has to know the IP and port of the receiver; i didn't like this because I wanted vimix to broadcast to everyone connecting to it (ie. the opposite; the receiver calls the sender). But if on your side it would be meaningful, we could try.

Also note the new feature I am planning to add for another purpose but with same requirement: pipe using shared memory #59

brunoherbelin commented 1 year ago

To clarify what the local network sharing feature does, it was renamed 'peer-to-peer' sharing : this is more explicit to say that it connects vimix programs together.

The shared memory with shmdata #59 was implemented in 0.7.3

Also, for linux, the V4L2 loopback camera was re-activated in 0.7.3 : if your program can show a webcam, then it should be able to display the output of vimix from device /dev/video10