[Libav-user] Memory growing while muxing at 1920x1080 @ 60 fps on iPad M1

Nuno Santos nuno.santos at imaginando.pt
Mon Dec 13 14:59:52 EET 2021


Hi again,

After some profiling I have discovered that the function avcodec_send_frame is taking a lot of time to complete on the iPad Pro M1 in the same conditions compared with other iPad Pro (2nd gen 2018 device).

iPad Pro (3rd gen - M1):

avcodec_send_frame: 68 ms
avcodec_send_frame: 0 ms
avcodec_send_frame: 0 ms
avcodec_send_frame: 0 ms
avcodec_send_frame: 68 ms
avcodec_send_frame: 0 ms
avcodec_send_frame: 0 ms
avcodec_send_frame: 0 ms
avcodec_send_frame: 68 ms

iPad Pro (2nd Gen - A10X)

avcodec_send_frame: 1 ms
avcodec_send_frame: 2 ms
avcodec_send_frame: 0 ms
avcodec_send_frame: 1 ms
avcodec_send_frame: 0 ms
avcodec_send_frame: 0 ms
avcodec_send_frame: 1 ms
avcodec_send_frame: 0 ms
avcodec_send_frame: 1 ms

What is happening is that a buffer of frames is being kept while waiting for the previous frame to be encoded and it is not able to keep the pace resulting in memory being accumulated.

Has anyone been here before? Is there anything I could try?

Should this be considered a bug? 

Thanks!

Regards,

Nuno

> On 13 Dec 2021, at 11:59, Nuno Santos <nuno.santos at imaginando.pt> wrote:
> 
> Hi,
> 
> I’m having a problem which is not consistent in all platforms. 
> 
> It doesn’t happen on Mac OS but happens on iPad, but even on iPad, it doesn’t happen on slower iPads but happens on a iPad with a M1 processor.
> 
> While muxing at 1920x1080 @ 60 fps on iPad M1, the memory keeps growing until the point it crashes the program. 
> 
> If I stop the muxing before the crash happens, the memory usage starts to decline and it goes back to initial values. However, if I mux at 30 fps, that doesn’t happen. 
> 
> My conclusion is that for some reason, the pace at it is writing the file is different for some reason, or maybe it is simply keeping the file in memory before writing to file. The exact reason is out of my scope of knowledge.
> 
> I was wondering if anyone has been here before and how can we workaround this issue.
> 
> Thanks!
> 
> Best regards,
> 
> Nuno
> 
> 



More information about the Libav-user mailing list