Skip to content
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

OpenGL + MediaRecorder.VideoEncoder.AV1 - a freezing video (like very low fps) #134

Open
anonym24 opened this issue Feb 10, 2024 · 0 comments

Comments

@anonym24
Copy link

anonym24 commented Feb 10, 2024

Android declares that AV1 video encoder is supported for Android 14+

Before I pass frames to MediaRecorder I process them with OpenGL:

recorderWindowSurface = WindowSurface(eglCore, recorderSurface, true)
recorderWindowSurface.makeCurrent()

I tried AV1 codec on Samsung S22 Ultra Android 14 and Android MediaRecorder:

mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.AV1)                
recorderSurface = MediaCodec.createPersistentInputSurface()
mediaRecorder.setInputSurface(recorderSurface)

I tried to play a recording video but it plays very freezing / lagging.

I noticed that EglSurfaceBase.swapBuffers() (source) takes a lot of CPU time right now

164 ms
151 ms
153 ms
163 ms
150 ms
160 ms
158 ms
145 ms
158 ms
173 ms
191 ms

Did someone tried it on their devices, does it work well or similar results?

MediaRecorder.VideoEncoder.H264, MediaRecorder.VideoEncoder.HEVC - works without issues, same parameters (bitrate, full hd resolution, fps 20..30, nothing special).

EglSurfaceBase.swapBuffers() in this case takes:

8 ms 
10 ms
6 ms 
6 ms 
4 ms 
4 ms 
3 ms 
2 ms 
4 ms 
12 ms

MediaInfo:

Video
ID                                       : 1
Format                                   : AV1
Format/Info                              : AOMedia Video 1
Format profile                           : [email protected]
Codec ID                                 : av01
Duration                                 : 4 s 55 ms
Source duration                          : 4 s 51 ms
Bit rate                                 : 6 210 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Rotation                                 : 90°
Frame rate mode                          : Variable
Frame rate                               : 9.134 FPS
Minimum frame rate                       : 5.102 FPS
Maximum frame rate                       : 37.037 FPS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant