pedroSG94 / RTSP-Server

Plugin of rtmp-rtsp-stream-client-java to stream directly to RTSP player.
Apache License 2.0
214 stars 66 forks source link

How to know frame rate and streaming resolution. #60

Closed janeSmith99221 closed 9 months ago

janeSmith99221 commented 2 years ago

I streamed video successfully through RtspServerFromFile and I want to know streaming frame rate and resolution.

pedroSG94 commented 2 years ago

Hello,

The resolution is the video file resolution and the frame rate is cap to video file framerate but you can add a callback that notify you fps:

    rtspServerFromFile.setFpsListener(new FpsListener.Callback() {
      @Override
      public void onFps(int fps) {
        //called each second while streaming or recording
      }
    });

If you want you can get video file resolution using android API: https://stackoverflow.com/questions/8000978/is-it-possible-to-get-the-resolution-of-a-video-in-android/27437526

janeSmith99221 commented 2 years ago

okay thanks.

janeSmith99221 commented 2 years ago

I checked frame rate as your guideline. n here one issue, I can't get stable frame rate. the frame rate in between 25 to 32. here's Log:

frame rate 27 frame rate 29 frame rate 28 frame rate 29 frame rate 33

pedroSG94 commented 2 years ago

Hello,

Did you check with others files?

FPS depend of your file and your device performance. I'm using a decoder to extract frames from the file and encoding it in H264 so if you have a problem in this proccess (device performance) your fps could change a bit in few moments.

Also, fps callback is an estimation fps but this could change a bit and could add few fps to the next logs depend of the timestamp but if you calculate the average this should be really similar to the real value.