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
Camera recording choppy, not smooth. Min/max frame rate difference high #1412
Comments
Hello, Do you have the same problem using RtmpCamera2 in OpenGl example without modifications? |
Hi @pedroSG94 , I recorded with the OpenGl example (editing the resolution and Codec profiles since the default is 640x480). It seems smoother although I still notice some hickups (for example if you focus on the middle vertical red shelf bar around time 0:23 to 0:27 you can see some glitches). I'm not sure if it's just me or if I'm being too critical. https://www.youtube.com/watch?v=l97P8HyFzHg The Rotation CameraX example seems to have some choppiness as well (for example around 0:16 to 0:20) Compare that to Native again: Is there a reason why the min and max frame rates are different? In the native camera min and max stay at 30fps. Thank you very much for your time, OpenGL ExampleRotation Camera X Example |
Hello, I think that the fps of the metadata is not related with the problem. I can't reproduce your case but I have a similar metadata min and max fps. According with internet. That min and max fps are calculated depend of the timestamp in the frames but the audio and video have a good sync so I think I don't need to worry about it (fix it could be interested but it is not a priority since the video is not affected). About your last video examples. I can see the same problem in native camera video but with less frequent for example in second 2-4 you can see a fps jump. Can you see the same problem (fps) in the activity preview or the problem is only in the video recorded? |
I detected a problem related that should be fixed here: |
Thank you so much @pedroSG94 ! I will try it and get back to you. |
Hi @pedroSG94, I did some re-tests a few times because at first it seemed ok, but then this seems to happen very randomly sometimes. Overall I'm not sure if it's any better because I went back to the old version to test again and it seems ok sometimes, and sometimes not. To be extra sure, I tested the native camera again a few times, and I believe it seems overall smooth. Again, at this point I'm not sure if I'm being too critical. Although only a few glitches, I believe the OpenGlView is much better than my modified OffScreenGlThread that I showed you at first, so if you're busy with other tasks perhaps I can continue with OpenGlView since I found a way to integrate it into my app. Thank you very much for your time. - Ken OpenGL Example Re-test 1 AFTER availableFrames fix (seems smooth overall)https://www.youtube.com/watch?v=aoEn89OPD6U OpenGL Example Re-test 2 AFTER availableFrames fix (glitches 1:58 - 2:07)https://www.youtube.com/watch?v=gRrdAFPoL1E Opengl Example Re-test BEFORE availableFrame fix (glitches 0:50 - 0:57)https://www.youtube.com/watch?v=RVJOGCxqcy4 Native Camera Re-test (seems smooth overall)https://www.youtube.com/watch?v=z3m3RXvrhVg Native Camera Re-test 2 (seems smooth overall) |
Hello, Lets try this last idea. Try to compile using this branch: Let me know if all is working fine. This remove thread sleep so the performance should be better. |
Hi @pedroSG94, Looks like you just merged it? I'll try the master branch. Thank you, |
Hi @pedroSG94 , Here's result of the latest master branch: In my opinion I still see the glitches (for example at 1:16 - 1:20) . Which file did you remove the thread sleep from? Again, thank you for all your effort. -Ken |
I removed it from GlStreamInterface |
Here's another video: https://www.youtube.com/watch?v=NrWCSDqMoiU In my opinion it doesn't happen often enough anymore where it would bother the user or be too noticeable. I noticed the glitches happen usually first few seconds of the film, then it smooths out, and it might happens very small now once every minute or two. -Ken |
Well, at least it is better than on the start. In my devices I can't reproduce this glitches anymore but I think my devices are betters, maybe it is only noticeable on low spec devices. |
Yes, thank you @pedroSG94 . I really appreciate your library, it is great.
|
Describe the bug
Hi @pedroSG94,
My video recordings are looking not smooth, when panning you can see the frames freeze and jump sometimes. I compared this to the native camera recording with the exact same settings, and the native camera recording is much smoother.
When looking at the media information of the RtmpCamera2 recording, it seems strange that the min frame rate is 15.139 FPS, while the max frame rate is 72.139 FPS, with an average of 29.834 FPS. The native camera recording has min frame rate of 30.000 FPS and max frame rate of 30.010 FPS with average of 30.000 FPS.
I also tried for RtmpCamera1 and it appears the same, with frames that freeze and jump.
I provided detailed information below regarding this case. Hope you can help me figure this out, I tried many different settings without any success.
Thank you very much,
-Ken
To Reproduce
Code Summary
Since programmatically I only have access to a SurfaceTexture and not a SurfaceView, I modified Camera2Base to have a constructor that took in a Surface object, and I used a modified version of OffScreenGlThread as the glInterface. The run function was modified to closely resemble OpenGlView's run function, while using my surface.
And I use it as such
Resulting Galaxy A15 RtmpCamera2 File Recording:
https://www.youtube.com/watch?v=2t28JEvseqQ
Media Info for RtmpCamera2 File Recording:
Compared to Galaxy A15 Native Camera Recording:
https://www.youtube.com/watch?v=7idj-g_QfbE
Media Info for Native Camera Recording:
Logs related to Video Encoder Setup
Logs related to FPS
Also tried RtmpCamera1
https://www.youtube.com/watch?v=a9zm5NNZX_4
Media Info for RtmpCamera1
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: