我需要在我的Android应用中加快视频压缩速度.我正在使用FFMPEG,压缩80MB视频需要3分钟.有谁知道更好的解决方案?
我正在使用的命令是:
/data/data/com.moymer/app_bin/ffmpeg -y -i /storage/emulated/0/DCIM/Camera/VID_20150803_164811363.mp4 -s 640x352 -r 25 -vcodec mpeg4 -ac 1 -preset ultrafast -strict -2 /storage/emulated/0/DCIM/Camera/compressed_video.mp4
Run Code Online (Sandbox Code Playgroud)
我从这个github repo使用FFMPEG for Android运行此命令:https://github.com/guardianproject/android-ffmpeg-java
在我的项目中使用FFMPEG的代码在AsyncTask中,并在下面复制:
@Override
protected Object doInBackground(Object... params) {
ItemRoloDeCamera compressedVideo = new ItemRoloDeCamera();
File videoInputFile = new File(video.getSdcardPath());
File videoFolderFile = videoInputFile.getParentFile();
File videoOutputFile = new File(videoFolderFile, "video_comprimido_moymer.mp4");
if (videoFolderFile.exists())
android.util.Log.e("COMPRESS VIDEO UTILS", "video folder exist");
else
android.util.Log.e("COMPRESS VIDEO UTILS", "video folder DON'T exist");
if (videoInputFile.exists())
android.util.Log.e("COMPRESS VIDEO UTILS", "video input file exist");
else
android.util.Log.e("COMPRESS …Run Code Online (Sandbox Code Playgroud) 我需要在 Fresco 下载图像时实现一个循环进度条来显示和更新。该类必须按照 Fresco 的方法 setProgressBarImage() 的要求从 Drawable 扩展。
我的班级正在使用 Fresco 加载图像,如下面的代码段所示:
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image);
simpleDraweeView.getHierarchy().setProgressBarImage(new ProgressBarDrawable());
simpleDraweeView.setImageURI(message.getMessageImage().getImageFileUriForList());
Run Code Online (Sandbox Code Playgroud)
“图像” SimpleDraweeView 的 XML 如下:
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/image"
android:layout_width="192dp"
android:layout_height="200dp"
android:layout_margin="7dp"
android:layout_gravity="center"
fresco:actualImageScaleType="fitCenter"
tools:background="@drawable/gallery_attach_dialog" />
Run Code Online (Sandbox Code Playgroud)
问题是我需要用圆形来替换这个标准的水平进度条。而且 Fresco 不提供可绘制的圆形进度条。
有没有人对此有实现的想法?
我的构建在Android Studio中需要很长时间,超过2分钟,有时3分钟.我尝试了StackOverflow中解释的一些方法来加速构建时间,但它并没有解决我的问题.
app模块的build.gradle代码如下:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
// Adding The GIT SHA to Crashlytics crash reporting
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.moymer"
minSdkVersion 11
targetSdkVersion 22
multiDexEnabled true
versionCode 5
versionName "2.0.0"
buildConfigField "String", "GIT_SHA", "\"${gitSha}\""
}
buildTypes {
release {
minifyEnabled …Run Code Online (Sandbox Code Playgroud)