Android Studio : Compress Video and Audio [closed]

You can use ffmpeg in your Android project to compress video.

There are a number of approaches but a common approach is to use a wrapper around the ffmpeg command line tool. This allows you use the regular syntax off mpeg which is well documented.

As an example, this code uses ffmpeg to compress an mp4 file in Android:

String argv[] = {"ffmpeg", "-i", videoFileToCompress.getAbsolutePath(), "-strict", "experimental", 
                                                "-acodec", "aac", compressedVideoFile.getAbsolutePath()};

int ffmpegWrapperreturnCode = FfmpegJNIWrapper.call_ffmpegWrapper(this.ctx, argue);

The above, from https://github.com/mickod/ColabAndroidHelper, uses a custom ffmpeg wrapper.

There are a number of Android ffmpeg wrapper libraries now which seem to be well supported and which would be better to use, I think - one example is:

  • https://github.com/WritingMinds/ffmpeg-android-java

How about this ?

It´s a Java framework for working with video in Android (I don´t know if that´s what you need...but check it out)...

There is also the Intel INDE (https://software.intel.com/en-us/intel-inde) and Media Pack for Android which is a part of INDE.
Check out the ComposerTranscodeCoreActivity.java