Smooth video rate change

AL NAJJAR 1 Reputation point
2020-12-10T18:43:49.1+00:00

Hello,

I am playing a .mp4 video using Media Player in VS2019 using VB (although can easily do it in C#). I want to smoothly increase or decrease the playback rate of the video using the rate attribute like this:

mpPlayer.settings.rate += 0.01 

This works. but there is always a small pause in the video before the speed is changed.

Is there a way of doing this while the video is playing and without interruption?

Windows development | Windows API - Win32
{count} votes

1 answer

Sort by: Most helpful
  1. Strive Sun-MSFT 426 Reputation points
    2020-12-11T02:17:39.89+00:00

    Hello, @AL NAJJAR

    This works. but there is always a small pause in the video before the speed is changed.

    When you calls IMediaSeeking::SetRate method on the Filter Graph Manager, the Filter Graph Manager does the following:

    1. Calls the IMediaSeeking::GetCurrentPosition method. This call returns the current position as calculated by the Filter Graph Manager.
    2. Stops the filter graph (if the graph is paused or running). => Here will be a small pause
    3. Calls the IMediaSeeking::SetPositions method on the filters, with the current position as the start time. This has the effect of resetting the stream time to zero.
    4. Calls the SetRate method on the filters, with the new rate.
    5. Resumes the filter graph, if it was paused or running.

    For more details, please refer : IMediaSeeking::SetRate method

    Is there a way of doing this while the video is playing and without interruption?

    I have no experience with this, but I found this link might help you.
    Thank you!

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.