我正在尝试压缩视频,但无法快速压缩。...也使用 silicompressor / Video Compressor and Compressor 。 上面的压缩器工作正常,但是根据视频选择花费了太多时间(例如:如果我选择2 MB视频,则需要3到4分钟进行压缩)
class VideoCompressAsyncTask extends AsyncTask<String, String, String> {
Context mContext;
String path = File path;
File directory = new File(path);
public VideoCompressAsyncTask(Context context) {
mContext = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
showProgress();
}
@Override
protected String doInBackground(String... paths) {
String filePath = null;
try {
filePath = SiliCompressor.with(mContext).compressVideo(myUrl, directory.getPath(), 0, 0, 0);
} catch (URISyntaxException e) {
e.printStackTrace();
}
return filePath;
}
@Override
protected void onPostExecute(String compressedFilePath) {
super.onPostExecute(compressedFilePath);
File imageFile = new File(compressedFilePath);
}
}
花费大量时间进行视频压缩