[theora-dev] DirectShow PushSource with theora encoder and Ogg muxer filters

Deniz Koçak lenduha at gmail.com
Thu Nov 1 02:28:03 PDT 2012

Hi all,

I am trying to test DirectShow PushSource example from the SDK with
Theora encoder and Ogg muxer (DirectShow filters of course) by using
GraphEdit tool. My goal is capturing the screen as video by taking
snaphot bitmaps continuosly (what PushSource eaxmple does) and giving
them to the Theora encoder through the DS pipeline (next goal is
transmitting this video **).

My DirectShow graph is like this:

PushSource Filter --> Theora Encoder --> Ogg Muxer

First of all, Theora encoder filter did not accept connecting to the
PushSource filter due to the restriction for the average time per
frame rate in TheoraEncodeInputPin.cpp file [1]. Because by default
CPushPinDesktop::GetMediaType(int iPosition, CMediaType *pmt) method
in PushSourceDesktop.cpp does not assign a value for average time per
frame, I added the line below;

pvi->AvgTimePerFrame        = FPS_10;

FPS_10 is the value I used in m_rtFrameLength(FPS_10) also in the
constructor CPushPinDesktop(HRESULT *phr, CSource *pFilter).

After all, my problem is I tried different values (FPS_10, FPS_20 and
FPS_30) in the code I mentioned above, but the length and quality of
the output videos are not sufficient or even correct. Especially
durations differ between each frame rate (I think there is a linear
relation between the duration of the final video and the FPS_XX
value). When I increase the FPS_XX value, like FPS_30 duration of 10
seconds record (actual time) produces almost 1.5 seconds of video. For
FPS_20 it is 2-3 second and etc. You can find the videos for different
FPS_XX values and oggz-info outputs of each video in the link at the
end of this e-mail [2]. I watched CPU usage and it did not exceed %50
during the execution of the draph. I am not sure why this is happening
and how can I solve this problem. I am quite new to multimedia
concepts and I wonder if you can suggest something. I can give further
information on request, this is all I remember for now.


** PS: I think Remote Desktop applications uses a different approach
to capture and transport screen, but I would like to test and see the
results of capturing the screen as video for now.

[1] 		if (m_averageTimePerFrame == 0)
			// Theora is constant framerate, reject a variable framerate connection.
			return E_FAIL;

[2]  https://ceng.metu.edu.tr/~e1244888/video/

More information about the theora-dev mailing list