Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would capture with obs-gstreamer be a "headless" possibility? #1007

Open
giantg opened this issue Jan 31, 2023 · 4 comments
Open

Would capture with obs-gstreamer be a "headless" possibility? #1007

giantg opened this issue Jan 31, 2023 · 4 comments

Comments

@giantg
Copy link

giantg commented Jan 31, 2023

Hi Steve,

I first would like to say a HUGE THANK YOU for VDO.ninja! This is one of the most polished "did it in my spare time" projects I have seen in a long time (I'm only assuming it's a "did it in my spare time" since it's not a for-pay service - gotta pay the bills somehow).

I'll keep it short. My main question: Is it possible to receive the video feed to be broadcast via OBS using GStreamer or even possibly the obs-gstreamer plugin? Wondering if that would yield better capture quality / use fewer resources in capturing what would become the "room output" or "broadcast" view.

I did a bit of searching first and found Issue #863 where you mentioned your other project raspberry_ninja which makes extensive use of GStreamer but in what looks like the reverse direction (i.e. capturing a camera on a PI and publishing to a VDO.ninja room).

If there are some gstreamer-experts out there, they might be able to make something useful of it though.

I also read Issue #691 and got excited when I saw you mention:

RTP is a different feature request; I'll have some Gstreamer code out soon should be a start to let users pull RTSP out on their own. I'm not sure when I'll find time to make it into a premium-polished offering though.

I am by far absolutely NOT a GStreamer expert. I'm primarily a C#/.NET developer (sometimes Java and a bit of C/C++), but I do understand a bit about media containers, packaging, muxing, de-muxing, etc...

Is there a direction you might point one looking to receive the output of a VDO.ninja room via GStreamer? Even if it is super hacky "run this ridiculously long CLI after plucking this value out of the browser's developer view."

Again a huge thank you for all of your contributions to the open-source community!

@steveseguin
Copy link
Owner

Going from OBS -> VDO.Ninja directly is now possible, in an experimental fashion, using something called WHIP: https://www.youtube.com/watch?v=ynSOE2d4Z9Y It's just not an ideal way of publishing to VDO.Ninja; ain't ideal for p2p at least, but it would work with Meshcast quite well.

I the future, if OBS gets something called "WHEP" support, it should be possible for VDO.Ninja to also publish into OBS directly without a browser source; no gstreamer or plugins will be needed hopefully when that is flushed out.

You will lose a lot of functionality using WHEP or WHIP though, as VDO.Ninja does a lot more than just push video. Having a custom OBS-VDO.Ninja plugin that uses Gstreamer (or other) would unlock quite a lot of cool things, including incorporating the OBS websocket API into its data-channels, for example.

I'd also like to add WHIP/WHEP support to Raspberry Ninja, to make Raspberry Ninja compatible with Meshcast as well, but it's lower on my priority list currently.

As per VDO.Ninja -> Gstreamer, the raspberry_ninja project does have a bit of code in it, to record a raw video/audio from a VDO.Ninja stream to disk. I think it's the **--record** option. I'm just dumping the raw stream to disk, not re-packaging it, but those recording files are something you can playback with ffmpeg or something I think.

Having this all work with the OBS Gstreamer plugin though is a different matter; I'd probably need to do some rewriting of the plugin to make it work. Compiling Gstreamer, especially on Window systems, is a nightmare for me, so I'd need help if going that path.

We could probably use the the Rasbperry Ninja project to go from VDO.NInja -> Raspberry Ninja -> OBS though via CLI app, if compiled into an app. There's different ways to get the video into OBS, like RTP/RTSP, once captured; it's even possible to push to the virtual camera: https://github.com/steveseguin/chromicam

I've not had the time to get VDO.Ninja -> RTP/RTSP (gstreamer) going yet, but that's fully possible to add in; it's just a bit more code, as the recording logic got the brunt of that work done already. Unless I get help with compiling, it would only work with Linux though.

@giantg
Copy link
Author

giantg commented Feb 3, 2023

Thank you @steveseguin for such a thoughtful and quick reply. I'm going to look into playing with the --record option code and see if I can't hack my way through some tests.

I am running OBS/VDO.ninja on Arch Linux so building gstreamer should be pretty straight forward for me using the
makepkg -s method via Arch Linux.

Also, thank you for the YouTube on how to go from OBS->VDO.ninja. That explanation actually gave me quite a better understanding of the potential snafus things can run into when doing P2P video and OBS literally only providing 1 stream (and therefor only one remote client gets the output if you don't bring in something like meshcast).

Feel free to close this one if it makes things cleaner for you and I can always reach back out on the other project if I had a specific question.

Thank you again!

@steveseguin
Copy link
Owner

I did some leg work on getting the OBS -> VDO.NInja via RaspberryNinja going.

Both transcoding and non-transcoding modes are supported via linux pipes, and since I think OBS has an FFmpeg output option, I think it should be pretty straight forward to pipe from it to Raspberry.Ninja with the new --pipein option. (with FFMpeg piping out from OBS)

Code change patch:
https://github.com/steveseguin/raspberry_ninja/blob/main/publish.py#L1130

A thread on Discord about using this for FFmpeg -> Raspberry.Ninja:
https://discord.com/channels/698324796546482177/1071597359689121894/1071763863130886246

Raspberry.Ninja also already supports multiple viewers, so unlike OBS /w WHIP, there aren't many downsides to going this path. In theory it would be also possible to publish to multiple RTMP destinations as well, with just a few tweaks to the code being needed at this point.

I'll try to get a proof of concept going for OBS on Windows in the near future, and make a guide when I validate it all.

@lwg-itdev
Copy link

@steveseguin Wow! I really didn't expect you to dedicate any effort to this. Thank you!!! I'm going to play with that this week. Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants