|
@ -2,6 +2,7 @@ package com.ai.ipu.videocompressor.func;
|
2
|
2
|
|
3
|
3
|
|
4
|
4
|
import org.json.JSONArray;
|
|
5
|
import org.json.JSONException;
|
5
|
6
|
|
6
|
7
|
import android.app.Activity;
|
7
|
8
|
import android.content.Context;
|
|
@ -19,12 +20,12 @@ public class MobileVideoCompress extends Plugin {
|
19
|
20
|
// String filePath = AppInfoUtil.getSdcardPath() + "/video.mp4";
|
20
|
21
|
// String desPath = AppInfoUtil.getSdcardPath() + "/videoto.mp4";
|
21
|
22
|
//
|
22
|
|
String filepath = "/sdcard" + "/video.mp4";
|
23
|
|
|
24
|
|
String decpath = "/sdcard" + "/to.mp4";
|
|
23
|
// String filepath = "/sdcard" + "/video.mp4";
|
|
24
|
//
|
|
25
|
// String decpath = "/sdcard" + "/to.mp4";
|
25
|
26
|
|
26
|
27
|
private static final int VIDEO_CAPTURE = 0;
|
27
|
|
String cmd = "-y -i " + filepath + " -strict -2 -vcodec libx264 -preset ultrafast -crf 24 -acodec aac -ar 44100 -ac 2 -b:a 96k -s 640x352 -aspect 16:9 " + decpath;
|
|
28
|
// String cmd = "-y -i " + filepath + " -strict -2 -vcodec libx264 -preset ultrafast -crf 24 -acodec aac -ar 44100 -ac 2 -b:a 96k -s 640x352 -aspect 16:9 " + decpath;
|
28
|
29
|
private Compressor com;
|
29
|
30
|
private VideoCompressUtil vcUtil;
|
30
|
31
|
|
|
@ -37,8 +38,12 @@ public class MobileVideoCompress extends Plugin {
|
37
|
38
|
/**
|
38
|
39
|
* ÊÓÆµÑ¹Ëõ
|
39
|
40
|
* @param params
|
|
41
|
* @throws Exception
|
40
|
42
|
*/
|
41
|
|
public void videoCompressor(JSONArray params) {
|
|
43
|
public void videoCompressor(JSONArray params) throws Exception {
|
|
44
|
String filepath = params.getString(0);
|
|
45
|
String decpath = "/sdcard" + "/to.mp4";
|
|
46
|
String cmd = "-y -i " + filepath + " -strict -2 -vcodec libx264 -preset ultrafast -crf 24 -acodec aac -ar 44100 -ac 2 -b:a 96k -s 640x352 -aspect 16:9 " + decpath;
|
42
|
47
|
vcUtil.videoCompressor(com, cmd);
|
43
|
48
|
}
|
44
|
49
|
/**
|