我想用dsPack在视频上叠加滚动字幕。
在Mixer例子中用到的FilterGraph.RenderFile,可在视频上叠加一个gif或者另一个视频文件,强!不知道还可以叠加其他什么文件?
另外,在VMRBitmap例子中用到的Filter.BaseFilter.Moniker,可以在视频上叠加一个bmp图片,或者把文字画成bmp叠加上去,我想做一个滚动的字幕,就用了一个Timer,定时重画,然而出来一帧过后,后面的图片就不出来了,请教大虾们如何解决该问题。
或是有其它什么办法,在视频上叠加上滚动字幕呢?谢谢!
在Mixer例子中用到的FilterGraph.RenderFile,可在视频上叠加一个gif或者另一个视频文件,强!不知道还可以叠加其他什么文件?
另外,在VMRBitmap例子中用到的Filter.BaseFilter.Moniker,可以在视频上叠加一个bmp图片,或者把文字画成bmp叠加上去,我想做一个滚动的字幕,就用了一个Timer,定时重画,然而出来一帧过后,后面的图片就不出来了,请教大虾们如何解决该问题。
或是有其它什么办法,在视频上叠加上滚动字幕呢?谢谢!
解决方案 »
- 如何让一个edit显示数据库中查询到的内容
- 看看这段代码错在哪?delphi中的SQL语句。
- delphi2005IDE中如何使新建窗体默认为宋体,9?
- 初学delphi
- 请问如何将stringgrid中的内容按表格形式保存下来?
- 怎么获得delphi的源程序 在线等!立即给分!
- 简单问题请朋友们来帮帮忙。谢谢。
- 郁闷了一上午 : 为什么我的table+datesource+dbgrid只能显示一列,而且没有记录
- 100分求助!delphi安装失败??
- 请问如何把数据库的某个字段读进列表?
- 在DLL中调用另外一个DLL的函数,传递一个PChar字符串,执行完毕后程序报错。附上源码
- 如何对数组进行处理!!!
Form1 : TForm1;
OffsetX : Integer; //by s.f.
const
ShowText : string = '字幕啊字幕啊字幕啊字幕啊字幕啊'; //by s.f.
implementation{$R *.dfm}procedure TForm1.OpenPlayClick(Sender: TObject);
begin
if OpenDialog.Execute then
begin
OffsetX := Image.Width; //by s.f. FilterGraph.Mode := gmCapture;
FilterGraph.Active := False;
FilterGraph.Active := true; FilterGraph.RenderFile(OpenDialog.FileName);
FilterGraph.Play; end;
end;procedure TForm1.VMRTextOut(AText: string);
var
VMRBitmap : TVMRBitmap;
begin
if AText = '' then
exit;end;procedure TForm1.SnapshotClick(Sender: TObject);
begin
SampleGrabber.GetBitmap(Image.Picture.Bitmap)
end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
CallBack.Checked := false;
FilterGraph.ClearGraph;
FilterGraph.Active := false;
end;procedure TForm1.SampleGrabberBuffer(sender: TObject; SampleTime: Double;
pBuffer: Pointer; BufferLen: Integer);
var
textLength : integer; //by s.f.
begin
if CallBack.Checked then
begin
Image.Canvas.Lock; // to avoid flickering
try
SampleGrabber.GetBitmap(Image.Picture.Bitmap, pBuffer, BufferLen);
//draw my text.by s.f.
textLength := Image.Picture.Bitmap.Canvas.TextWidth(ShowText);
if (OffsetX + textLength) > 0 then
begin
Image.Picture.Bitmap.Canvas.Brush.Style := bsClear;
Image.Picture.Bitmap.Canvas.Font.Color := clRed;
Image.Picture.Bitmap.Canvas.TextOut(OffsetX, 10, ShowText);
Dec(OffsetX, 1);
end; finally
Image.Canvas.Unlock;
end;
end;
end;
原理再容易不过了,因为CallBack后,可以直接绘制视频到canvas上,这样可以对这个canvas进行操作,你加什么东西都行。