二次编码技巧

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wangjian1012/article/details/51173402

http://way.nuptzj.cn/php/index.txt


通过二次url编码

id=%2568ackerDJ 

阅读更多
换一批

关于wmv 二次编码的问题

12-28

我现在需要构建一个GRAPH来导出wmv文件,是这样构建的。rnHRESULT CreateGraph()rnrn CoInitialize(NULL);rn IGraphBuilder* pGraphBuilder=NULL;rn HRESULT hr = CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraphBuilder);rn if ( FAILED(hr) )rn rn return hr;rn rnrnrn IPin* pAudioPin = NULL;rn IPin* pVideoPin = NULL;rnrn hr = CoCreateInstance(CLSID_WMAsfWriter,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter,reinterpret_cast(&pWriterFilter));rn if (FAILED(hr))rn rn return hr;rn rnrn hr = pGraphBuilder->AddFilter(pWriterFilter,L"Writer filter");rn if ( FAILED(hr) )rn rn return hr;rn rnrn DWORD dwReg = 100;rn AddToRot(pGraphBuilder,&dwReg);rn IConfigAsfWriter2* pConfig = NULL;rnrn hr = pWriterFilter->QueryInterface(IID_IConfigAsfWriter2,(void**)&pConfig);rnrn IWMProfile * pProfile = NULL;rnrn hr = LoadCustomProfile(L"D:\\1.prx",&pProfile);rn hr = pConfig->ConfigureFilterUsingProfile(pProfile);rnrn hr = pConfig->SetParam(AM_CONFIGASFWRITER_PARAM_MULTIPASS,true,0);rnrn IFileSinkFilter2* pFileSink = NULL;rn hr = pWriterFilter->QueryInterface(IID_IFileSinkFilter,(void**)&pFileSink);rn hr = pFileSink->SetFileName(L"C:\\1.wmv",NULL);rnrnrn pAudioPin = GetPin(pWriterFilter,PINDIR_INPUT,MEDIATYPE_Audio);rnrn pVideoPin = GetPin(pWriterFilter,PINDIR_INPUT,MEDIATYPE_Video);rnrnrn IBaseFilter* pSourceFilter = NULL;rn hr = pGraphBuilder->AddSourceFilter(L"G:\\我的文档\\照片\\DSC00163.JPG",L"SourceFilter",&pSourceFilter);rn rn if (FAILED(hr))rn rn return hr;rn rnrn IBaseFilter* pAudioFilter = NULL;rn hr = pGraphBuilder->AddSourceFilter(L"C:\\Documents and Settings\\All Users\\Documents\\My Music\\示例音乐\\New Stories (Highway Blues).wma",L"SourceFilter",&pAudioFilter);rn IPin* pSourceVideoPin = NULL;rn IPin* pSourceAudioPin = NULL;rn pSourceVideoPin = GetPin(pSourceFilter,PINDIR_OUTPUT,MEDIATYPE_Video);rn pSourceAudioPin = GetPin(pAudioFilter,PINDIR_OUTPUT,MEDIATYPE_Audio);rnrn hr = pGraphBuilder->Connect(pSourceAudioPin,pAudioPin);rnrnrn hr = pGraphBuilder->Connect(pSourceVideoPin,pVideoPin);rnrnrn pGraphBuilder->QueryInterface(IID_IMediaSeeking,(void**)&g_pSeek);rnrn IMediaControl* pControl = NULL;rn hr = pGraphBuilder->QueryInterface(IID_IMediaControl,reinterpret_cast(&pControl));rn if ( FAILED(hr) )rn rn return hr;rn rnrn hr = pControl->Run();rnrn WaitForCompletion(pGraphBuilder);rnrnrn pControl->Stop();rnrnrn LONGLONG lDuration;rn hr = g_pSeek->GetDuration(&lDuration);rn LONGLONG lCurrent = 0;rn g_pSeek->SetPositions(&lCurrent,AM_SEEKING_AbsolutePositioning,&lDuration,AM_SEEKING_AbsolutePositioning);rnrn pControl->Run();rn WaitForCompletion(pGraphBuilder);rn pControl->Stop();rnrnrn return hr;rnrn这样虽然run成功了,但CPU占用95%以上,且迟迟不返回预处理结束的消息,如果我不设这个AM_CONFIGASFWRITER_PARAM_MULTIPASS的话,是一点问题都没有的。rn还有如果源是单单一个媒体文件的话,整个GRAPH都是可以运行的,且输出也正常。陆老师在吗,麻烦帮帮忙看一下。

没有更多推荐了,返回首页