Getting started

Stanag2WebRTC enables seamless integration of live UDP MPEGTS and STANAG 4609 streams into web-based applications. STANAG Video and metadata are transmitted to web clients through WebRTC video and data channels. Optionally, the original streams can be recorded at the server side.

Easy to Use...

Stanag2WebRTC hides all the complexity of dealing with live video and WebRTC communication. With a simple command line configuration on the server side and a few lines of JavaScript code on the client side, you can easily access your live video and metadata...

Architecture

block diagram

Basic functionality:
- Low latency WebRTC streaming

Optional features:
- Stream recording (MPEG TS) segments
- Stream recording (HLS), MISB KLV metadata decoding and WebVTT files generation
- Web server with JWT authorization

Installaiton

Installation instructions can be found here.

There are 2 ways of using the Stanag2WebRTC:

  • Stanag2WebRTC docker container
  • standalone executable (requires GStreamer, ImpleoTV KlvDecode plugin, and MISBCore native installation)

From the above options, using the Stanag2WebRTC docker container is by far the easiest. If you have docker installed, all you have to do is run one docker command. For example, the following command will start the docker container that listens to the UDP multicast stream and serves web clients with video and decoded KLV metadata

docker run --network host impleo/stanag2webrtc:2.1.2 -url udp://227.1.1.1:30120

Without docker (on Windows) it may be:

stanag2WebRTC -addr localhost:4000 -url udp://227.1.1.1:30120

To enable recording, add the target directory and other optional arguments. More info

Now, you will be able to access the front end at http://localhost:4000.

Additional configuration parameters can be passed in the command line.

More info on Stanag2WebRTC docker container

Video re-encoding vs video pass-through

Stanag2WebRTC service can use one of the following methods to stream video:
- Re-encoding to VP8 video
- Pass-through original h264 video

A video pass-through option can be useful in situations where it is important to maintain the highest possible quality of the video, as re-encoding a video can sometimes result in a loss of quality.
In contrast, re-encoding an original video involves converting the video from one format or encoding to another, which can sometimes result in a loss of quality. This is often done in order to make the video compatible with different devices or platforms, or to reduce the bandwidth / resolution, so the client device or network could accept it without significantly affecting the video quality.

Using video capture card as video source

It is possible to use a video capture card (or webcam) as video source, instead of network stream. For example:

./stanag2WebRTC -useCapture

Warning

If you're using docker, the webcam may be not available.

You can scale the video to the desired resolution by adding -videoResolution parameter, for example -videoResolution 1280x720.

Using H264 video file as video source

You can use a raw h264 video file a video source for testing purposes. To do this, pass the full path to the video file as the -testFile parameter.

Using Default Klv packet as data source for testing

You can use the default KLV packet in JSON format as a data source for testing purposes. For example, if you're using a webcam or test file as the video source, you may want to add some test KLV data. To do this, pass the full path to the JSON file representing your data as the -defaultPacket parameter. The Stanag2WebRTC service will then read the file and use it to simulate the data, updating the timestamp to the current time automatically.

You can edit the file on-the-fly, and the changes will be detected and the updated file will be used. The -defaultPacketWatchTime parameter (in milliseconds) configures the interval for checking for updates to the file. The default is 1000 milliseconds, but you can decrease this value to pick up updates faster.

Here's an example of klv packet:

{
    "2": "",
    "3": "MISSION01",
    "4": "AF-101",
    "5": 159.974365,
    "6": -0.431531724,
    "7": 3.40586566,
    "8": 147,
    "9": 159,
    "10": "MQ1-B",
    "11": "EO",
    "12": "WGS-84",
    "13": 60.176822966978335,
    "14": 128.42675904204452,
    "15": 14190.7195
}

RTSP support

Stanag2WebRtc (on Linux) supports RTSP. Connection is only possible to the existing server. It will be terminated when the connection is broken or when the server stops receiving the stream. Stanag2WebRtc will attempt to re-connect every (every 5 sec)

Client side

Client-side applications should establish RTCPeerConnection (using websocket connections for ICE candidates and offer processing).
Video will be received as video track while decoded MISB KLV data packets and other messages will arrive via DataChannel.

Data Channel messages

Stanag2WebRTC comes with a minimalistic default web application that includes a resizable video player with custom contols (including stream recording) and Klv metadata presentation window. This application utilizes the web player component library wiritten with React. App

More info here.

Also, to simplify the custom client-side web application development using arbitrary frontend frameworks, we provide a simple page in plain javascript, as a reference. App

It can be accessed at http://localhost:4000/demo/

Demo html page

Custom frontend

Though you can host your own frontend application anywhere, it is possible to use the Stanag2WebRTC's built-in http server. By default, it serves the ./web folder in the current directory, so you can simply replace its content.

MISB metadata decoding

Stanag2WebRTC makes extensive use of the JSON concept (and syntax) for dealing with the nesting MISB standards hierarchy. JSON key represents a MISB Tag of a Local Set, whereas the value contains MISB decoded data.

{
  "2": "2008-10-24T00:13:29.913Z",
  "3": "MISSION01",
  "13": 60.176822967,
  "14": 128.426759042,
  "15": 14190.72,
  "16": 144.5713,
  "65": 13,
  "1": 53482
}

The "keys" in the above JSON correspond to MISB 0601.X specification. Sub-standards, like 0102, 0903, etc will be delivered as nested data

Recorder

You can record the original multicast streams at the server side.
More info on the Recorder

Getting help

To get help with Stanag2WebRTC, please contact us at support@impleotv.com.