In this article, I’ll show how to produce a STANAG 4609 file from a video file and telemetry without writing a single line of code...
Let's assume we have a video file and some metadata and we want to combine them in a STANAG 4609 file. Our metadata is in a proprietary format and we want to insert it in a frame-accurate matter, so it could be synchronized with the existing video and could be later played back with any standard player that supports FMV / STANAG. Or, our video and metadata assets are produced automatically and we have a lot of them, so ideally, we would like to automate this process, so no manual user GUI interaction is needed.
We will use a KlvStreamInjector utility for this. So, let's get started.
Preparing the video.
If you have your video in a TS (transport stream) format, you can use it as is. If it is MP4 (or any other format) you can use any remultiplexing / transcoding utility. For example, ffmpeg. Just remember, STANAG 4609 puts some special requirements on the video, so transcode your video (if needed) according to them. For example, the video must be progressive, so if you have an interlaced video you must transcode it.
Preparing the metadata.
For simplicity, let's assume we have an Excel sheet with some relevant telemetry and descriptive metadata where each line has timing information that corresponds to the video file. We can write a macro (or just do it manually) that transforms the information into something that can be correlated to the MISB 601 standard. We can use that MISB 601 spec and copy the tag names (or the Tag numbers) into the first line (making it a csv header). The spec has more than a hundred tags, but we only have some minimal information. Ok, we can skip all the irrelevant tags and copy only those that we have. For example:
That's it! Now we have our metadata in a format that KlvStreamInjector can understand.
From the command line (or better, make a batch file) we will run the KlvStreamInjector with some configuration arguments:
KlvStreamInjectorProc.exe -i srcVideo.ts --dataFileIn srcData.csv -f targetFile.ts
srcVideo.ts - is our video file
srcData.csv - is our metadata file (export excel to .csv)
targetFile.ts - is where the resulted STANAG file will be created.
Pretty easy, no?
Of course, we have much more control over this. For example, by default the metadata will be inserted as ASYN KLV. If you need it as SYNC KLV, just add –syncKlvMode option. Of course, your timing info (which is mandatory) in the csv file must be accurate in order to allow a frame-accurate synchronization.
Or, you're doing an automated batch processing and want the KlvStreamInjector to start processing immediately and exit upon completions, without any user interaction, and you also don't need any messages sent to the console. No problem, just add --autostart and --silent arguments.
For additional info on the configuration options, please see the manual.
KlvStreamInjector also supports json formatted metadata as well as concatenated RAW Klv binary packets.
- Please note that nested standards, like MISB 102, MISB 903 (VMTI) are not supported in csv mode. Use json format instead. More on this here.
No Comments