Deniz Koçak
2012-Nov-01 09:28 UTC
[theora-dev] DirectShow PushSource with theora encoder and Ogg muxer filters
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. Cheers, Deniz ** 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/
Cristian Adam
2012-Nov-01 18:49 UTC
[theora-dev] DirectShow PushSource with theora encoder and Ogg muxer filters
Hi, Have a look at the VideoTestSource filter here: http://blogs.msdn.com/b/mikewasson/archive/2008/04/21/video-test-source-filter.aspx I've tested PAL and NTSC with Theora Encoder and everything looked fine with the generated video. I would suggest having a look at your media sample SetTime() parameters. Cheers, Cristian. On 01.11.2012 10:28, Deniz Ko?ak wrote:> 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. > > Cheers, > Deniz > > > ** 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/ > _______________________________________________ > theora-dev mailing list > theora-dev at xiph.org > http://lists.xiph.org/mailman/listinfo/theora-dev