Video streaming

Viinex allows you to stream video with the protocols:

  • WebRTC
  • HLS
  • RTSP

An example of live video, video archive and synthetic video streaming can be seen on our demo for developers.

WebRTC

WebRTC server was released in Viinex in February 2019. We have paid great attention to this development, and by the development we mean that we have created a WebRTC server based on a stack of proprietary technologies managed by our development team, using no existing software solutions. Thus the WebRTC server is a functionality that was created in Haskell language. This concerns as well other functionality of working with video, including RTSP and HLS video streaming.

From technical point of view, WebRTC is a quite wide set of protocols and standards combined for interoperability, which includes DTLS for algorithms and encryption keys selection, STUN and ICE for connection setup, SDP for media session description, SRTP for secure media streaming (for more details, please visit webrtc.org).

ProtocolDescriptionRFC
DTLS Datagram Transport Layer Security RFC 7983
STUN  Session Traversal Utilities for NAT  RFC 8489 
ICE Interactive Connectivity Establishment RFC 8445
SDP Session Description Protocol RFC 4566
SRTP  Secure Real-time Transport Protocol  RFC 6904

Most of these protocols should be combined with each other just to get a video stream in a browser. Fortunately, all this happens seamlessly and unnoticed for a software that is using Viinex.

Apart from being commonly used and supported by most browsers, WebRTC has several advantages when it comes to using it in video surveillance systems:

  • low latency between video registration with an IP camera and its display in a browser – for example, when using WebRTC server in Viinex it is about 230 ms for USB cameras and 500…600 ms for IP cameras. WebRTC protocol, which is widely used in video conferencing, can be used in video surveillance systems – in applications that provide real time monitoring or manual remote control of PTZ cameras by an operator.
  • secure video data streaming, since WebRTC standard is using SRTP for video streaming. No transcoding for IP video is needed, since Viinex doesn’t change payload, but only encrypts data. In case SDP documents are missing information on transport and encrypting a browser just gives an error message and doesn’t proceed to the next step. Besides, this approach works better for video data than organizing a VPN connection. SRTP is meant for working with video, for when packets which are lost, there is no need to resend them again, which is usually not the case with VPN.
  • minimizing expenses on incoming and outgoing traffic on central cloud server for an application that provides remote access for its clients – due to possibility of establishing connection for video streaming directly between the server and the client (even when each of them is in its local network). Viinex can be used for peer-to-peer (P2P) video streaming between Viinex instance that may be behind NAT and client browser which too, as a rule, is behind NAT. In this case there still is a need for a central server or a cloud service – to transmit initial (signal) HTTP requests from a client to an Viinex instance. After this media will be streaming directly from a Viinex WebRTC server installed on the edge to a clients browser, bypassing the central server. It allows for making a video surveillance solution with a great number of users and cameras, which would be really effective in terms of operating cost of such a cloud service. Viinex includes a STUN server ready to be used by an integrating application.


Read more about using WebRTC in video surveillance in our blog.

HLS

Since 2016 Viinex supports HLS streaming. This protocol has been developed by Apple, first released in 2009 and later became an RFC 8216 document. HLS abbreviation stands for HTTP Live Streaming, which means in this case HTTP is a transport protocol for video delivery. Thus, this data delivery system works well on the Internet, even if there are NAT, firewalls with traffic limits for ports on the client side, etc. The protocol is widespread and is supported by the majority of media players, browsers and mobile devices.

Viinex supports HLS streaming both for online video and video archives. Also, no transcoding is needed, since Viinex doesn’t change payload too, only wrapping incoming encoded live video or video previously recorded by Viinex into MPEG TS format for further video delivery. A video is divided into chunks and an index file is made (M3U8 playlist). The mechanism of video streaming is based on consecutive playback of video chunks that are downloaded from the links specified in M3U8 playlist. Working as a standard web server, Viinex receives requests from users and delivers all the things needed for playback. In video archive streaming mode M3U8 contains the links to all video chunks. In live video streaming mode M3U8 contains only the links to several recent chunks. To get new video chunks, an application in the user’s browser, periodically updates data in M3U8 format according to HLS specification, which provides the user with a constantly added list of video chunks that client later combines for a seamless playback.

Using HLS allows playback of video streams from Viinex in Apple Safari (in iOS as well) and Microsoft Edge browsers – natively, without additional components. Google Chrome and Mozilla Firefox support part of HTML5 specification called Media Streaming Extensions (MSE), which makes it possible to play an HLS video stream natively as well, by executing Javascript code – for example, with ready-made players like hls.js. So, to play a video stream distributed by Viinex one only needs to input a respective URL in a browser’s address bar of the browser or in the javascript code to send to this URL the existing a video tag on the web page. If there is a task to make the video play in rich client applications – one of the solutions is to implement the component with the browser, which will be sent to the desired URL.

Viinex pays attention to security. It has a well-documented “perimeter” – a single open HTTP port per each instance. There are no additional open ports or binary protocols. All API calls to Viinex are subject to authentication. Viinex does not itself implement TLS, but can be wrapped by a reverse proxy implementing TLS on the frontend of a whole application. Viinex supports a shared resource policy for different sources (CORS).

Read more about using HLS in video surveillance in our blog.

RTSP

Created in 1998, RTSP has been a de facto standard in video surveillance for quite a long time. It is also a part of ONVIF standard, which, in its turn, is supported by virtually any video camera manufacturer on the market – that is, if this manufacturer wants his equipment to be compatible with other devices.

Along with RTSP client Viinex also offers RTSP server. Real Time Streaming Protocol (RFC 2326) or RTSP is an application-level protocol that allows real time-controlled multimedia data delivery on request. Data sources may include both real time data streams and previously recorded video. RTSP also provides delivery management tools: it is possible to start and stop streaming, start from a certain time point, change multimedia streaming speed (2x, 8x etc) and so on. In addition, RTSP offers a possibility to choose a delivery channel like UDP, multicast UDP and TCP, as well as a delivery mechanism based on RTP (RFC 1889).

Viinex RTSP server supports RTP with UDP unicast, multicast and TCP transport, realizes digest authentication, which makes Viinex a useful RTSP proxy for different video sources. Of course, Viinex RTSP client is compatible with its own RTSP server. This allows to stream video from one Viinex instance to other instances that, for their part, can distribute this data using HLS or WebRTC protocols. This way Viinex makes it possible to stream video data from one source to an unlimited number of remote clients.