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

Reduce APK Size / Split project into three different libraries for x86, armv7 and armv7-neon #66

Open
neurospeech opened this issue Feb 11, 2016 · 23 comments

Comments

@neurospeech
Copy link

neurospeech commented Feb 11, 2016

This project leads to apk of size > 40mb, this is huge waste of space and download time as most of the time, device has only one cpu architecture. Most android phones are armv7, so no need to ship x86 libraries along with the app. And as very few phones support armv7-neon, so no need to ship armv7-neon as well, you can always create three different apps for three different platforms.

Manually, I was able to delete x86 and armv7-neon, and brought down size of app to 10mb. So if there are three different libraries,

ffmpeg-android-java-x86
ffmpeg-android-java-armv7
ffmpeg-android-java-armv7-neon

It will be of great help to developers.

UPDATE

It turns out that you can use cdn.jsdelivr to directly download ffmpeg binaries when user tries to use ffmpeg first time. There is no need to package this inside apk. See
https://github.com/neurospeech/xamarin-android-ffmpeg

@hiteshsondhi88 hiteshsondhi88 changed the title Split project into three different libraries for x86, armv7 and armv7-neon Reduce APK Size / Split project into three different libraries for x86, armv7 and armv7-neon Feb 23, 2016
@JayParikh20
Copy link

Release Apk with different cpu architecture
and delete the rest of libraries (as neurospeech mentioned)
try reading this,
http://developer.android.com/google/play/publishing/multiple-apks.html

@ivanviragine
Copy link

Hi guys. Sorry about the noob question, but is there a way for this lib to work as Facebook's Fresco lib? A simple split on gradle (as http://frescolib.org/docs/multiple-apks.html) would not ship the ffmpeg executables from another architectures.

@sashatinkoff
Copy link

sashatinkoff commented Sep 17, 2016

Is there any tutorial how to remove libraries for ffmpeg? I'm not familiar with NDK

@NilaySheth
Copy link

Yes, if anyone could share some document for doing this, then that would be great as I am using FFmpegAndroid but not very familiar with NDK.

@Pkmmte
Copy link

Pkmmte commented Dec 2, 2016

I agree with the above statements.
A lot of us here probably aren't familiar with the NDK. A simple document detailing how to split the binaries would be very helpful.

I personally find it frustrating having spent weeks optimizing all assets in my APK only for it to become 5x larger after including this library...

@jaydeepbhanderi007
Copy link

same problem here. i removed those files from x86 and armv7 and output is in forcestoping app. can any one help us and above mate?

@sashatinkoff
Copy link

I was able to remove unused architecture. If somebody is wonder, I can share it with you.

@jaydeepbhanderi007
Copy link

please share it with me.

@sashatinkoff
Copy link

@jaydeepbhanderi007
Copy link

thanks for sharing the lib. all are working. i replaced your file with my larger file. but apk size is still >35 mb. apk size not reducing. i also tried clean and rebuild project after replacing your lib.

@sashatinkoff
Copy link

You shouldn't use both aar files, only one. As for me, I use gradle to make flavor for different architectures, one for x86 and another one for arm. AFAIK, x86 is not popular architecture so I decided to not publish build for it.

@jaydeepbhanderi007
Copy link

ok thanks a lot for helping. thanks again.

@jaydeepbhanderi007
Copy link

jaydeepbhanderi007 commented Dec 28, 2016 via email

@jossydeleon
Copy link

@sashatinkoff do you mind if you upload the file again? thank you

@sashatinkoff
Copy link

@zoedevelopers i've just created a repo on github https://github.com/sashatinkoff/ffmpeg-for-Android-compiled

@jossydeleon
Copy link

@sashatinkoff pretty soon, Thank you so much!!!

@sashatinkoff
Copy link

@zoedevelopers I've just updated a readme file. Using this short guide you can assemble a project for certain architecture

@jossydeleon
Copy link

@sashatinkoff do you know how to speed up the conversion using this lib? I just want to convert m4a and mp4 to mp3 but it is taking too long. Thanks. This library does not have enough support from theirs developers

@sashatinkoff
Copy link

@zoedevelopers I guess ffmpeg has couple of flags that can affect on speed conversion. Unfortunately I faced that native ffmpeg library seems a little outdated and doesn't support them (such as -preset ultrafast). If you'll find any way to do it please share your solution here =)

As for me, conversion seems too slow. To make it a little faster I reduce a size of input video / images. In fact, you'll get a video with low quality but it's a best way that I found how to handle it. Honestly speaking, I didn't spend a much time to find a solution that really works.

@gulzar1996
Copy link

This is kind of a hack but the initial apk size can drastically be reduced by downloading the .so files after installation.

@sanketthecoder
Copy link

@gulzar1996 So you mean no need to create different apks for different archs? And if it so, can you please tell where one can find those ".so" files and how any resource which can show how to implement ffmpeg using ".so" files? Help Appreciated :) Thank You.

@JasonOldWoo
Copy link

@gulzar1996 how to do it ?

@AbhishekDevani
Copy link

@sashatinkoff I saw ur aar file in github. If I want to make app for video to audio conversation bso which aar file is best for it from those three aar file and how it can be implement in my project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests