文本覆盖视频时使用DirectShow和C#记录 [英] Text overlay when video is recording using Directshow and C#

查看:471
本文介绍了文本覆盖视频时使用DirectShow和C#记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过使用DirectShowLib我可以能够通过这里使用ASF writter是代码开始录制

By using DirectShowLib i can able to record the video by using ASF writter here is the code to start recording

 try
        {
            IBaseFilter capFilter = null;
            IBaseFilter asfWriter = null;
            IFileSinkFilter pTmpSink = null;
            ICaptureGraphBuilder2 captureGraph = null;               
            GetVideoDevice();
            if (availableVideoInputDevices.Count > 0)
            {
                //
                //init capture graph
                //
                graphBuilder = (IFilterGraph2)new FilterGraph();
                captureGraph = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
                //
                //sets filter object from graph
                //
                captureGraph.SetFiltergraph(graphBuilder);
                //
                //which device will use graph setting
                //
                graphBuilder.AddSourceFilterForMoniker(AvailableVideoInputDevices.First().Mon, null, AvailableVideoInputDevices.First().Name, out capFilter);
                captureDeviceName = AvailableVideoInputDevices.First().Name;                    
                //
                //check saving path is exsist or not;if not then create
                //
                if (!Directory.Exists(ConstantHelper.RootDirectoryName + "\\Assets\\Video\\"))
                {
                    Directory.CreateDirectory(ConstantHelper.RootDirectoryName + "\\Assets\\Video\\");
                }
                #region WMV                   
                //
                //sets output file name,and file type
                //
                captureGraph.SetOutputFileName(MediaSubType.Asf, ConstantHelper.RootDirectoryName + "\\Assets\\Video\\" + videoFilename + ".wmv", out asfWriter, out pTmpSink);                    
                //
                //configure which video setting is used by graph
                //                
                IConfigAsfWriter lConfig = asfWriter as IConfigAsfWriter;
                Guid asfFilter = new Guid("8C45B4C7-4AEB-4f78-A5EC-88420B9DADEF");
                lConfig.ConfigureFilterUsingProfileGuid(asfFilter);
                #endregion
                //
                //render the stram to output file using graph setting
                //
                captureGraph.RenderStream(null, null, capFilter, null, asfWriter);
                m_mediaCtrl = graphBuilder as IMediaControl;
                m_mediaCtrl.Run();
                isVideoRecordingStarted = true;
                VideoStarted(m_mediaCtrl, null);

现在我想就当视频被重新编码的视频,并添加一个文本重叠使用DirectshowLib是这样的更多钞票?

Now i want to add an text overlay on the video when video is recoding and by using DirectshowLib is this posible?

例如,当视频录制得到启动视频应该得到记录与文字覆盖。

For example when video recording get start video should get recorded with an text overlay.

推荐答案

看DirectShow.Net样品中DMO和DxLogo例子做你寻找什么。但以理Mošmondor的解释可以在DxSnap例如...

Look at the DMO and DxLogo examples in the DirectShow.Net samples to do what your looking for. what Daniel Mošmondor is explaining you can find in the DxSnap example...

http://directshownet.sourceforge.net/

这篇关于文本覆盖视频时使用DirectShow和C#记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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