How can I compress a video file in Android before uploading to a remote server? I\'m not looking to zip up the file, because I don\'t think that will help much. I want to compre
We decided to save this functionality for another iteration of the project. We opted to warn the users of the large data payload (especially if they are not on Wi-Fi). I'm confident this can be done, and the link provided by tabbykitten is the best related SO post I've found on this topic to this date.
From Android 18 onwards you have direct android API to do Video Encoding but if you are targeting Less than API level 18 it not straight forward
the below link does the encoding https://github.com/google/grafika/blob/master/src/com/android/grafika/VideoEncoderCore.java
One of the app that I worked on earlier has this requirement of sending the video file after compressing it. Here are the steps I followed which worked:
Compress the file using a Silicompressor library in android. Run the compression task on a background thread.
The output file format will have the mime type "video/raw". You can check that in logcat. So, you need to add this mime type in your server so that the compressed file format is uploaded successfully.
After this is done, trying sending the compressed file and it should work.
Make sure the mime type of the file you are uploading to server is accepted by the server.
Read About this Library, its the best for new mobile which has a Full HD cameras
Compress Video with high quality for Java and Kotlin
I got a similar problem. Where I had to upload video in server having size within 5.4mb. But due to different camera resolutions of different phones, there was a problem. These are the solutions which I have opted
mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
mediaRecorder.setVideoEncodingBitRate(690000 );
Hope these will help you