WebRTC Get stats metrics for refreshing keyframes

Viewed 332

I am currently using webrtc to receive an h264 stream over udp(rtp).

I am encoding this stream and sending it, using gstreamer.

The way I am encoding it right now, is with an infinite GOP size, to allow for lowest bitrate.

However with an infinite GOP size, packet loss etc requires me to send keyframes.

I am wondering if there are better metrics for figuring out when to send a keyframe, and why we need to send keyframes in this situation at all.

For example, what is happening to the stream that requires a keyframe.

Also what is the best metric that can be used to determine that it is a good time to send keyframes. I've heard packet loss isn't good enough, since not all packet loss requires a keyframe refresh, and sometimes there is a delay between packet loss and the frame being received.

1 Answers

Could you run avdec_h264 and then when you hit errors send a PLI?

You could parse the H264 bitstream yourself and perform an action on certain conditions.

  • Did I get a corrupted I-Frame
  • After n corrupted P/B Frames

I am going to go do some reading myself. I wonder how hard it would be to determine the amount of broken macroblocks.

Related