Video flywheel generator
The KlvStreamInjector has an (optional) internal video flywheel that ensures that you always have an output stream regardless of the input source. When the input stream disappears, the synthetic video of the same profile is generated from the provided image. Of course, the Klv metadata can still be inserted.
There are 2 scenarios:
- Stream interruption (e.w. there was a stream but it is gone)
- "No input stream" from the beginning.
As incoming TS may include different elementary streams (the information KlvStreamInjector cannot guess) there is a need to prepare a profile configuration file that describes the input stream. This configuration can be automatically created when the application receives the "real" stream. Though the file can be manually created, the easiest way would be to run the application once with the existing stream (of the same profile). Once this information is available, the KlvStreamInjector will generate a video and allow metadata insertion in case of both video absence or interruption.
Klv Time
If a stream exists when the application is started, the first Klv time is extracted (if present) and used as a reference (timestamps are later extrapolated during the stream disconnection period). If there were no stream from the beginning, a current system time is used for Klv Time generation. This time is later used as a reference and incoming "real" timestamps are overridden in order to preserve the time continuity.
Configuration
Command | Description |
---|---|
--flywheelInfoFile | A path to file that describes the input stream info (video, klv, audio etc) to be used for synthetic stream generation (flywheel). The file is created upon valid input detection. It is then used when Injector is started without a source. |
--flywheelInfoReadOnly | f set to true, the file flywheelInfoFile will not be updated when a valid source is detected. This can be used in case the info XML is created manually and should be used for all input streams. |
--flywheelVideoFrameFile | A path to a Bitmap file (with extension .bmp) or H.264 IDR frame, preceded by sps+pps (with extension .mpv or .mpg). |
note If the above files are not provided, they will be created at the C:\ProgramData\ImpleoTV\KlvStreamInjector directory The application checks the source frame creation time. If it is different (new file provided) the IDR frame will be rebuilt.
Usage example
KlvStreamInjectorProc.exe -i udp://227.1.1.1:30120 -o udp://227.1.1.2:30122 -p defaultPacket.bin -t 1000 --flywheelVideoFrameFile c:\tmp\StreamError.bmp
where:
- -i is your 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
- -t specifies that we want to insert the metadata every 1 sec.
- -flywheelVideoFrameFile specifies the location of the flywheel image.
Creating IDR frame.
You can create the H.264 IDR frame, preceded by sps+pps manually, using ffmpeg utility:
ffmpeg -i <bitmap file name> -vcodec libx264 -b 1000k -g 3 -bf 3 -b_strategy 1 -coder 1 -qmin 10 -qmax 51 -sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method hex -subq 5 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -y -f h264 -pix_fmt yuv420p <target file>