Click to See Complete Forum and Search --> : A question about DirectShow
EldonZ
April 4th, 2005, 03:14 AM
I would like to know if the audio part of a movie file could be scanned for a particular frequency tone. I plan on injecting an inaudible tone in to the microphone input of a digital camcorder and need to be able to scan the file for this tone. Once the tone is found, I then need to find the time index of the tone. The movie file will have multiple locations of this tone in the file. The purpose is to allow me to sync the video to some externally recorded data. The program would allow the user to step through the movie file or the recorded data and view them together.
If you have any comments or suggestion on direction or doablility of this, it would be greatly apprectiated.
Thank you,
Eldon Zacek
raghuvamshi
April 4th, 2005, 11:14 AM
Yes, you can certainly do this.
When you use DirectShow to render your video, you just need to create your own rendering filter for the audio part and then add it to the graph explicitly.
If you do not want to use filter graph, you could also directly use DMOs (Directx/show Managed Objects).
I am answering based on my assumption that your question was a "Can we do " question as opposed to "How exactly to do this..." kind of question - if it was the latter, then we may need to dig deeper.
but here is one of the many links that could get you started:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directshow/htm/abouttherenderengines.asp
darwen
April 4th, 2005, 12:38 PM
You can also put a sample grabber filter into the audio chain of the filter graph and set a callback in your app to trap the samples as they're passed through.
Darwen.
raghuvamshi
April 4th, 2005, 02:36 PM
Sure, Yes. I believe you cannot modify the packets through the sample grabber, so ideally you would want to remove your "special" tone from the audio stream after detection - if so, then maybe samplegrabber may not work.
But I think the original poster said his tone was "inaudible", so maybe he can use the sample grabber as you say -
He said it was a audio component in a video stream so I am curious as to which stage in the production is he actually inserting the tone in his audio and how, if at all, he is maintaining synchronization with the video frames....
-Vinayak
darwen
April 4th, 2005, 02:47 PM
Actually you can modify the samples by using the sample grabber. You can set the 'Buffer' mode to off. I know the documentation says that this isn't good practice but I've personally never had a problem with it - just so long as the modifications are extremely quick to make.
In actual fact the sound dictates the synchronisation with the video : you'll see that the reference timer is situated in the sound renderer.
The sound is passed to the sound renderer about a second or two before the synchronised video. Meaning the samples passing through the audio part of the filter chain is always a second or two ahead of the video images.
Darwen.
yooper
December 2nd, 2005, 09:13 AM
Does anyone have a short example of a samplegrabber? I'm trying to incorporate one into my project, but I can't seem to get all of the details straight. Thanks!
Best regards,
Dave
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.