Janus streaming - family DIY

85 views
Skip to first unread message

Dini

unread,
Feb 4, 2022, 4:37:00 PM2/4/22
to meetecho-janus
Hi All,

Looking for wisdom and suggestions in order to not re-invent the wheel. I am not entirely sure if Janus is the best shot for the need, but seems to be the best for the moment.
This is little project for my sister, so no $$$ or whatsoever involved.

The need:
  • On demand live stream of audio & video via browser (single FHD webcam).
  • During the time of no connection to webserver (99% of time), system should be in standby mode, meaning no processing/encoding, whatsoever.
Components:
  • HW - Raspberry Pi 4 + webcam or picam, either webcam mic or external USB
Vision/logic:
  1. Janus starts/enables underlying processes on first connection,
  2. Janus stops/disables underlying processes on last user disconnection/lost connection to last user
  3. If Janus is not capable of tracking number of connected users, potentially a wrapper with JS and websockets would be needed for tracking of connected users, including heartbeat to discover disconnections.
Video stream - to be h264 FHD or HD. Webcam provides such capabilities and if not, Raspberry Pi 4 is capable of real-time GPU encoding.

Idea is that Janus would start GStreamer (gst-launch-1.0) with appropriate pipeline for both audio and video.

Implementations found so far are based on UDP, where GStreamer blindly sends to UDP port and Janus would listen to it, but that is async and whilst acceptable if Janus is capable of starting GStreamer, not sure if that's the best idea (RTP based).

Since all is enclosed within same host, why not to just use UDP and keep GStreamer running all the time streaming to Janus? 99% or more of time it won't be used, therefore there is no reason to stream it blindly - why to burn energy for no need.

Janus can combine RTP audio and video stream, but risk is that these two might get desync, before reaching Janus even if processed by GStreamer within same pipe - is that possible or am I getting crazy here? How to enforce sync?

So the main question is how to set it up on "server" side to launch these processes on first connection (headless)?

Is there anything avalable, which I just need to connect like lego blocks?

All the survaillance solutions use the webcam feed in continuous manner and idea here is to use it only ad-hoc and avoid any continuous processing of video or audio streams, but to be able to stream it occasionally to multiple locations/users and shut down all processing once last user disconnects.

Feeling is that the closest matching is Streaming demo plugin. Where am stuck is how to launch that GStreamer command on demand only. https://janus.conf.meetecho.com/streamingtest.html

I'm complete noob to Janus, did quite a bit of reading, but feel like hamster in spinning wheel even if have systmes and net/sec/IT/linux experience.

Thanks in advance!

Dini

unread,
Feb 5, 2022, 5:33:53 AM2/5/22
to meetecho-janus
Small clarification of the key problem:
My key "problem" is the discovery of client connecting and upon that launching external process as well as stopping it at the time of last user disconnection. Expectation is that it will be mostly one connected, but could be more. Because system will be 99% of time unused, I don't want to continuously encode streams for nothing.

It might be outside of Janus functionality, but equally could be to discover client connecting/disconnecting. One idea is to embed JS on same page as Janus portion and have JS connecting to websocket of additional piece of code responsible for spinning up separate process. I'm not developer even if can read and adjust code ;) hence difficulty for me to start with this mini project and seeking for an advise - it must be not a new problem to launch server side process upon connection and monitor count of connected users.

Do you guys have some ideas how to resolve this portion and if maybe Janus has such functionality by default?

Thanks for help.
Reply all
Reply to author
Forward
0 new messages