Friday, December 14, 2007

How to change frame rate using the Transform Filter ? Is it Possible ?

How to change frame rate using the Transform Filter ? Is it Possible ?

yes it is possible.

Within FillBuffer() of the Source Filter we will Set the Frame rate ..
Just refer the PushSourceDesktop Filters. There we set the frame rate dynamically.

So it is also possible to change the frame rate thru transform filter.
We need to Set the Output Media Sample's StartTime and EndTime properly to achieve the specified frame rate.


This is what I Read :
----------------------

Hi, I think you must be more precise in describing what you want to achieve. Do you actually mean : display only about half of the frames, in half of the original clip duration, resulting in fact in a 100% speed up of the clip? Or something else?

As you are using EZRGB24, there are two things you can do easily :

1) you can skip a frame by returning S_FALSE in the transform function. Add in_framecount and out_framecount as members of the Filter.

HRESULT CEZrgb24::Transform(IMediaSample *pIn, IMediaSample *pOut){

in_frameount++; // we count all incoming samples

if (somefunction of in_framecount) { return S_FALSE}; // skip if somefunction is true

out_framecount++; // here we count only actually outgoing samples

// now we process the samples

HRESULT hr = copy(pIn, pOut);

......

}

2) you can adjust the sample times by setting the pOut samples start and stop times. In fact, if you skip samples, then you must retime all samples afterwards to make sure they are correctly timestamped for display by the renderer. You should do this in the same transform function after callling the copy function. Use the out_framecount to compute the start and stop times, and set them on the pOut sample using pOut->SetTime();

Typically, you should have :

tStart = out_counter * frameduration; tStop = tStart + frameduration;

You can speed up the display by reducing frameduration.

No comments: