Video Streaming with WebRTC and RTSP
Nabto supports two different approaches to video streaming: Nabto WebRTC and RTSP TCP tunneling using Nabto Edge Tunnels.
Nabto WebRTC is our recommended approach to video streaming: It performs much better for live video and natively supports web browsers on all platforms just as well as dedicated iOS and Android apps. For some projects, the RTSP tunnelling based approach is still the best (or only) option. This guide will help you decide which approach to take and point you to specific demos and examples.
WebRTC vs Tunneled RTSP
WebRTC is a modern protocol designed for high performance in video scenarios. While initially intended for browser-to-browser communication, it works really well also for viewing a video feed from e.g. a camera or DVR in a browser or mobile app: The design for very low latency is a great benefit in live surveillance cameras and the feed is less sensitive to network issues due to being UDP based. It all works with standard player components, e.g. available in all modern browsers and as open source components for use in mobile apps. That is, no proprietary low level video integration is necessary.
The Nabto WebRTC C++ Camera SDK for use on the embedded system (e.g. camera / DVR / NVR) requires a toolchain that supports modern C++ (at least C++17). While available for most reasonably modern platforms, some older and/or limited platforms lack this. For these, the tunnelled RTSP approach can be used instead. Moreover, Nabto WebRTC requires a larger total footprint on the camera - both in terms of memory usage and executable size.
A lighter implementation is in the roadmap that will allow WebRTC to be used on more resource constrained devices. Please contact us for more information in this regard.
When to use WebRTC for Video Streaming
If you have a modern target system with a C++17 toolchain available and if resources are not too limited on the target, you should use Nabto WebRTC. Also, if you have a requirement to view a video feed in a plain web browser, WebRTC is your only practically feasible option.
The exact resource requirements on the camera depend on your specific system configuration and video quality. So it is recommended to try a quick prototype through the examples and evaluate the feasibility.
When to use Tunneled RTSP
If a feasibility study concludes that your target (camera/DVR/NVR) platform is too resource constrained to use Nabto Edge WebRTC, you can instead choose to stream video using Nabto Edge TCP Tunnels.
You can use any RTSP video player in the client. It is pointed towards the Nabto Edge TCP Tunnel endpoint within the client application. Under the hood, this connects securely to a Nabto Edge TCP Tunnel endpoint on the target which in turn connects to an RTSP service on the camera:
In the RTSP video scenario, the “existing TCP server application” is the RTSP server running on the camera (or gateway or DVR/NVR). The “existing client TCP application” is an RTSP video player component like VLC or FFmpeg.
The player is simply pointed towards the TCP proxy server running inside Nabto Edge Client SDK, e.g. rtsp://127.0.0.1:51743/live/0
and the remote feed is shown - through a secure connection.
It is extremely simple to integrate Nabto Edge TCP Tunnels in your existing RTSP based video player application; you can typically get a proof-of-concept integration running with just a few lines of code. See the RTSP client guide.
Note that if you have an RTSP server available on the camera, you can still use Nabto WebRTC and get all the benefits of WebRTC instead of relying on RTSP tunnels: We provide a bridge application on the camera that consumes an RTSP feed and serves data to the WebRTC client.