Can I show realtime bitrate, resolution, fps on the screen?
When I start the stream, can I show real-time bitrate, resolution, fps on the screen? Is there any method for showing those information on a new created text view?
Yes, you can. Note: This will work while stream or record but no in preview.
- Resolution:
Log.e("Pedro", rtmpCamera1.getStreamWidth() + "x" + rtmpCamera1.getStreamHeight());
-
Bitrate: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/wiki/Adaptative-video-bitrate. Use adaptative bitrate example and delete "AdapterBitrateParser". In onBandwidthStateChange(double bandwidth) callback you will get the bitrate used.
-
FPS: Use the last commit of the project (This feature is not in gradle yet)
rtmpCamera1.setFpsListener(new FpsListener.Callback() {
@Override
public void onFps(int fps) {
Log.e("Pedro", "" + fps);
}
});
If you dont know how to compile project manually you can follow this: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/wiki/Add-library-to-your-project
Yes, you can. Note: This will work while stream or record but no in preview.
- Resolution:
Log.e("Pedro", rtmpCamera1.getStreamWidth() + "x" + rtmpCamera1.getStreamHeight());
- Bitrate: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/wiki/Adaptative-video-bitrate. Use adaptative bitrate example and delete "AdapterBitrateParser". In onBandwidthStateChange(double bandwidth) callback you will get the bitrate used.
- FPS: Use the last commit of the project (This feature is not in gradle yet)
rtmpCamera1.setFpsListener(new FpsListener.Callback() { @Override public void onFps(int fps) { Log.e("Pedro", "" + fps); } });If you dont know how to compile project manually you can follow this: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/wiki/Add-library-to-your-project
For those information, how could I pass them into a text view?
You can create 3 global variables in class and concatenate all values in a string. Then, you can update textivew text every second for example.
Dear pedro, for the bitrate one, I applied the whole code for camera1. is this bitrate an available bitrate, or a actual stream bitrate, or a bandwidth bitrate? Since i tested with 360p stream, supposes ~2.5mbps is enough for the stream, but in 20 second , the text showed from 3mbps to 12mbps. It is strange to me, could you give me an advice? Thank you so much.
P.s.when i see the monitor on my server, the stream-in bitrate is around 2-3mbps, not 11mbps like the text showed.
The bitrate is calculated with the upload bandwith of your device so maybe this is not totally real because other app can be using it in background. Anyway I found a best way to calculate bitrate usage so I will change it soon
I did a callback to know the bitrate: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/app/src/main/java/com/pedro/rtpstreamer/defaultexample/ExampleRtmpActivity.java#L90