I have an android application where there are quite a number of audio files(.mp3 format) in the raw folder of resources.But the problem it creates is that the size of my app has become very large. What are the ways which I can use to reduce the size of app. Can't I compress that folder or use other technique ?
you can minimize the size of mp3 by changing its sample rate and frequency so it will reduce its size almost 70 to 80 % but still its sound quality is good to hear
you can get mp3 compression or mp3 size reducer open source software on google
click here for software compatible with window
once you reduce your size of mp3 automatically size of your app will get reduce
also delete the all unnecessary images ,stuff,xml ,java file from application so its size will definately get reduce
The only options I see are:
increase the compression of your mp3's
load the mp3's from a different source ( via APK Expansion Files or from webserver )
Related
I'm using flutter camera plugin to record the video. But the recorded video size is too big. Something around 20mb for 1 min. How can I reduce the size (one of which is how to reduce resolution)? Also I have changed my VideoEncodingBitRate to 3000000. Like this mediaRecorder.setVideoEncodingBitRate(3000000);.
To reduce the size, you can employ any or both of these 2 methods:
Resolution
You can see them in the example
controller = CameraController(cameras[0], ResolutionPreset.medium);, change this to ResolutionPreset.low or some other customer value (does not have to be preset)
Encoding
You can use different encoding algorithms, such as FFmpeg using this plugin https://pub.dartlang.org/packages/flutter_ffmpeg. See also this question and its answers how to reduce size of video before upload to server programmatically in android
I am facing a programming problem
I am trying to encode video from camera frames that I have merged with other frames which were retrieved from other layer(like bitmap/GLsurface)
When I use 320X240 .I can make the merge in real time with fine FPS(~10),but when I try to increase the pixels size I am getting less than 6 FPS.
It is sensible as my merging function depend on the pixels size.
So what I ask is, how to store that Arrays of frames for after processing (encode)?
I don't know how to store this large arrays.
Just a quick calculation:
If i need to store 10 frame per second
and each frame is 960X720 pixel
so i need to store for 40 second video : 40X10X960X720X(3/2-android factor)=~ 276 MB
it is to much for heap
any idea?
You can simply record the camera input as video - 40 sec will not be a large file even at 720p resolution - and then offline you can decode, merge, and encode again. The big trick is that MediaRecorder will use hardware, so encoding will be really fast. Being compressed, the video can be written to sdcard or local file system in real time, and reading it for decoding is not an issue, too.
I'm developing an android application that has over 111MB of mp3 files.
I need to compress these files and put them in my package (like raw folder) and after my app was installed on a device, it decompresses files to use them.
How could I do this? Is this possible?
You can reduce mp3 file size by reducing the bit rate. Reducing the bit rate will result in smaller file size but lower quality, so you have to check what works best for you. You can improve the quality by using Variable Bit Rate (VBR) instead of Constant Bit Rate (CBR).
You can do that using a software such as Audacity.
Use Super C freeware, convert to AAC will also help.
While developing an Android app what format of sound/image should i should be using so that i can control the overall size of the app after completion.
here is a link to all the media types supported by Android.
For sound I would probably use a low-bitrate .mp3 or a .midi and for images either a compressed .jpg or .gif
For supported media formats see this.
For images you'll probably end up with JPG or PNG (if you need transparency). You should also scrape the images to remove all unnecessary meta data etc. For linux, a nice tool for this is Trimage.
Take a look at Supported Media Formats.
My choice would be:
Images: go with JPG for compression or PNG for quality and transparency support.
Audio: go with MP3-VBR (variable bit rate) for compression and quality.
The size of your file will be greatly affected by compression level. At some point, if you compress too much you will see/hear artifacts. The acceptable level of compression is subjective and really depends on the input data (image or audio). You should be testing different levels of compression to see what works.
I have an application 54 MB in size, of which 53 MB is an mp3 file in my res folder.
Due to the large application size , I am not able to run the application in the emulator. Getting error like "com.android.ddmlib.SyncException: No space left on device", "INSTALL_FAILED_CONTAINER_ERROR]", " the user data image is used by another emulator".
I increased the internal memory of my avd by setting "-partion-size 2047" and sometimes its running but most of time getting I'm getting the same problem.
Is it possible to reduce the mp3 file size?
Is there any another solution? please help.
What I see in many games to reduce the initial size is put all the "heavy" data outside the main apk and download it on the first run.
You have an example application of that here
How about having the application download the mp3 files to SD-card after the application have been installed?
Else, you could try and do some compression on the audio files.
Re-encoding the MP3 Files with a lower bitrate will reduce their size.
you should reduce the size of your MP3 file using a software like MP3 Resizer :downloadable here