Media Foundation h264 encoder poor performance
I'm writing an application which records PC's screen in realtime and encodes it with Media Foundation h264 codec. Encoding consumes a lot of CPU resources. And after I stop recording video (or pause it by simply stopping feeding an encoder with video and audio frames), CPU load stays very high for a long period of time (5-10 seconds and more). During this time application waits until IMFSinkWriter::Finalize method completes.
My PC configuration:
- Intel i5-2410M 2.3 GHz with 4 cores
- 8 GB RAM
Codec configuration:
- 25 fps
- 1364 x 768 resolution
- baseline profile
- 1.2 MBit bitrate
Is this a limitation of MF h264 codec performance or is it due to bugs/misconfiguration in my code?