Use Cases
Stream In, insert static data, Stream out
Let's assume we have a UDP TS stream (without any KLV data) and want to add some static metadata and timing information, effectively making it a STANAG 4609 stream. This may be useful if you need to produce a continuous STANAG stream (for testing purposes) or just add some geo or other metadata to a TS stream that comes from a regular (non STANAG) camera. We'll prepare a Default packet that contains this metadata information and configure the KlvStreamInjectorProc to receive the UDP, re-stamp the static metadata, remultiplex the steam and send it to a new destination.
First, the Default packet can be created as a RAW KLV buffer or JSON formatted string.
For RAW KLV, you can use a KlvInspector or a similar application to create the buffer. For JSON, just create a file, something like this:
{
"3":"test",
"10":"15HD BN-2T",
"11":"EOW",
"12":"Geodetic WGS84",
"13":-31.129145148,
"14":150.438536746,
"15":2854.1,
"48": {
"1": 1,
"2": 1,
"4": "Flight 1",
"5": "test",
"6": "CA AU",
"12": 1,
"13": "AU",
"22": 8
}
}
Note, if the file is updated during the injection, it will be reloaded, so the new data will be used, making the static content dynamic...
Next, we'll run the KlvStreamInjectorProc providing the configuration parameters as the command line arguments:
KlvStreamInjectorProc.exe -i udp://227.1.1.1:30120 -o udp://227.1.1.2:30122 -p defaultPacket.bin -t 1000
where
- -i is our source Udp TS multicast stream sent over 227.1.1.1:30120
- -o is the target output stream (can be unicast or multicast)
- -p is a path to the default packet and
- -t specifies that we want to insert the metadata every 1 sec.
Stream In, insert static data, stream out + Recording
That's a combination of the above scenarios, so just add both -o and -f
KlvStreamInjectorProc.exe -i udp://227.1.1.1:30120 -o udp://227.1.1.2:30122 -f C:\Movie\test.ts -p defaultPacket.bin -t 1000
Inserting a dynamic Klv metadata into Udp TS stream
We have 2 options here:
- receive a Klv packet as a RAW Klv buffer
- receive a Klv packet as a JSON string
The configuration is similar to the previous use cases, we just need to add our dynamic KLV source.
For raw klv packets:
KlvStreamInjectorProc.exe -i udp://227.1.1.1:30120 -o udp://227.1.1.2:30122 -u udp://127.0.0.1:12345
where
- -u is where upd packets will arrive
For json packets:
KlvStreamInjectorProc.exe -i udp://227.1.1.1:30120 -o udp://227.1.1.2:30122 -j udp://127.0.0.1:12345
where
- -j is where json packets will be arriving
Frame grabber + encoder
Please see Frame grabber for more details
Offline processing
KlvStreamInjectorProc.exe -i c:\Movie\sourceFile.ts -f c:\Movie\targetFile.ts --dataFileIn c:\Movie\data.csv
where
- -i is the source file
- -f output (target) file
- --dataFileIn Csv formatted metadata file
You can use different data formats. For more info see KlvDataFormat
A note on the Existing KLV data
As the original TS stream may have Klv metadata in it, you can decide to either drop the existing data or keep it.
-
--existingKlv drop
The existing KLV data pid will be filtered out, so the data you insert will be the only Klv metadata in the stream -
--existingKlv keep
KlvStreamInjector will preserve the original Klv data, complementing the stream with Default Packet (if defined) or any injected data.