Media SDK and DirectShow Editing Services

Media SDK and DirectShow Editing Services

I'm tasked with developing a video editing application, similar to Microsoft MovieMaker, i.e mutliple source images/movies, transitions, trimming, background music, etc. The only API that I know of to do this is DirectShow Editing Services (DES), a DirectShow API that handles most of the editing details. I also need h264 support, hence my interest in the Intel Media SDK.

My understanding is that DES will only take RGB input and it's output is RGB so in order to use it with the Intel codecs I need to convert from NV12 to RGB. I wrote a NV12 to RGB converter to go from the Intel decoder to DES and I am able to preview my "timeline" images OK. But if I want to encode, I need to write an RGB to NV12 converter and then connect to the Intel h264 encoder. I'm having a lot of trouble with that. I can connect my NV12 to RGB filter to the Intel h264 encoder, but that's as far as I go. I can't run it.

First of all, is there any reason why, in principle, what I am trying to do will not work?

Some specifics, I get an error in CEncVideoFilter::DecideBufferSize where the call to

sts = pEnc->GetVideoParam(&par);

returns MFX_ERR_NOT_INITIALIZED. At the moment I can't figure out why it wouldn't be initialized and I'm not sure this is critical because DecideBufferSize does return successfully ( but the sample code does not get this error).

Ultimately I fail altogether in the CEncVideoFilter::Receive call with the same sort of problem

sts = m_pEncoder->Init(&m_mfxParamsVideo, &m_mfxParamsVPP, this);


I'm digging through the sample code trying to figure out the difference, but I can't seem to pinpoint it.

I'm really more concerned with whether I am wasting my time even trying this than the details above. Although if anyone has any ideas on the details, that would be great.


10 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers eric-sardella (Intel)


That function also requires a valid mfxsession. Have verified that the session has been init'ed?
You can also make sure the implementation dll's are in your system path. Are these the only SDK functions that are failing? I dont see any reason - in principle - why what your trying to do would not work. If you can't get it, post the input params.



Ok, I think the session is the problem, but what do I need to do? Isn't the session created when the filter gets instanciated? I'm using the dshowplayer sample as a guide, how does it insure a valid session? Is there some sort of init call I need?

The implementation dlls are there (libmfxhw32.dll and libmfxsw32.dll) so I don't think that is the problem.

One other thing I have noticed is that the CEncVideoFilter::CompleteConnect call fails for both the dshowplayer sample and my app. The line

CComQIPtr mfxalloc(alloc);

returns a NULL pointer. The call still succeeds but this doesn't seem right to me.

In any case, thanks for the info.


Bild des Benutzers eric-sardella (Intel)

The session is created in the CBaseEncoder::SetAcceleration call which is invoked during the initialization of the filter.

The DShowPlayer application is just a higher level application thats just building a filter graph with the encoder filter being instantiated if you choose to do a transcode.

Try this:

Go to the Samples\PlugIns\DShow Samples (the filters) and build the h264_enc_Filter project.

Register the output: Regsvr32 h264_enc_filter.dll (it will be in the _build dir use admin rights).

Launch The DShowPlayer,

Go back to Visual Studio, set a break point on the constructor CH264EncVideoFilter::CH264EncVideoFilter(). Then goto Debug->Attach to Process. Select the Dshow Process. The debugger should attach.

Go back to the DirectShow Player, start a transcode when the Encoder is instantiated your breakpoint should trigger. At that point you can step into the base class constructor and see whats failing.

It sounds like the m_pmfxENC pointer is invalid, which could cause all kinds of downstream errors to happen.


I am able to step through the code with the debugger.

The dshowfilter example works fine for me but my sample fails in the CBaseEncoder::InternalReset call around line 301.

sts = m_pmfxENC->Init(&InitParams); ///this is where I get -15, MFX_ERR_INVALID_VIDEO_PARAM

There seems to be something wrong with my input parameters, but this is a large structure and I haven't been able to pinpoint the problem. Even with being able to compare to the dshowsample debugger as a guide.

I'm trying to connect my RGB to NV12 converter filter up to the encoder. I can connect it, but when I try to run it, I get this error.

This strucure is pretty large. Do you know of any part of it that would be the likely problem spot so I could narrow it down a little.

Don Winters

Bild des Benutzers eric-sardella (Intel)

These are required for Encoder Initialization:


  • IOPattern


  • CodecID
  • TargetKBS
  • EncodedOrder


  • FourCC
  • Width
  • Height
  • CropX
  • CropY
  • CropW
  • CropH
  • FrameRateExtN
  • FrameRateExtD
  • ChromaFormat

I zero'ed out a few of them in the debugger and constantly received -15 back from the call.
Hope this helps


Ok, thanks. I guess I have some work to do. I have several of these coming up empty.

TargetKBS, FrameRateExtN, FrameRateExtD, EncodedOrder are all zero.

I notice that some values are getting set initially from the registry and then get wiped out somewhere. I'll keep digging.



I have quite the same problem. The AVC Encoder cannot connect because
m_mfxVideoSession.Init(impl, &version);
returns '-3'

I got down to
return MFXInit(impl, ver, &m_session); (mfxvideo++.h line 25), but MFXInit seems to be in dll (?) and I can only see the return value is -3.

Don, if you found your problem please give some advices!

P.S. I use initial Media SDK 2.0 Gold sample, build it, copy libmfxsw32.dll to the filter's folder, but it seems I don't have libmfxhw32.dll. So I don't know where the problem may be!
Please help!

P.S.2 Ok, the return value is -3 which is MFX_ERR_UNSUPPORTED
impl is set to MFX_IMPL_AUTO, version is 1.1.65537 (major, minor,version)
What may be wrong here?

Bild des Benutzers eric-sardella (Intel)


What platform is this occurring on?

MFXInit with version = 1.1 means to load the Sandy Bridge library. Are you using a Sandy Bridge platform? The HW lib is installed via the graphics driver install. If you are not using a Sandy Bridge platform, change the version to 1.0. If that still doesnt work, try updating your graphics driver.

Best Reply

Hi Eric,

I have this problem solved in another thread:

Thanks for your response.

Melden Sie sich an, um einen Kommentar zu hinterlassen.