locked
Low-level rendering of raw YUV video frames w/ Media Foundation RRS feed

  • Question

  • Hi all,

    i have a stream of raw uncompressed YUV video frames and am trying to render them into a window as efficiently as possible. All of this should be pretty low-level, each frame should be rendered whenever I call upon doing so, I don't need timestamps, presentation clocks, or the like. All scheduling/syncing/... is done by my application.

    What is a performant and easy way to do that using the Media Foundation? I would like to use all the hardware acceleration I can get. I found Interfaces that look correct for the task, like IMF2DBuffer or IMFMediaSink, but I don't quite see the way to connect them suitably.

    Thanks in advance, any help is greatly appreciated,
    Alex
    Monday, September 17, 2007 3:33 PM

Answers

  • Hi Alex,

     

    Yes, DXVA2 does support planar samples like YV12 format as long as the driver underneath can video process the format. There is no D3DFORMAT but you can always use FourCC format instead.

     

    For exmaple, you would pass MAKEFOURCC('Y','V','1','2') or D3DFORMAT('21VY') as the VIDEO_MAIN_FORMAT in DXVA2_VideoProc sample and see if the driver supports it. Of cource, the sample data has to be changed from YUY2 to YV12 to see the picture correctly.

     

    Thanks,

    -Kaz

    Tuesday, September 25, 2007 5:06 PM
  • Can someone tell me where the DXVA2_VideoProc sample source is ?  a link would be nice !


    Found this thread while searching for something else.  For completeness, it's in the Windows SDK samples.  Example, for the Vista SDK:

    C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\MediaFoundation\DXVA2_VideoProc

    Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
    My dshow site is http://tmhare.mvps.org.
    • Marked as answer by The March Hare Tuesday, November 10, 2009 8:49 PM
    Tuesday, November 10, 2009 8:49 PM

All replies

  • To be even more precise: the frames I want to render are in planar YUV format (YV12).

    BTW: Can I directly use the DXVA2 architecture (without a Media Foundation wrapper) for displaying a video buffer on, say, a Direct3D surface?
    Tuesday, September 18, 2007 7:34 PM
  • IDirectXVideoProcessor might work for what you want. Take a look at the DXVA2_VideoProc sample in the Windows Vista SDK.

     

    ----------------------------------------------------------------------------
    Mike Wasson, SDK Documentation
    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

    (c) 2007 Microsoft Corporation. All rights reserved.

     

    Thursday, September 20, 2007 5:14 PM
  • The DirectX video processor indeed looks very promising and I started working with it. Thanks for the link.

     

    I still haven't found out, though, how DXVA can directly display YV12 video samples (*planar* YUV samples, that is). There is no suitable D3DFORMAT to do so, all those seem to be *packed* formats (pixel by pixel) only. Does anybody know how to display YV12 frames without prior conversion?

     

    Thanks,

    Alex

    Monday, September 24, 2007 8:37 AM
  • Hi Alex,

     

    Yes, DXVA2 does support planar samples like YV12 format as long as the driver underneath can video process the format. There is no D3DFORMAT but you can always use FourCC format instead.

     

    For exmaple, you would pass MAKEFOURCC('Y','V','1','2') or D3DFORMAT('21VY') as the VIDEO_MAIN_FORMAT in DXVA2_VideoProc sample and see if the driver supports it. Of cource, the sample data has to be changed from YUY2 to YV12 to see the picture correctly.

     

    Thanks,

    -Kaz

    Tuesday, September 25, 2007 5:06 PM
  • Using D3DFORMAT('21VY') works nicely. Thanks a lot, Kaz.

    Wednesday, September 26, 2007 8:22 AM
  • Can someone tell me where the DXVA2_VideoProc sample source is ?  a link would be nice !

     

    thanks

    Monday, April 28, 2008 4:39 PM
  • Hi,

    How to render a stream of raw YUV (planar - it’s the same scenario above) using *Windows XP* ?

    I have direct access to the YUV planar samples and I would like to send them to an “overlay” surface

     

    Thanks

    Paulo

    Friday, June 20, 2008 8:03 PM
  • Can someone tell me where the DXVA2_VideoProc sample source is ?  a link would be nice !


    Found this thread while searching for something else.  For completeness, it's in the Windows SDK samples.  Example, for the Vista SDK:

    C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\MediaFoundation\DXVA2_VideoProc

    Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
    My dshow site is http://tmhare.mvps.org.
    • Marked as answer by The March Hare Tuesday, November 10, 2009 8:49 PM
    Tuesday, November 10, 2009 8:49 PM
  • Hi,

     

    How to render a stream of raw YUV (planar - it’s the same scenario above) using *Windows XP* ?

    I have direct access to the YUV planar samples and I would like to send them to an “overlay” surface

     

    Thanks

    Paulo


    Media Foundation only exists for Windows Vista and Windows Server 2008 or later. You'll need to seek out another API.
    • Proposed as answer by liangshuang Thursday, March 24, 2011 5:07 AM
    Wednesday, November 11, 2009 8:37 AM
  • Hi Alex,

     

    Yes, DXVA2 does support planar samples like YV12 format as long as the driver underneath can video process the format. There is no D3DFORMAT but you can always use FourCC format instead.

     

    For exmaple, you would pass MAKEFOURCC('Y','V','1','2') or D3DFORMAT('21VY') as the VIDEO_MAIN_FORMAT in DXVA2_VideoProc sample and see if the driver supports it. Of cource, the sample data has to be changed from YUY2 to YV12 to see the picture correctly.

     

    Thanks,

    -Kaz


    Thanks for your sharing!
    Monday, January 17, 2011 12:18 AM