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

Extremely slow. CPU usage never seems to exceed 3-4% #196

Open
Aditya94A opened this issue Apr 15, 2017 · 3 comments
Open

Extremely slow. CPU usage never seems to exceed 3-4% #196

Aditya94A opened this issue Apr 15, 2017 · 3 comments

Comments

@Aditya94A
Copy link

This is pretty weird, but for some reason I haven't seen my cpu usage ever go above 3-4% when using this library. Audio/Video encoding is easily one of the most computation intensive things one can do.

I reckon this has something to do with the atrocious performance. Perhaps there's something wrong with the build script? Can someone more experienced with the ndk chime in please?

As mentioned in another issue I checked out this other project and it seems to be easily 10-15x faster in comparison.

@namdhis
Copy link

namdhis commented Apr 21, 2017

Did anyone find out a good solution for this?

@lbdroid
Copy link

lbdroid commented Apr 25, 2017

Bad performance with low CPU usage will generally be caused by waiting for I/O, which means reading from or writing to disk.

For instance, if you are producing data faster than you are able to write to disk, then the write buffers will fill up, and the processing will stall until it can continue to write.

You will need to narrow down the cause of the slowdown before anything really can be done to debug it.

For instance, if you are transcoding, try writing to /dev/null and see if that goes faster. You should also try running the command directly through the terminal to determine if the problem is in the Android library, or the ffmpeg binary.

If you are reading or writing data over the network, that can cause considerable slowdowns.

Also, if your command is exceedingly verbose, for example, an output line for every processed frame, this will trigger log handling functionality in the java code, which may be another source of slowdowns.

@lamba92
Copy link

lamba92 commented Jul 13, 2017

I am having the same problem and i think is due to the resources the OS allow for the AsyncTask. While using libx264 it encodes at less then 0.1x speed of the actual input (on a OnePlus One with Sultan LineageOS custom rom). This is a problem...

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

4 participants