I am looking at updating a program that currently uses DirectShow for video capture. While DirectShow seems to work well, I was wondering if there were any more powerful or up to date SDKs or APIs that I should look into. Some features that would be helpful would be ones that will:
- Provide a consistent framerate (33ms between frames for NTSC) during capture.
- Work with DirectShow compatible capture devices.
- Not require an extra license to be installed on the customer's PC.
- Allow for simultaneous preview and hardware encoding of video.
- Be able to be integrated into a C++/MFC application.
I've looked into LeadTools Multimedia Capture SDK and VisioForge Capture SDK and Microsoft Media Foundation, but just wanted to know what others have used successfully before I invest time or money into one of these alternatives. I don't care if this is a commercial or open source product.
EDIT: While I appreciate the attempts to solve my particular problem, this question was supposed to be about alternatives to DirectShow. So, I removed all of the references to my specific problem. Solving that will need to wait for another question.
VideoLan may be an option for you.
The problem might just be the method you are using for timing. Are you using the high performance timer API?
Quite all capture boards come with their own timers.
You may try to query you source filter for
IReferenceClock
and use its own timer that is usually more accurate than a PC's one.If you use
ISampleGrabber
then the callback function is called microseconds from the momentReceive
is called on the Sample Grabber's input pin, they're just few lines away in the source code.It seems that your frame source timing is inaccurate (not the timing set in
IMediaSample
, but actial timing the frames are delivered in).What is the source filter that produces the frames?
The DirectShow API is very good, I've never found better on the windows platform. DirectShow has been superseded by Media Foundation, which is Vista (and later) operating systems only.
We'll have to wait for XP to die before people will start mass development using Media Foundation...
May I ask why you're seeking an alternative to DirectShow - it's a very well supported API - well documented on MSDN and there's a very active and friendly forum on MSDN for DirectShow Development.
LeadTools and VisioForge SDKs are just wrappers for DirectShow + some custom filters from them! There is no real alternativ to DirectShow for capturing on a Windows PC. Maybe on Win8 with MediaFoundation? Some Hardware Vendors have there own capture programms, but most of them just use DirectShow.
I think your problem is not DirectShow. How long is your callback working? Because if your doing some analysis on the image, then you need to do this fast. Not the time in your callback is importent, but the presentation time in the mediasample you get! This should be +33ms from the previews sample.
FFmpeg can receive directshow input and manipulate it, and it's free. AviSynth maybe too...