Search code examples
ubuntuffmpegvideo-streaminghttp-live-streaming

Livestream screen capture to frontend website with low latency


for a project I want to livestream my desktop on my Ubuntu server onto the frontend website (running on the same server using Node/Express).

It would be the same effect as livestreaming with OBS/ffmpeg to Youtube/Twitch and embedding into my own website. It has to be low latency (<1 second)

Could anyone point me in what protocols/applications/tutorials to use as an outline?


Solution

  • To achieve < 1s latency you will have to use WebRTC (as Brad mentioned). This will limit the the amount of other participants consuming your stream, but it is possible to scale this up to 100s or 1000s depending on how you do it.

    If you are comfortable with slightly higher latency (~2-3s) then Amazon IVS might be a good fit for you. Keep in mind that you will still need something to send the stream to IVS, like OBS or a WebRTC implementation that supports live streaming. And you will need to embed their player in your frontend.

    While you can do all of this from scratch, it may be easier to use a service to handle the trickier parts.

    Daily (who I work for) can handle all things WebRTC for you and also lets you send a live stream to the provider of your choice. It's easy to get started and out of the box will allow you to share your screen with hundreds of participants. Here's a sample chrome extension we built to do exactly this.

    There are lots of great services with similar functionality from companies like Twilio, Agora, or Vonage (and many more) as well.

    If you want to build it from scratch check out https://webrtc.org/.