Android Studio : Compress Video and Audio [closed]

独自空忆成欢 提交于 2020-01-07 02:57:09

问题


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


回答1:


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



回答2:


How bout this:
https://github.com/hoolrory/AndroidVideoSamples
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´s 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



来源:https://stackoverflow.com/questions/40828843/android-studio-compress-video-and-audio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!