1

Working to compress Video and Audio files in Android Studio. I need Useful suggestion and links. I went through some of these links but didn't found much helpful . How to compress video in android` ,

Is there possibility to compress audio and video file in android programmatically?,

FFmpegFrameGrabber crashes 100% of time attempting to compress video on Android

Please help me. Thanks

Community
  • 1
  • 1
Bishnu Dudhraj
  • 277
  • 2
  • 7
  • 22

2 Answers2

3

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:

Mick
  • 24,231
  • 1
  • 54
  • 120
  • Hi, Can you please recommend a simple video compressor code in java android for compressing videos available in the gallery so that reduced size videos can be uploaded to the server, in fastest way possible. – Shubham1164 Jan 09 '19 at 09:40
  • @Shubham1164 - Stackoverflow is not the best place to ask for recommendations, as its discourages opinion based and recommendations. Having said that if you check here you will find some examples like: https://stackoverflow.com/q/32457896/334402 – Mick Jan 09 '19 at 10:03
2

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

Sambhav Khandelwal
  • 3,585
  • 2
  • 7
  • 38
Azeros
  • 89
  • 8