1

Is the way to go to use the Microsoft H.264 MFT? There is a MFT for Quicksync but only for encoding.

The flags on the Microsoft H.264 MFT are Sync and software. I can use a D3D device and use IMFVideoSampleAllocatorEX for some amount of video acceleration, but I was wondering if there was a better way to use Intel Quick Sync through Media Foundation.

cloudraven
  • 2,484
  • 1
  • 24
  • 49

1 Answers1

2

Microsoft H.264 Video Encoder is for encoding.

Intel Quick Sync Video H.264 Encoder MFT is also an encoder object.

If you are looking for hardware-assisted decoder, the Media Foundation API offers that via H.264 Video Decoder, which is capable of taking advantage of DXVA2 API, which in turn uses hardware capabilities to decode H.264 video.

UPD. Elaborating follow up questions in the comments below, there is nothing wrong in H.264 Video Decoder MFT being a synchronous MFT. Indeed, hardware MFTs have a documented requirement to be asynchronous. H.264 Video Decoder MFT and more recent H.265/HEVC Video Decoder MFT have a different structure: they combine software decoder as a fallback code path, utilize hardware decoder via internal use of DXVA2 API and are synchronous decoders.

IHVs do not ship separate hardware MFTs for H.264 and H.265 because the mentioned stock decoder MFTs are already integrating hardware decoding capabilities in efficient way. Dedicated true hardware MFT decoders would not offer any real advantage. For the formats not covered by DXVA2 and/or stock decoders IHVs do ship dedicated decoders in form factor of asynchronous hardware MFTs (M-JPEG, VP8 formats, for example).

The bottom line is that stock decoders is the suggested method to consume hardware backed decoding. It is possible to use IHV SDK to talk to decoders otherwise. It might offer better flexibility, presumably the complexity is higher esp. in terms of need to integrate with Media Foundation pipeline (if necessary), however the performance gain is not so likely: stock Media Foundation decoders with hardware decoding enabled add reasonably small overhead.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • Yes, that's what I thought However, when I use the h.264 video decoder the flags report it as sync. software. Is this a bug, it seems like I am gettting dxva2 acceleration, but it is not clear – cloudraven May 04 '18 at 22:39
  • Even though hardware MFTs are, by convention, asynchronous, the DXVA2 backed decoder is a sort of exception. It is a decoder with software and DXVA2 code paths and DXVA2 is used where available and if not disabled. There is no dedicated hardware decoder. – Roman R. May 05 '18 at 06:52
  • BTW much newer H.265 decoder is also synchronous. Intel, AMD supply asynchronous hardware decoders for formats not covered by DXVA2 (M-JPEG, VP8 etc). – Roman R. May 05 '18 at 06:57
  • [H.265 / HEVC Video Decoder](https://msdn.microsoft.com/en-us/library/windows/desktop/mt218785) – Roman R. May 10 '18 at 04:52
  • Got it! It's good to know that the h.265 is async, and that the h.264 is the way to go for all manufacturers and it only supports DXVA2 In summary * H.264 Software Sync MFT with only DXVA2 is the Media foundation way of doing H.264 * If it is possible to use H.265 instead, the MFT is much better and it is hardware async * If H.264 is necessary it is better to use the vendor specific API (NVENC, Quicksync, etc.) If you edit your answer to include those points, I will accept it. Thanks! – cloudraven May 10 '18 at 21:33