Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

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

@anonym24

Description

@anonym24

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                           : Main@L4.0
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions