Rudi Grobler

Hi,

I need to create a directshow filter using VS2005 or Orcas. The filter is very basic... I have a video source that I save to file using DirectShow. My client now needs to know frame by frame what the video cameras position (GPS Location) is! I was thinking of creating a DirectShow Filter that basicly sits in the graph and then frame by frame save the frame number to file. I then have a high percision GPS that generate a 5Hz signal that I convert to a state object. On every frame I just serilize the state object and save it to a file with the frame number as a refrence. My video signal is 25fps...

Can anybody point me to some usefull resouces to create a filter like this... All I need is a filter that writes the current frame number to file...

Rudi Grobler

http://dotnet.org.za/rudi



Re: DirectShow Development Creating a DShow Filter using VS2005 or Orcas

Thore Karlsen

You may not even need to make your own filter for this if you want to keep the streams separate. You could insert a sample grabber filter and just write the GPS data along with the frame number from the sample grabber callback.




Re: DirectShow Development Creating a DShow Filter using VS2005 or Orcas

Rudi Grobler

Hi,

Tnx, it worked... I currently connect my source to a smart tree and then I connect the sample grabber to the preview pin and the compressor to the capture pin.

Just one question, will these two always be in sync IE. For every frame that gets saved to the file, will I get a sample callback Or must I connect the sample grabber to the capture pin and the compressor to its output pin

Regards,

Rudi Grobler

http://dotnet.org.za/rudi





Re: DirectShow Development Creating a DShow Filter using VS2005 or Orcas

Thore Karlsen

If you connect the sample grabber to the preview pin you run the risk of not getting callbacks on every sample, since the smart tee drops samples on the preview pin depending on the system load. It is definitely safer to connect it to the capture pin, which will not drop samples.





Re: DirectShow Development Creating a DShow Filter using VS2005 or Orcas

Rudi Grobler

Tnx for all the great help... one more question

I now connected my source's capture pin to the sample grabber and then connected the output pin to the input off the compressor and it all works great

I have 1 problem thou... I set the video format in the property dialog of the source device to PAL_B. I then try and change the frame rate in the stream formats tab but it is disabled! I now start recording... If I check the total amount of frames in my video it corolate with the total amount of frames in my GPS log but if I look at the times it differs! I can see that my video is recorded at 30fps (if I divide the total amount of frames by the frame rate I get time #1) and then I look at my GPS log were I also log the sample time provided by the sample grabber and I get time #2. My problem now is:

time #1 != time #2

both have equal amount of frames...

total frames / 30 = time #1

total frames / 25 = time #2

How can I fix this

Rudi Grobler

http://dotnet.org.za/rudi