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: