11

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

Diego Perez
  • 2,188
  • 2
  • 30
  • 58
  • You can use Android App bundle which will reduce the App size. Also if you can explain for exactly what purpose you are using FFmpeg in android, I would suggest you something good. – Amit Kumar Mar 28 '20 at 18:05
  • Thanks for your reply @Amit Kumar. I'm using FFMPeg library to create small (30 seconds) videos and I'm doing something very specific that took me a lot of time to develop so I wouldn't be in the mood of redeveloping. When I say something specific is because I'm taking different screenshots of device screen while some text is "moving" like in a markee (it is not actually a markee) with a typewriter effect and overlapping a transparent animated gif and also adding some music. FFMPeg is the best library I know to do such things and in my case it's working great! The only caveat is apk size. – Diego Perez Mar 28 '20 at 18:22
  • Thank you so much ` com.arthenica:mobile-ffmpeg-min-gpl:4.2.2.LTS` is very helpful to me I reduce my apk size from 130 mb to 75 mb – Kashyap Rathod Aug 25 '20 at 08:27

2 Answers2

2
  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.
Amit Kumar
  • 438
  • 1
  • 4
  • 15
  • 1
    Thank you very much @Amit Kumar. I'll have a look at it. Tha problem is if I cannot launch a ffmpef command directly like I do in my current library it won't be useful for me, because I have a very complex ffmpef command created with filters and many parameters that tookme a lot of time to create, and I won't be doing all this job again. Anyway I can try, but most of the text in the library you suggest is in chinese, and it's not clear it supports to launch ffmpeg commands. – Diego Perez Mar 28 '20 at 18:41
  • 1
    You can use this library for direct command as well. https://github.com/yangjie10930/EpMedia#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%91%BD%E4%BB%A4 – Amit Kumar Mar 28 '20 at 18:46
  • Thank you very much @Amit Kumar. I'll try this then, and I've also found a second choice, that is use new apk split according CPU architecture Google Play Console feature, so I think I have two options now. I'll wait just to check if other users contribute, and if not I'll mark your answer as correct. – Diego Perez Mar 28 '20 at 18:52
0

use

implementation "com.arthenica:mobile-ffmpeg-min:4.4.LTS"

according to documentation

Mahdi Zareei
  • 1,299
  • 11
  • 18