Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3977128
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:53:12+00:00 2026-05-20T04:53:12+00:00

I am continuing work on my DirectShow application and am just putting the finishing

  • 0

I am continuing work on my DirectShow application and am just putting the finishing touches on it. What the program is doing is going through a video file in 1 second intervals and capturing from the samplegrabber the current buffer and processing it before moving on. However, I was noticing that I was getting duplicate images in my tests to which I found out that DirectShow has not incremented through the video in that 1 second interval fast enough. My question is if there is a way to check when DirectShow is ready for me to call the samplegrabber to get the current frame and to process it. At the moment I call sleep for 1 second but there has to be a better method. Thank you in advance for the help.

EDIT

I just tried running a check to see if the video’s position is equal to the next position that I would like to grab and process. That decreased the number of duplicate frames but I still see them showing up in chunks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:53:13+00:00Added an answer on May 20, 2026 at 4:53 am

    I always let the DS framework handle the processing rate:
    in the main application thread, configure the sample grabber callback and then when the callback is triggered, you get the media sample as well as sample time: at this point you can process the sample if the appropriate interval i.e. 1 second has elapsed.

    What do you mean you call sleep for a second and from where (which thread) do you call it?
    If you’re doing this from inside the callback you are effectively blocking the DirectShow pipeline? Perhaps if you could explain your setup in more detail I could be more helpful.

    /// Callback that is triggered per media sample
    /// Note this all happens in the DirectShow streaming thread!
    STDMETHODIMP SampleCB( double dSampleTime, IMediaSample * pSample )
    {
      // check timestamp and if one second has elapsed process sample accordingly
      // else do nothing
    
      ...
    
      // Get byte pointer
      BYTE* pbData(NULL);
      HRESULT hr = pSample->GetPointer(&pbData);
      if (FAILED(hr)) 
      {
        return hr;
      }
    
      ...
    }
    

    P.S if you want to process the samples as fast as possible, you can set the sample timestamp to NULL in your callback.

      // set time to NULL to allow for fast rendering since the 
      // the video renderer controls the rendering rate according
      // to the timestamps
      pSample->SetTime(NULL, NULL);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm continuing to work out of an outdated bioinformatics book and I'm attempting to
Continuing adopting my code to work with IE... I have a hidden div containing
Continuing my quest of learning Java by doing a simple game, i stumbled upon
I'm continuing work on a search term suggestion tool using Jquery UI. I am
Okay, so i am continuing to work on my little game engine to teach
Continuing the question in: Keep windows trying to read a file Thanks to accepted
So I've recently been doing a lot of work with Concrete5. I noticed, however,
I was continuing work on my Android tutorial that my teacher gave to me.
In my continuing attempt to understand how pseudo-terminals work, I have written a small
I am continuing my saga to understand memory consumption by VB6 application. The option

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.