How to overlay caption and logo when capturing video

1. What is OSD

  1. Caption is in fact a series of characters. With GDI+ used, the character can be transformed from characters to bitmap image. It is the same with the logo. The given icon location is directly import to the bitmap image;
  2. In MWCapture SDK, by executing MWUploadImageFromVirtualAddress(), users can upload images from computer memory to onboard memory of capture device, to achieve OSD overlay function;
  3. By executing MWCaptureVideoFrameWithOSDToVirtualAddress() and MWCaptureVideoFrameToVirtualAddressEx(), users can capture the video data with OSD to target memory;

2. Procedure to call OSD

MWOpenChannel() → MWStartVideoCapture()  → MWCreateImage() → MWUploadImageFromVirtualAddress() → MWCaptureVideoFrameWithOSDToVirtualAddress()

In the demo

  1. execute MWCreateImage() and it creates an image according to the size of OSD image, and generates an OSD handle. In all the parameters, width and height of cx, cy cannot be 0.
  2. To execute MWUploadImageFromVirtualAddress(), users need to upload the parameters of width and height of OSD image, also the parameter of rectangular position to the capture device.

When OSD image data is being uploaded, the logo format error will lead to the failure of creating bitmap image, and the failure of OSD in the end.

Examples \ Applications \ OSDPreview contains a demo for OSD.