On-the-Fly Video Resolution Change
By default, STANAG Player SDK scales the video to fit the application window. The aspect ratio is determined once at the beginning of playback.
If your stream changes resolution dynamically, overlay tools (such as VMTI, measurements, etc.) may not function properly unless specific steps are taken.
To support dynamic resolution changes:
Enable DirectX mode
Make sure the required components are installed. See Direct3D Rendering.
Enable Dynamic Resolution Monitoring
Set the Width and Height to define the maximum expected resolution of the video stream.
m_KlvPlayer.MaxCapturedVideoResolution = new VideoResolutionWr()
{
Width = 1920,
Height = 1080
};
Note:
You don't need to set the exact resolution. However, these values affect memory allocation.
It's best to avoid setting values much higher than expected to prevent unnecessary resource usage.
Set m_KlvPlayer.VideoPresenter().UseDirectX to true.
Set m_KlvPlayer.VideoCaptureMode.uncompressedVideo to either UncompressedVideoMode_Yuv or UncompressedVideoMode_Rgb, even if uncompressed video is not required.
There is no significant performance impact, as the video will be decoded regardless.
Explanation:
The demuxer detects SPS information only once at stream startup. If the resolution changes during runtime, it is detected and handled by the decoder filter.
If the callback is subscribed to compressed video, it receives resolution information from the demuxer, which remains fixed.
If the callback is subscribed to uncompressed video (any type), the video information comes from the decoder, ensuring the resolution is accurate.
Latest frame's resolution and aspect ratio can be found in OnNotifySyncFrame callback - it will receive the relevant info