locked
SetRate shows black frame RRS feed

  • Question

  • Hi, all!

    When I IMFPMediaPlayer->SetRate from 2.1 to 2 (Slowdown a bit:forward play) or -2.1 to -2 (reverse play), the video shows some black frames which is very annoying.

    Getting faster from 1 to 128 or 1 to -128 is just fine.
    Slowing down from 128 to 2.1 or 2 to 1,-128 to -2.1 or -2 to 1 is fine, too.

    I guess there is a glitch just after '2'.

    Does anybody have any idea of not showing the black frame?

    I am playing H.264/mp4 on Windows7 professional.

    Best regards.
    Fuyukun
    Tuesday, January 26, 2010 10:12 AM

Answers

  • I did some more experimentation with this, and it looks like what might be happening is that something is triggering a WM_PAINT message at about the same time the rate change in your application.  The EVR repaints the window black if IMFVideoDisplayControl::RepaintVideo is called while it is stopped during the middle of a rate change.  Is there something that might be triggering a WM_PAINT when you switch the rate, and is there a way you could avoid the repaint until the rate change is complete?
    • Marked as answer by fuyukun Wednesday, February 3, 2010 8:32 AM
    Tuesday, February 2, 2010 2:48 AM

All replies

  • Hi,
    I'm also playing with MFPlayer2 on win7 & mp4(H264, full HD).
    In my case, it's good till 2x, usually 60 fps.
    However, above 2x, the frame rate drops down and it shows only 1 picture of 60+ pictures  for a sec .
    The frame rates are tested with the FRAPS program.

    I'm working on quad core 2.66GHz PC, but the CPU usages are usually 1%.
    My PC has FX570 GeForce video card.
    Thus, I think my computer is good enough to play faster than 2x.

    Actually, wmv file is still good at 4x and the cpu usages rise around 25%.

    There's some kind of bottlenecks in the mfplayer and it's specifically on H264 codec, in my opinion.

    Is it possible there's a curse at 60fps?

    Thursday, January 28, 2010 12:08 AM
  • Hi, JJatCO,

    I guess the situation is about the same here.
    There must be some difference between speed of up to 2 or over 2.

    Concerning about the video's frame rate, what about the disk speed?
    When I use SSD for the video file, it improves a bit.
    It is easy to imagine that when setting the play rate fast, it needs to read the file very quick.

    Let me mention also that even with faster disks, when I  change the play rate passing '2' or '-2',
    the video blackens for fraction of a second.
    I really don't like this.

    Do you see this effect also?

    Best regards.

    Fuyukun
    Thursday, January 28, 2010 8:27 AM
  • There are two seperate maximum rates that playback supports.  One is the non-thinned rate, where every frame is presented.  The video renderer is typically the limiter for non-thinned rates, as it bases its fastest supported rate on the refresh rate of the monitor.  For a 30fps file playing on a monitor with a 60hz refresh rate, the maximum rate would be 2.  The other maximum rate is the thinned rate, where only the keyframes are presented.  Typically the maximum rate for thinned playback is very high. 

    MFPlay handles this internally, transitioning from non-thinned to thinned playback and back depending on the rate.  In the 2.1 -> 2 rate situation, MFPlay would likely be transitioning from thinned to non-thinned playback.  The playback pipeline must be flushed to get rid of any pending thinned samples and then restarted at the current position when changing from thinned to non-thinned.  However, assuming you passed in a video window to MFPCreateMediaPlayer, MFPlay should take care of ensuring that the video window does not go black during this period.  Are you seeing this black frame on a rate transition with other files -- for example, the Wildlife.wmv that comes with Windows 7?  Based upon my experiementation with some H264 and WMV files I have, I do not see any black frames.
    Friday, January 29, 2010 1:44 AM
  • Mr. Andrews,

    I have played the sample Wildlife.wmv on different machines (DELL & HP), and they showed black frame, but much shorter than the MP4/H.264 file.

    As you said, I am using  MFPCreateMediaPlayer and pass a HWND which is a visible child window of main window.

    Is there anything I am missing in my code? It is basically a modification of SimplePlay sample.

    Best Regards,
    Fuyukun
    Friday, January 29, 2010 11:25 AM
  • I did some more experimentation with this, and it looks like what might be happening is that something is triggering a WM_PAINT message at about the same time the rate change in your application.  The EVR repaints the window black if IMFVideoDisplayControl::RepaintVideo is called while it is stopped during the middle of a rate change.  Is there something that might be triggering a WM_PAINT when you switch the rate, and is there a way you could avoid the repaint until the rate change is complete?
    • Marked as answer by fuyukun Wednesday, February 3, 2010 8:32 AM
    Tuesday, February 2, 2010 2:48 AM
  • Dear Mr.Andrews,

    Yes, you are exactly right!

    I was updating the parent window to show the frame number (or time), but the same time the code

    g_pPlayer->UpdateVideo();

    was called.

    This is the code that black screen appear.

    Thank you very much for your time and advice.

    Best Regards.
    Fuyukun
    Wednesday, February 3, 2010 8:31 AM