Search code examples
videovideo-streamingstreamingwebcamlive-streaming

Modern live webcam streaming methods


What is currently the best way to go about streaming live video from multiple camera feeds (client) onto a website that is also compatible with mobile platforms? I'm looking for a low latency solution that also allows monitoring/recording of the video streams on the server side.


Solution

  • As of 2020 the best and most compatible way for low latency live streaming is WebRTC with VP8 video and Opus audio encoding. Note that H264 video will not play via WebRTC on some older Androids without hardware H264 decoding support.

    If you are talking about webcams then a web browser can perform publishing to a media server via WebRTC; the same media server can record your streams into mkv files and can distribute your streams to HTML5 viewers on any OS and mobile device via WebRTC (with less than 0.5 sec latency).

    If you are talking about IP cameras then the media server should be able to receive streams from them over RTSP, convert these streams to WebRTC and send to players. One problem here is that an RTSP camera will normally send you H264/AAC - encoded stream, so a transcoding may be needed, which is very CPU intensive process, so doesn't scale too good. Most media servers can do this transcoding. To avoid the transcoding, you can configure an IP camera to send you H264/G.711 content - both of these codecs, H264 and G.711 audio (PCMU or PCMA) are directly supported by WebRTC, so no transcoding is needed. However, you get two problems with this: a) As said above, H264 will not play on some older Androids; b) G.711 is not really a high quality audio. Axis IP cameras, as far as I know, are the only IP cameras that support Opus audio encoding on-board, as of 2020.

    So you need a media server software to do any of the above; there are free and commercial servers out there; google for "WebRTC media server" and prepare for painful learning curve; WebRTC is a complex thing with many options and variables and all media servers implement it differently.