Click here to Skip to main content
13,003,102 members (57,322 online)
Click here to Skip to main content
Add your own
alternative version


51 bookmarked
Posted 26 Sep 2006

Ticker ( Showing or Scrolling Text Over Running Video )

, 26 Sep 2006
Rate this:
Please Sign up or sign in to vote.
This article tells how you can show your text over video, change text, text color, text background color and its transparency.
Sample Image - Ticker.jpg


Showing something over running video? You can see my previous article to show an image over video. But this time, I am going to do some more artwork or text work over running video.


Displaying text over video? This project has some similarities with my previous project, but it is not much similar. Here the text also scrolls over video.


It is a prerequisite to read my article which displays image over video. This is because in that article, I have explained everything which is required to display an image over video, and displaying the text is not much different. So here in this article, I will just stick to the working code which is needed to display text over video.

Prepare the Ground with IVMRMixerControl9

First of all we need to set some preferences for mixing. Because the default mixing preferences are not good for blending the text over video, in the code below I am doing the same:

// Request point filtering (instead of bilinear filtering)
// to improve the text quality. In general, if you are
// not scaling the app Image, you should use point filtering.
// This is very important if you are doing source color keying.
pVmr->QueryInterface(IID_IVMRMixerControl9, (void**)&pMix);
DWORD dwPrefs=0;
dwPrefs |= MixerPref_PointFiltering;
dwPrefs &= ~(MixerPref_BiLinearFiltering);

Preparing the Image From Text

Now we need to make the image having the text we want to show over video.

CDC * pdc = GetDC(); 
CDC mCompatibleDC;
CSize strSize = mCompatibleDC.GetTextExtent(strFinish);
CBitmap bm;

Showing the Text Over Video

Now we will prepare for showing the image with text over video.

VMR9AlphaBitmap bmpInfo;
ZeroMemory(&bmpInfo, sizeof(bmpInfo) );
bmpInfo.dwFlags |= VMRBITMAP_HDC;
bmpInfo.hdc = pDC->m_hDC;
LONG cx, cy;
pWC->GetNativeVideoSize(&cx, &cy, NULL, NULL);
bmpInfo.rSrc = Rect;
// rDest specifies the destination rectangle in composition space (0.0f to 1.0f)
bmpInfo.rDest.right = 1.0f;
bmpInfo.rDest.left = 0.0f; = (float)(cy - Rect.Height()) / (float)cy - EDGE_BUFFER;
bmpInfo.rDest.bottom = 1.0f - EDGE_BUFFER;
// Set the transparency value (1.0 is opaque, 0.0 is transparent).
bmpInfo.fAlpha = 1.0;

All is done. Now you can blend any text over video.

More Info

If you are interested in more information, see my blog.


  • 26 Sep 2006 First version


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

tanvon malik
Pakistan Pakistan
tanvon malik ( real name Tanveer Ahmad )I am a CNC Programmer, cnc setter, cnc operator. want to know about me visit my websites.
CNC Programming
CNC Manuals
Auto Owners Repair & Service Manuals

I been in Switzerland MAG former +FMS+ for CNC training.

Most interesting technologies I like COM MFC DirectShow such as filter development. I am from Pakistan.
Have worked on projects mostly related video capturing, video data processing and real time object tracking on videos. For these I have worked on projects which use "Open CV Library". Which is mostly used for capturing data and its processing.

You may also be interested in...

Comments and Discussions

QuestionMy voite is 1 Pin
Greg_moon28-Jul-12 22:15
memberGreg_moon28-Jul-12 22:15 
QuestionCan i get same project in C# [modified] Pin
Member 435287523-Sep-10 2:43
memberMember 435287523-Sep-10 2:43 
GeneralDownload problem Pin
Member 461091624-Feb-10 21:16
memberMember 461091624-Feb-10 21:16 
QuestionOverlay text in External Video Renders Pin
kannan1237-Mar-09 6:27
memberkannan1237-Mar-09 6:27 
Generalfixed size text display on video Pin
yorawat12-Jan-09 22:15
memberyorawat12-Jan-09 22:15 
QuestionWhat if the source is not a video file. Pin
Taran930-Sep-08 21:32
memberTaran930-Sep-08 21:32 
Questionhow to overlay multiple text on video Pin
mythili29-May-08 2:00
membermythili29-May-08 2:00 
AnswerRe: how to overlay multiple text on video Pin
Member 34640464-Jun-08 0:45
memberMember 34640464-Jun-08 0:45 
GeneralRe: how to overlay multiple text on video Pin
mythili9-Jun-08 18:34
membermythili9-Jun-08 18:34 
GeneralRe: how to overlay multiple text on video Pin
mythili11-Jun-08 3:45
membermythili11-Jun-08 3:45 
Generalerror in creating vmr filter Pin
san07618-Mar-08 19:09
membersan07618-Mar-08 19:09 
Questionhow can I use "CLSID_VideoMixingRenderer9" in smart device project. Pin
Suman Kumar Sikdar9-Apr-07 19:33
memberSuman Kumar Sikdar9-Apr-07 19:33 
QuestionC# Pin
Mario_F13-Dec-06 12:43
memberMario_F13-Dec-06 12:43 
AnswerRe: C# Pin
ieremix9-Jan-07 10:03
memberieremix9-Jan-07 10:03 
GeneralDoesn't Compile in Visual C++ Express 2005 Pin
reginaldStjohn13-Dec-06 6:28
memberreginaldStjohn13-Dec-06 6:28 
GeneralRe: Doesn't Compile in Visual C++ Express 2005 Pin
tanvon malik6-Sep-08 22:14
membertanvon malik6-Sep-08 22:14 
Generalthanks Pin
shital_harode@rediffmail.com31-Oct-06 22:15
membershital_harode@rediffmail.com31-Oct-06 22:15 
GeneralRe: thanks Pin
tanvon malik6-Sep-08 21:53
membertanvon malik6-Sep-08 21:53 
Generaltext over video Pin
shital_harode@rediffmail.com30-Oct-06 22:44
membershital_harode@rediffmail.com30-Oct-06 22:44 
GeneralRe: text over video Pin
tanvon31-Oct-06 2:17
membertanvon31-Oct-06 2:17 
GeneralRe: text over video Pin
JaneYan6-Feb-07 15:22
memberJaneYan6-Feb-07 15:22 
GeneralRe: text over video Pin
tanvon malik6-Sep-08 22:13
membertanvon malik6-Sep-08 22:13 
GeneralYou might want to reload your demo project Pin
fwsouthern27-Sep-06 9:39
memberfwsouthern27-Sep-06 9:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170626.1 | Last Updated 26 Sep 2006
Article Copyright 2006 by tanvon malik
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid