I am building an android app which does some video processing.
I am currently using precompiled FFmpeg from https://github.com/writingminds/ffmpeg-android. The other option is to download FFmpeg source code and compile it using Android NDK. The reason I am contemplating option 2 is to enhance performance. My questions are
Is there a difference between the two options mentioned above?
If yes, what would be the difference. Would it be enhanced performance (or) the result would simply be the same (or) are there some other benefits or drawbacks?
When they state precompiled FFmpeg, does it mean it was compiled using Android NDK for a specific architecture?
Please let me know.
Thank you in advance!!!
ffmpeg can be built with very different options. Some components may be disabled, and this may reduce the size of the binaries significantly. The prebuilt binaries in https://github.com/writingminds include the GPL components, e.g. x264 encoder. This means that you may have legal problems using it in your app, unless it is opensource. Note that I am not a loyer, so don't hesitate to consult with a professional.
Another issue to consider when in doubt about using prebuilt binaries, is that this is a monolithic binary. If you need some specific functionality from ffmpeg, it may build a custom library based on ffmpeg libraries (libavcodec, libavformat, etc). This advantage is negligible if you use ffmpeg to convert long video files, but if you must work on many small chunks of data, the overhead may be significant. You can find prebuilt libraries for Android, too.
There can be a big difference in performance
The main issue is that the binary you linked to uses
--disable-asm
in the x264 configuration. This option disables platform-specific assembly optimizations and results in a significant decrease in H.264 encoding speed (when encoding via libx264 in ffmpeg). I'm unsure why this option is used by the binary provider.When using ffmpeg refer to the console output. If it shows
[libx264] using cpu capabilities: none!
then your encoding speed is not optimal and will be unecessarily slower. For reference, Android users should typically see something likeNEON ARMv7
or similar instead ofnone
.Avoid this misconfigured binary. Properly compiling it yourself will allow you to take advantage of ASM optimizations, and therefore encode faster.