Robert Jamieson
unread,Oct 25, 2024, 3:59:55 PM10/25/24Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chromium-dev, Wojciech Dzierżanowski, rjam...@all-turtles.com, Markus Handell, Eugene Zemtsov, Chromium-dev, media-dev, Dale Curtis
Hi,
Thanks for the suggestions. I tested with both MediaRecorderUseMediaVideoEncoder enabled and disabled but didn't see a difference.
We did however manage to recreate the issue internally. We saw the issue occur on a 2020 MacBook Pro and also on a Windows Lenovo machine. The common point between both machines was neither had hardware encoding support for VP9.
I have now been able to recreate the issue on my dev Windows machine by disabling hardware encode in flags. The test I am performing is rendering a static image to a canvas at 30fps and using that as the video track for the media recorder. The videoBitsPerSecond are being set to 2.5Mb/s in the MediaRecorder ctor, with the peak bitrate being set to 5Mb/s based on a magnitude of 2 in vea_encoder.cc (discussed here
https://issues.chromium.org/issues/40851972). I am then recording for 40secs.
When hardware encoding is enabled I see the encoder (media\gpu\windows\media_foundation_video_encode_accelerator_win.cc) configured to Variable BitRate with One Pass. The max QP is set to 56 and the min QP set to 2 with CODECAPI_AVEncCommonMeanBitRate and MF_MT_AVG_BITRATE set to 2500000 and CODECAPI_AVEncCommonMaxBitRate set to 5000000.
It results in a 40 sec file with a bitrate of 3Mb/s.
When hardware encoding is disabled I see encoder (media\video\vpx_video_encoder.cc) set to Variable BitRate with One Pass. The max QP set to 58 and the min QP set to 2 with rc_target_bitrate set to 2500 (kb rather than bytes). There is no peak bitrate set, however rc_overshoot_pct and rc_undershoot_pct are set to 25%.
It results in a 40 sec file with a bitrate of 9.5Mb/s almost 4x the desired bitrate.
With a static image I would have expected maximal quality with almost maximal compression since there is zero motion between frames. I did notice however that there is a hint for identifying screen capture scenarios. According to the comment this is due to bitrates way overshooting the desired bitrates in certain screen capture scenarios (
https://issues.webrtc.org/issues/42226143). Since the Media Recorder can be recording any type of content, from high motion to static images, is it always in danger of large bitrate variance or is it possible to set a peak to prevent large spikes?
Thanks,
Robert