RecordingStudio icon indicating copy to clipboard operation
RecordingStudio copied to clipboard

high CPU usage when recording

Open dpocock opened this issue 4 months ago • 2 comments

App version: 0.2.0 from F-Droid Phone: Fairphone 4 Android: 14 LineageOS 21-

I tried your app and I noticed high CPU usage and battery drain. I have used similar apps that run for much longer without any impact on CPU.

I connected to the phone using ADB and ran the top utility. It shows me this:

 PID USER         PR  NI VIRT  RES  SHR S[%CPU] %MEM     TIME+ ARGS                                                            
19846 u0_a67       20   0  14G 160M  85M S  100   2.9   9:08.48 io.github.leonidius20.recorder.lite

The app is using one core at 100% all the time while recording.

My settings:

  • Audio source: unprocessed
  • Container: WAV
  • Codec: PCM
  • Channels: mono
  • Sample rate: 48000
  • Bit depth: 16 bit int

As I'm using an uncompressed format I'm surprised that it places such a big demand on CPU.

I tried reducing the sample rate to 8000 and the problem is the same.

Is this a known problem for you or for any other users or am I the first person to comment on this?

dpocock avatar Aug 16 '25 08:08 dpocock

I tried using MP4 / AAC and the CPU usage is only about 13%

  • Audio source: unprocessed
  • Container: MPEG4
  • Codec: AAC-LC
  • Channels: mono
  • Sample rate: 48000
  • Bit depth: 16 bit int

dpocock avatar Aug 16 '25 09:08 dpocock

Comparing the audio quality with the WAV (high CPU) and the MPEG4/AAC-LC (low CPU), I found the WAV quality is much better.

In the latter case, it sounds like the compression, despite only using 13% of CPU, is not keeping up with the samples coming in and it is dropping some of them. I was testing at 48000. I tested various USB audio devices so it doesn't depend on the audio hardware in the phone. I test the same audio devices against a PC to compare the recording. I might make some more tests later.

dpocock avatar Aug 16 '25 10:08 dpocock