I am new in Directshow and C++. I try to capture Video from a Source and encode this with VP8. To accomplish this I'm using the DirectShow-Filters from https://code.google.com/p/webm/downloads/list
My Filtergraph is working and consists of these four filters:
recorder -> WebM VP8 Encoder Filter -> WebM Muxer Filter -> FileWriter
The Problem is, that I need to change the properties from the VP8 Encoder Filter. With GraphEdit I can change for example the Targed Bitrate, but I don't know how to do this programmatically in C++ (I don't want to use the PropertyPage). I also downloaded the source code and found and included the file vp8encoder\\vp8encoderfilter.hpp. This lead to the problem that I needed to include the vp8encoderidl.h file. At first I did not found this file in the soure folder, so I downloaded it from somewhere in the internet. Later I saw the IDL folder containing a vp8encoder.idl file, which I add to my project, compiled it and included the resulting vp8encoder_h.h file. In both cases (with the code from the Internet or from the header file) I can compile my project and record the video. So I tried to get the IVP8Encoder Interface from the DirectShow Filter:
//Instanziate Encoder-Filter
hr = CoCreateInstance(__uuidof(IVP8Encoder), NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&pVideoEncoder);
//Get Interface
IVP8Encoder *iEncoder = NULL;
hr = pVideoEncoder->QueryInterface(__uuidof(IVP8Encoder), (void**)&iEncoder);
The QueryInterface()-method returns E_NOINTERFACE. So I think, that probably the first parameter is not correct, but I don't have an idea which parameter is needed instead.
I appreciate your help and thanks in advance!
You instantiate classes ( CLSID_VP8Encoder
) and classes implement interfaces ( IBaseFilter
, IVP8Encoder
).
Your code should be:
IBaseFilter* pVideoEncoder;
hr = CoCreateInstance(CLSID_VP8Encoder, NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, (void**) &pVideoEncoder);
IVP8Encoder *iEncoder = NULL;
hr = pVideoEncoder->QueryInterface(__uuidof(IVP8Encoder), (void**) &iEncoder);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.