mpromonet / webrtc-streamer

WebRTC streamer for V4L2 capture devices, RTSP sources and Screen Capture
https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/?layout=2x2
The Unlicense
2.94k stars 598 forks source link

Can I set the interval time for i-frames during encoding? #658

Closed zhuya1996 closed 4 months ago

zhuya1996 commented 8 months ago

Can I set the interval time for i-frames during encoding?My desktop resolution may cause lag when others view it

mpromonet commented 8 months ago

Hi,

You could try to set cricket::VideoCodec::H264()->keyFrameInterval given to webrtc::VideoEncoder::InitEncode

Best Regards, Michel.

zhuya1996 commented 8 months ago

May I ask how to set up H264 decoding? I think the default VP8 is currently used, right?

mpromonet commented 8 months ago

Hi,

codec is negociate between codec supported by client and supported by server. It could be VP8 or H264 or VP9. You could use setCodecPreferences to set preferences.

Best Regards, Michel.

zhuya1996 commented 8 months ago

In which code is setCodecPreferences set? Can you provide more details? Also, I found that when sharing the screen or reading rtsp, if it is local opencv playback, there will be no lag. If it is web playback, it will lag. Do you know why this is?

zhuya1996 commented 8 months ago
virtual bool onData(const char *id, unsigned char *buffer, ssize_t size, struct timeval presentationTime)

Is the buffer here live555 data or encoded data???

mpromonet commented 8 months ago

Hi,

This callback receive encoded data.

Best Regards, Michel.

zhuya1996 commented 8 months ago

Hello, why do I lose frames when I play RTSP during the day but play smoothly at night? How can I make RTSP playback smooth during the day?