Click to See Complete Forum and Search --> : Time Stamping the Captured Video


akgalp
June 5th, 2005, 07:58 AM
Hello Gurus

I'm capturing video from a tv-tuner card using directshow and saving to the disk in compressed format , but i would like to time stamp the video during capturing , so that the time of the frame is displayed in the video.

Any help will be greatly appreciated.

Thanks in advance
Akg

darwen
June 5th, 2005, 09:18 AM
You'll have to use C++ for this one. You need to insert a sample grabber filter into the filter chain before the file writer. You can then use this to overlay a timestamp onto the video as it passes through the filter graph.

Microsoft doesn't recommend this method of writing to the video, but I've used it successfully many times.

It is possible to use the platform invoke methods in .NET to interact directly with DirectShow - however this is pretty difficult and requires a great deal of indepth knowledge of how the marshalling works.

I've written an article on interaction with IUnknown-based interfaces here :

http://www.codeguru.com/Csharp/Csharp/cs_misc/com/article.php/c9065/

Darwen.

akgalp
June 5th, 2005, 08:40 PM
Thanks darwen for the replay

I was using the DirectX video capture component that i found at codeproject to capture the video. Now with that library can i make the time stamp?

pls visit http://www.codeproject.com/cs/media/directxcapture.asp

Regards
Akg

Deniz
June 5th, 2005, 09:51 PM
Microsoft doesn't recommend this method of writing to the video, but I've used it successfully many times.



I've used proprietry (did I spell that right?) methods basically based on what you've said above before without a problem.

Why does M$ not recommend this?

darwen
June 6th, 2005, 12:53 AM
I don't know really - it just says in the SetCallbackCB method that it's not recommended you change the samples as they come through.

I must admit this method is infinitely easier than the alternative : that of writing your own filter (yeuch !).

Darwen.

Deniz
June 6th, 2005, 02:24 AM
I must admit this method is infinitely easier than the alternative : that of writing your own filter (yeuch !).


That's what I did. :lol:

akgalp
June 6th, 2005, 08:45 PM
Thanks for the replays

i didn't found SetCallbackCB , in MSDN :-(

is the method "ISampleGrabber::SetCallback" ? or some thing else
a sample code/reference would be helpful

Regards
Akg

darwen
June 6th, 2005, 10:56 PM
Yep that's the one. And there's samples in the DirectShow SDK (part of the DirectX9 SDK).

Darwen.