2
votes

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

  1. Is there a difference between the two options mentioned above?

  2. 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?

  3. 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!!!

2
Unless you are actually doing something to the build process (e.g. compiler switches) or changing the source.. then it's going to be the same? Just because you compile it yourself isn't going to enhance the performance. Or is it something else you mean to ask?D-Dᴙum
Thank you! Wanted to know if it would enhance the performance or not and also, would it be advisable to use a pre-compiled version in production grade app or use a own compiled version? Can anything go wrong?App Developer
re: performant ffmpeg/android ... you might want to familiarize on hardware integration in stagefright lib vec.io/posts/use-android-hardware-decoder-with-omxcodec-in-ndk vec.io/posts/use-android-hardware-decoder-with-omxcodec-in-ndk if something has not changed , ffmpeg is just gonna be slow on mobileRobert Rowntree
Thank you so much, will familiarize myself with stagefright.App Developer

2 Answers

4
votes

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 like NEON ARMv7 or similar instead of none.

Avoid this misconfigured binary. Properly compiling it yourself will allow you to take advantage of ASM optimizations, and therefore encode faster.

0
votes

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.