How to achieve video capture with low latency
1. Introduction of low latency capture
- All Pro Capture family capture devices can support low latency capture, while USB Capture Family and First Generation products cannot;
- Capture delays: the time needed for the signal to be fully input and transmitted to the target memory;
- Total delays: the period during which one frame image signal starts to be inputted, until the image is transmitted to the target memory;
- Low latency capture mode: signal input and video transmission are processed simultaneously. Reduce capture latency to largely reduce the time needed for a full frame of image to be captured;
2. The methods of using MWCapture SDK to realize low latency capture
MWOpenChannel() → CreateEvent() → MWRegisterNotify() → MWStartVideoCapture() → WaitForSingleObject() →MWGetNotifyStatus() → MWCaptureVideoFrameToVirtualAddressEx() → WaitForSingleObject() → MWGetVideoCaptureStatus()
Compared with regular capture mode, there are some differences as follows
1. users can only capture according to input frame rate.
2. When MWRegisterNotify() is used to register event notification object, notification mode mask should be MWCAP_NOTIFY_VIDEO_FRAME_BUFFERING. It means when input frames start to buffer to onboard memory, system is notified to capture video data.
3. For iFrame (number of video frames )from MWCaptureVideoFrameToVirtualAddressEx(), choose iNewestBuffering from MWCAP_VIDEO_BUFFER_INFO. It means that it will capture the serial number of frame which is buffering. At the same time, set cyParitalNotify as value 64 / 128 / 256 and etc., meaning once corresponding video lines are buffered to the onboard memory, it can start DMA transmission.
4. In the regular mode, after one frame DMA transmission is done, executing WaitForSingleObject() will inform the status change. While with low latency mode, when line data DMA transmission is done, cyPartialNotify will inform the status change and WaitForSingleObject() monitors the event response. Therefore, only when the value of bFrameCompleted from MWGetVideoCaptureStatus() is TRUE, one frame data has finished DMA transmission.
In all, by means of low latency mode, capture cards capture partial line data and start to DMA transmit to the target memory, which helps to reduce capture latency. At the same time, with the use of Partial Notification mode, it allows application to process this part of data in time. This mode makes signal input, data transmission, and data process happen simultaneously, which will achieve minimum delay.
Examples\Applications\LowLatency contains a demo for low latency capture.