New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 781085 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

media/gpu/media_foundation_video_encode_accelerator_win.cc use SW H264 encoder

Reported by f...@bebo.com, Nov 3 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Steps to reproduce the problem:
1. Select H.264 as codec on Windows 10 with NVIDIA card
2. Stream 1080p@60 fps
3. C:\Program Files\NVIDIA Corporation\NVSMI>.\nvidia-smi.exe encodersessions

What is the expected behavior?
We should see an active encoder session and close to zero CPU

What went wrong?
Chromium by default uses the Microsoft H.264 MFT Encoder which according to the documentation delegates to hardware encoders. When running the Micosoft H.264 MFT Encoder with only hardware encoders enabled on NVIDIA hardware we noticed:

* higher CPU usage and stack traces consistent with SW encoder
* no encoder sessions on the hardware when using nvidia-smi
* nvidia hardware MFT DLL isn't loaded

NVIDIA H.264 Encoder MFT

We implemented an async MFT client and tested this with the NVIDIA H.264 Encoder MFT. This generally seems to work well.

AMD H.264 Encoder MFT

Works reasonable as well - less tested on our side. Needed some special things, such as draining the encoder to run stable.

QuickSync H.264 Encoder MFT

The quicksync MFT does not seem to react to changing the bitrate - this makes it not usable with webrtc at the moment

Some additional notes:
* The NVIDIA encoder only outputs the correct bitrate if the FPS is set correct.
* added codecImplementationName
* You can find our code here (we use nw.js which follows chromium): 
https://github.com/bebo/chromium.src/blob/master/media/gpu/media_foundation_video_encode_accelerator_win.cc

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 61.0.3163.100  Channel: n/a
OS Version: 10.0
Flash Version:
 
Components: Internals>Media>Codecs
Cc: emir...@chromium.org mcasas@chromium.org
Cc: -emir...@chromium.org -mcasas@chromium.org niklase@chromium.org
Owner: emir...@chromium.org
Status: Assigned (was: Unconfirmed)
Thanks for the detailed report. We landed the initial MFT with only sync API support. If NVIDIA doesn't enumerate there or Intel HD card enumerates before that, that HW encoder wouldn't be picked. We can enable NVIDIA/AMD as you suggested. I should still verify we have that Hw in our perf/testing bots as well. Thanks a lot for your findings about the bitrate, skipping QuickSync makes sense. 
I took a look at your changes and they look good. I can definitely review and help you land your changes in Chrome, see the guidelines below.
https://www.chromium.org/developers/contributing-code
Cc: f...@bebo.com
Friendly ping for fpn@bebo.com. Let me know if you would like to contribute code or prefer me to take it over.

Comment 5 by fur...@bebo.com, Nov 7 2017

If you guys can take it over that would be great! We'll keep an eye on this ticket for any questions. if you need any help from us feel free to message us

Thanks for the quick responses

Comment 6 by f...@bebo.com, Nov 9 2017

I will get the contributor agreement going tomorrow, so you can use any of
the code we wrote. I won't have time to make a patch against head at the
moment.

Comment 7 by f...@bebo.com, Nov 10 2017

We signed the contributor agreement, please ping me if you have questions or that didn't go through. Thank you!

Sign in to add a comment