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 · 22 comments

Comments

Projects
None yet
@ghost

ghost 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 from Split project into three different libraries for x86, armv7 and armv7-neon to Reduce APK Size / Split project into three different libraries for x86, armv7 and armv7-neon Feb 23, 2016

@JayParikh20

This comment has been minimized.

Show comment
Hide comment
@JayParikh20

JayParikh20 Mar 18, 2016

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

JayParikh20 commented Mar 18, 2016

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

This comment has been minimized.

Show comment
Hide comment
@ivanviragine

ivanviragine Jun 21, 2016

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.

ivanviragine commented Jun 21, 2016

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

This comment has been minimized.

Show comment
Hide comment
@sashatinkoff

sashatinkoff Sep 17, 2016

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

sashatinkoff commented Sep 17, 2016

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

@NilaySheth

This comment has been minimized.

Show comment
Hide comment
@NilaySheth

NilaySheth Nov 15, 2016

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.

NilaySheth commented Nov 15, 2016

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

This comment has been minimized.

Show comment
Hide comment
@Pkmmte

Pkmmte 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...

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

This comment has been minimized.

Show comment
Hide comment
@jaydeepbhanderi007

jaydeepbhanderi007 Dec 27, 2016

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?

jaydeepbhanderi007 commented Dec 27, 2016

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

This comment has been minimized.

Show comment
Hide comment
@sashatinkoff

sashatinkoff Dec 27, 2016

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

sashatinkoff commented Dec 27, 2016

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

@jaydeepbhanderi007

This comment has been minimized.

Show comment
Hide comment
@jaydeepbhanderi007

jaydeepbhanderi007 Dec 27, 2016

please share it with me.

jaydeepbhanderi007 commented Dec 27, 2016

please share it with me.

@sashatinkoff

This comment has been minimized.

Show comment
Hide comment
@jaydeepbhanderi007

This comment has been minimized.

Show comment
Hide comment
@jaydeepbhanderi007

jaydeepbhanderi007 Dec 27, 2016

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.

jaydeepbhanderi007 commented Dec 27, 2016

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

This comment has been minimized.

Show comment
Hide comment
@sashatinkoff

sashatinkoff Dec 27, 2016

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.

sashatinkoff commented Dec 27, 2016

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

This comment has been minimized.

Show comment
Hide comment
@jaydeepbhanderi007

jaydeepbhanderi007 Dec 27, 2016

ok thanks a lot for helping. thanks again.

jaydeepbhanderi007 commented Dec 27, 2016

ok thanks a lot for helping. thanks again.

@jaydeepbhanderi007

This comment has been minimized.

Show comment
Hide comment
@jaydeepbhanderi007

jaydeepbhanderi007 Dec 28, 2016

jaydeepbhanderi007 commented Dec 28, 2016

@jossydeleon

This comment has been minimized.

Show comment
Hide comment
@jossydeleon

jossydeleon Feb 3, 2017

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

jossydeleon commented Feb 3, 2017

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

@sashatinkoff

This comment has been minimized.

Show comment
Hide comment
@sashatinkoff

sashatinkoff commented Feb 3, 2017

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

@jossydeleon

This comment has been minimized.

Show comment
Hide comment
@jossydeleon

jossydeleon Feb 3, 2017

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

jossydeleon commented Feb 3, 2017

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

@sashatinkoff

This comment has been minimized.

Show comment
Hide comment
@sashatinkoff

sashatinkoff Feb 9, 2017

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

sashatinkoff commented Feb 9, 2017

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

@jossydeleon

This comment has been minimized.

Show comment
Hide comment
@jossydeleon

jossydeleon Mar 1, 2017

@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

jossydeleon commented Mar 1, 2017

@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

This comment has been minimized.

Show comment
Hide comment
@sashatinkoff

sashatinkoff Mar 1, 2017

@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.

sashatinkoff commented Mar 1, 2017

@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

This comment has been minimized.

Show comment
Hide comment
@gulzar1996

gulzar1996 Aug 25, 2017

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

gulzar1996 commented Aug 25, 2017

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

@sanketthecoder

This comment has been minimized.

Show comment
Hide comment
@sanketthecoder

sanketthecoder Sep 4, 2017

@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.

sanketthecoder commented Sep 4, 2017

@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

This comment has been minimized.

Show comment
Hide comment
@JasonOldWoo

JasonOldWoo commented Mar 13, 2018

@gulzar1996 how to do it ?

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