CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2004
    Posts
    1

    A question about DirectShow

    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

  2. #2
    Join Date
    Nov 2004
    Location
    Virginia, The lovers' state
    Posts
    64

    Re: A question about DirectShow

    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/de...derengines.asp

  3. #3
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: A question about DirectShow

    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.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  4. #4
    Join Date
    Nov 2004
    Location
    Virginia, The lovers' state
    Posts
    64

    Re: A question about DirectShow

    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

  5. #5
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: A question about DirectShow

    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.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  6. #6
    Join Date
    Nov 2005
    Location
    NC, USA
    Posts
    99

    Re: A question about DirectShow

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured