在顶部绘制带有文字的视频 [英] Drawing video with text on top

查看:179
本文介绍了在顶部绘制带有文字的视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,但有一个我似乎无法找到解决方案的问题.该应用程序是用vc ++编写的.我需要做的是显示YUV视频供稿,并在其顶部显示文字.

I am working on an application and I have a problem I just cant seem to find a solution for. The application is written in vc++. What I need to do is display a YUV video feed with text on top of it.

现在,通过使用GDI在OnPaint方法中绘制文本并在DirectDraw叠加层上播放视频,它可以正常工作.我需要摆脱覆盖层,因为它会导致很多问题.在某些视频卡,Vista,7等上无法使用.

Right now it works correctly by drawing the text in the OnPaint method using GDI and the video on a DirectDraw overlay. I need to get rid of the overlay because it causes to many problems. It wont work on some video cards, vista, 7, etc.

我想不出一种以更兼容的方式完成同一件事的方法.我可以使用带有后缓冲区的DirectDraw绘制视频,然后将其复制到主缓冲区中就可以了.这里的问题是由于刷新视频的次数,在GDI中绘制的文本会闪烁.我真的很想让代码尽可能完整地绘制文本,因为它可以正常工作.

I cant figure out a way to complete the same thing in a more compatible way. I can draw the video using DirectDraw with a back buffer and copy it to the primary buffer just fine. The issue here is that the text being drawn in GDI flashes because of the amount of times the video is refreshed. I would really like to keep the code to draw the text intact if possible since it works well.

有没有一种方法可以将文本直接绘制到DirectDraw缓冲区或内存缓冲区之类的东西,然后将其blt到后备缓冲区?我应该一起考虑另一种方法吗?两个重要的操作系统是XP和7.如果有人有任何想法,请告诉我,我将对其进行测试.谢谢.

Is there a way to draw the text directly to a DirectDraw buffer or memory buffer or something and then blt it to the back buffer? Should I be looking at another method all together? The two important OS's are XP and 7. If anyone has any ideas just let me know and I will test them out. Thanks.

推荐答案

尝试在microsoft.com上查看DirectShow和The Ticker示例:

Try to look into DirectShow and the Ticker sample on microsoft.com:

DirectShow代码示例

此示例使用视频混合渲染器"来混合视频和文本.它使用IVMRMixerBitmap9界面将文本混合到视频窗口的底部.

This sample uses the Video Mixing Renderer to blend video and text. It uses the IVMRMixerBitmap9 interface to blend text onto the bottom portion of the video window.

DirectShow用于构建用于回放音频或视频流的过滤器图形,并添加不同的过滤器以实现不同的效果以及对视频和音频样本的处理.

DirectShow is for building filter graphs for playing back audio or video streams an adding different filters for different effects and manipulation of video and audio samples.

这篇关于在顶部绘制带有文字的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆