Skip to main content

Draw text overlay using the OnVideoFrameBuffer event

Products: Video Capture SDK .Net, Video Edit SDK .Net, Media Player SDK .Net

Sample code

If video effect API to draw text overlay is not enough, you can draw overlay manually in OnVideoFrameBuffer, using ImageHelper API.

        private void SDK_OnVideoFrameBuffer(object sender, VideoFrameBufferEventArgs e)
{
if (!logoInitiated)
{
logoInitiated = true;

InitTextLogo();
}

FastImageProcessing.AddTextLogo(null, e.Frame.Data, e.Frame.Width, e.Frame.Height, ref textLogo, e.Timestamp, 0);
}

private bool logoInitiated = false;

private VideoEffectTextLogo textLogo = null;

private void InitTextLogo()
{
textLogo = new VideoEffectTextLogo(true);
textLogo.Text = "Hello world!";
textLogo.Left = 50;
textLogo.Top = 50;
}

Required redists

  • SDK redist

Visit our GitHub page to get more code samples.