-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FPS drop and lags during streaming #21
Comments
Hi! The preview has nothing to do with the live stream. Your camera device send frames to the preview and to the encoder. Changing something on the preview should not change anything on the live stream. |
Thank you for the answer! I have Redmi Note 8 pro: Yes, with your example application has the same issue.
|
Hi, Ok, everything seems alright. Your CPU is really low which is really good. |
I tested your example, fps is still low, but another problem has been added =). I didn't change the video settings. They stood by default: LogsAfterStartingStream.txt Is there anything else I can be useful? |
Ok. |
Hi Thibault! Dark effect is gone, CPU does not overload, problems with fps remain, but I noticed that when switching to the front camera, fps does not drop. I also wanted to clarify with you why call holder.setFixedSize () in surfaceChanged? Considering what you wrote: "The preview has nothing to do with the live stream. Your camera device send frames to the preview and to the encoder. Changing something on the preview should not change anything on the live stream". If it is needed for the correct aspect ratio of the surfaceView, then this doesn't work. I found this example: https://github.com/android/camera-samples/blob/main/Camera2Video/utils/src/main/java/com/example/android/camera/utils/AutoFitSurfaceView.kt on google and it works well with aspect ratio. I don't have much development experience, so any advice from your side would be useful to me =). LogsAfterStartingApp.txt |
The code in |
Now there are no problems with fps, at least in SurfaceView, but the stream does not play. The same situation occurred when I called holder.setFixedSize () only in surfaceCreated (), which I wrote about earlier. As our backend developer explained to me, this happens because the fps information does not reach the server, which breaks the transcoding and leads to errors. LogsAfterStartingApp.txt |
Glad to hear. It's a good start :) but I don't understand why :(
Which fps information are you talking about? Have you try with ffplay ( |
For example, if start stream using your library, the following information comes to the server:
But the following information should come:
Unfortunately not yet, but I want to try. As soon as I do this, I will inform you of the results :). |
Oh, I guess your server expects the VUI in the SPS (especially the |
Hi @BakhromMuydinov, By the way, I added |
Hi @ThibaultBee! I apologize for not getting in touch for a long time. Yes, we fixed it, thank you very much! What can be done about it? Stream #0:0[0x20]: Video: hevc (Main) ([36][0][0][0] / 0x0024), yuv420p(tv, bt470bg/bt470bg/smpte170m), 720x1280, 29.58 tbr, 90k tbn |
Hi, Glad you fixed your issue! Regards, |
Hi! The situation is better in landscape orientation, but still this effect, in my opinion, is slightly present. Stream #0:0[0x20]: Video: hevc (Main) ([36][0][0][0] / 0x0024), yuv420p(tv, bt470bg/bt470bg/smpte170m), 1280x720, 29.58 tbr, 90k tbn |
Hi! Regards, |
Hi! Thank you very much!! |
Hello, I merged the branch. Also, could we have a chat on what you are going to do with this library, the features you are using, not using or missing? I am pretty sure you can find me on linkedin with my name. Regards, |
No problem! I'm not in a hurry =). Unfortunately, I'm not on LinkedIn, but if you want, we can chat on Telegram. |
Hi, These issues are fixed. Fixes will be shipped with next release. Best regards, |
Hi Thibault! First of all, thanks for the library!
Implementing streaming to my project I followed your experience as an example, but I ran into some difficulties. Do you mind if I ask few questions?
When you start the application, it is noticeable that the camera frame rate is below 30, although the value is set to 30, and when you start the stream, the fps drops even more. As far as I understood, this is due to the call to the holder.setFixedSize() method every time the surface changes.
I tried to call holder.setFixedSize() only in surfaceCreated() and then there are no problems with fps, but in this case, when the stream starts, the information about the set fps does not reach the server, which leads to errors and the stream does not play.
Can you please tell me how to fix this? I would be grateful for any advice!
The text was updated successfully, but these errors were encountered: