0

I want to maintain a minimum frame rate of 20 FPS. If the network is slow, it should degrade the image quality to always maintain 20fps. I don't want a tradeoff between resolution and FPS, I only want FPS constant or higher than 20. I'm trying to use adaptive bitrate streaming for this but I cant find any documentation or examples. I

I've tried modifying the SDP on both sides with a=quality:1 and changing the codecs, but it didn't work. The video quality is always constant, and when the network is slow, the frame rate suffers. I want to change it to the opposite but I'm not sure how.

Do I need to use a special encoding/codec or a different setting in the SDP?

gsgff1243
  • 1
  • 1
  • Consider setting "contentHint" to "motion" value https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/contentHint This would be downgrading the quality but preserving fps – Artem Suprunov May 26 '23 at 23:20
  • I'm actually using android, so I added the degradation preference as maintain_framerate, but when the video resolution is lowered to maintain the framerate when bandwidth is low, the resolution is not restored afterwards. Do you know how to fix that? – gsgff1243 May 30 '23 at 08:03

1 Answers1

0

You cannot ensure a minimum frame rate. For example, if the Russians blow up a dam and the network infrastructure is destroyed, then the frame rate will naturally drop to zero.

What you can do is encourage the sender to reduce the image quality rather than dropping the frame rate when network conditions get difficult. In the JavaScript API, you do that by setting the track's contentHint property:

stream.getVideoTracks().forEach(t => {
    t.contentHint = 'motion';
});

Note that this will not do anything useful on Firefox, but it does work reliably on Chromium-based browsers and on Safari.

jch
  • 5,382
  • 22
  • 41
  • I have this setting enabled but unfortunately both the framerate and resolution are still very bad. – gsgff1243 Jun 12 '23 at 10:28
  • If both the resolution and the framerate are bad, then either you don't have enough available throughput for anything better, in which case there's nothing to do, or else there's something wrong with the congestion controller. I've seen similar symptoms when the RTCP feedback wasn't getting through correctly. Is the receiver sending RTCP feedback, and is the feedback reaching the sender? – jch Jun 14 '23 at 13:18