Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android apk file too big when using FFMPeg encoder library

I'm developing an app which creates x264 videos with the following library:

com.arthenica:mobile-ffmpeg-full:4.2.2.LTS

but the result apk file is too big (~71mb), so I tried:

com.arthenica:mobile-ffmpeg-min-gpl:4.2.2.LTS

and this way, as the library downloads only a few codecs -included the ones I need- apk size was reduced to ~49mb, what is much better, but still looks too big to me, so I'd need to know if any of you know a better way to reduce apk size, because people generally refuse to download such big apps

Regarding the rest of the app (drawables, resources and so) they're well optimized, because if I remove this library and rebuild, the size of the app drops to 10mb

I was reading this question: FFMPEG Android Library Increase Size

and user S.R suggests to compress all cpu architecture models in one archive file and extract target cpu lib based on cpu model on app's directory and load ffmpeg from there, but I really don't know how to do that.

I'm checking my app's folder structure and noticed there are this next folders regarding ffmpeg lib:

arm64-v8a => ~16mb
armeabi-v7a => ~29mb
x86 => ~17mb
x86_64 => ~21mb

But not sure if I could remove any of them, and as you can see armeabi-v7a is the largest.

enter image description here

like image 916
Diego Perez Avatar asked Mar 28 '20 16:03

Diego Perez


1 Answers

  1. As per your requirement, FFmpeg is the best option to so much of video processing task but the problem with FFmpeg is it will increase the size of the app. So I will suggest you to compile this FFMPEG library in your project, it also has many inbuilt functions like add music, add image on Video etc. It will definitely help you with your work as well as size is also very small ~11mb.
  2. You can use Android App Bundle (aab) to reduce app size further.
like image 109
Amit Kumar Avatar answered Nov 27 '22 10:11

Amit Kumar