RootEncoder icon indicating copy to clipboard operation
RootEncoder copied to clipboard

Unstable FPS

Open jacklai24 opened this issue 1 year ago • 3 comments

Hi @pedroSG94 ,

I used the RtspServerCamera1 and set FPS to '10' in the prepareVideo method. I found that the FPS will be over the limit when the scene goes from dark to light. (Maybe to FPS 30) But after a while(Maybe 30 minutes), FPS will be down to the original limit.

I trace the source code. The FpsLimiter implements the FPS limit. If the Frame queue(BlockingQueue<Frame> queue) accumulates a lot in the VideoEncoder quickly, will it cause such an abnormality?

Please tell me how should I deal with this problem. Thank you.

jacklai24 avatar Jun 04 '24 07:06 jacklai24

Hello,

Are you using RtspServerCamera1 with OpenGlView? I recommend you this way because the fps is calculated in a better way using OpenGlView because I can control the render properly this way. FpsLimiter just count the number of frames encoded each second and then reset the counter. So if you have: 15fps, 5fps and 10fps in 3 seconds that is fine. You should check the average, anyway, usually the value should be really close to the fps selected and more or less constant

pedroSG94 avatar Jun 04 '24 14:06 pedroSG94

Hi @pedroSG94 ,

Thanks for your reply. I found that this situation is on the client side not previewed on my device. Do you mean that using openglview will also affect the number of frames sent by the RTSP server?

jacklai24 avatar Jun 06 '24 02:06 jacklai24

Hello,

Yes, using OpenGlView the fps affect to preview and frames sent.

Using SurfaceView or TextureView only the frames sent are affected because the fps is limited in the encoder directly. Using OpenGlView the fps is limited in the opengl render so the encoder only receive the frames that the render accept and it is more accurate because you don't have a queue in the encoder that could produce your case.

Also, OpenGlView use the GPU. This allow you get a better fps, performance and allow you use filters

pedroSG94 avatar Jun 06 '24 07:06 pedroSG94