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 4611672
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:17:57+00:00 2026-05-22T01:17:57+00:00

I am attempting to record an animation (computer graphics, not video) to a WMV

  • 0

I am attempting to record an animation (computer graphics, not video) to a WMV file using DirectShow. The setup is:

  • A Push Source that uses an in-memory bitmap holding the animation frame. Each time FillBuffer() is called, the bitmap’s data is copied over into the sample, and the sample is timestamped with a start time (frame number * frame length) and duration (frame length). The frame rate is set to 10 frames per second in the filter.

  • An ASF Writer filter. I have a custom profile file that sets the video to 10 frames per second. Its a video-only filter, so there’s no audio.

The pins connect, and when the graph is run, a wmv file is created. But…

The problem is it appears DirectShow is pushing data from the Push Source at a rate greater than 10 FPS. So the resultant wmv, while playable and containing the correct animation (as well as reporting the correct FPS), plays the animation back several times too slowly because too many frames were added to the video during recording. That is, a 10 second video at 10 FPS should only have 100 frames, but about 500 are being stuffed into the video, resulting in the video being 50 seconds long.

My initial attempt at a solution was just to slow down the FillBuffer() call by adding a sleep() for 1/10th second. And that indeed does more or less work. But it seems hackish, and I question whether that would work well at higher FPS.

So I’m wondering if there’s a better way to do this. Actually, I’m assuming there’s a better way and I’m just missing it. Or do I just need to smarten up the manner in which FillBuffer() in the Push Source is delayed and use a better timing mechanism?

Any suggestions would be greatly appreciated!

  • 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-22T01:17:58+00:00Added an answer on May 22, 2026 at 1:17 am

    I am doing just the right thing for my recorder application (www.videophill.com) for purposes of testing the whole thing.

    I am using Sleep() method to delay the frames, but am taking great care to ensure that timestamps of the frames are correct. Also, when Sleep()ing from frame to frame, please try to use ‘absolute’ time differences, because Sleep(100) will sleep about 100ms, not exactly 100ms.

    If it won’t work for you, you can always go for IReferenceClock, but I think that’s overkill here.

    So:

    DateTime start=DateTime.Now;
    int frameCounter=0;
    while (wePush)
    {
        FillDataBuffer(...);
        frameCounter++;
        DateTime nextFrameTime=start.AddMilliseconds(frameCounter*100);
        int delay=(nextFrameTime-DateTime.Now).TotalMilliseconds;
        Sleep(delay);
    }
    

    EDIT:

    Keep in mind: IWMWritter is time insensitive as long as you feed it with SAMPLES that are properly time-stamped.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data set that i am attempting to select the first record
I am using hibernate 3 and attempting to delete a record in the database,
I'm (attempting) to write a MySQL stored procedure that parses a large text file.
I am attempting to insert a new record into a table that I know
I'm attempting to write a query that will allow me to get any record
I'm attempting to use context.Database to execute a stored proc that inserts a record
The example I'm hitting is that I'm attempting to update a record in a
I am attempting to update an existing record using JPA. The following link seems
I am attempting to insert a record to MySQL using PDO, my sql statement
I'm attempting to download a file from my QTP script. I want to record

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.