C++ Adob​​e Premiere 视频过滤器 - 在输出视频帧中打印/绘制/渲染文本

标签 c++ plugins adobe video-processing adobe-premiere

我想为 Adob​​e Premiere 编写视频滤镜,我需要将一些文本打印/绘制/渲染到输出视频帧中。

调查adobe premiere cs4 sdk我无法快速找到答案 - 可能吗?

请提供一些 sample !

谢谢!

最佳答案

我将尝试实现的一些策略:

  1. 使用 GDI 将文本绘制到帧大小的位图中 (VideoHandle->piSuites->ppixFuncs->ppixGetBounds)
  2. 将帧像素(VideoHandle->source)与位图像素重叠

更新 alt text http://img413.imageshack.us/img413/6201/adobe.jpg 工作示例,使用来自 SDK 的 Simple_Video_Filter 示例...

在 xFilter(短选择器、VideoHandle theData)函数的开头用文本创建位图:

TCHAR szBuffer[50] = {0};
RECT rect;
HDC hdc = GetDC(NULL);
int iLength = 0;
iLength = wsprintf(szBuffer, "Hello World!");
BITMAPINFO bmInfo;
memset(&bmInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
bmInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
bmInfo.bmiHeader.biWidth=100;
bmInfo.bmiHeader.biHeight=15;
bmInfo.bmiHeader.biPlanes=1;
bmInfo.bmiHeader.biBitCount = 32;
bmInfo.bmiHeader.biCompression = BI_RGB;
//create a temporary dc in memory.
HDC pDC = GetDC(0);
HDC TmpDC=CreateCompatibleDC(pDC);
//create a new bitmap and select it in the memory dc
BYTE *pbase;
HBITMAP TmpBmp=CreateDIBSection(pDC, &bmInfo,DIB_RGB_COLORS,(void**)&pbase,0,0);
HGDIOBJ TmpObj=SelectObject(TmpDC,TmpBmp);
SetRect(&rect, 0, 0, 100, 15);
DrawText(TmpDC, szBuffer, iLength, &rect, 32);

在设置过滤器的中间,而不是

redSource = (redSource + redAdd) & 0x000000ff;
greenSource = (greenSource + greenAdd) & 0x000000ff;
blueSource = (blueSource + blueAdd) & 0x000000ff;

使用

int x = vert;
int y = horiz;
if(x < 215 && y < 300)
{
    COLORREF c = GetPixel(TmpDC,y-200, 215 - x);
    if(0 == ((int)GetRValue(c)+(int)GetGValue(c)+(int)GetBValue(c)))
    {
        redSource =255;
        greenSource =255;
        blueSource =255;
    }
}

在函数clean memory的最后

SelectObject(TmpDC,TmpObj);
DeleteDC(TmpDC);

PS [总有一天 :)] 需要将位图存储在内存中一次,而不是每帧每次都创建......

关于C++ Adob​​e Premiere 视频过滤器 - 在输出视频帧中打印/绘制/渲染文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2513403/

相关文章:

android - 如何在安卓模拟器中安装adobe air

c++ - 如何在C++中定义数组的数组

codehaus 终止后的 Maven 文档?

eclipse - 无法添加启动快捷方式(Eclipse 插件)

user-interface - 如何增加触摸用户界面,adobe cq5 中的对话框大小?

adobe - 如何获取在我的 ios 应用程序中使用 Aviary SDK 的 api key

C++ 数值库:std::uniform_int_distribution<>,更改调用之间的分布范围

c++ - 是否可以将 nginx 嵌入到 C/C++ 应用程序中

c++ - 通过地址获取变量名

php - 自定义 WordPress 页面(使用插件)