|
|
|
|
2
|
|
2
|
|
3
|
|
3
|
|
4
|
import org.json.JSONArray;
|
4
|
import org.json.JSONArray;
|
5
|
import org.json.JSONException;
|
|
|
6
|
|
5
|
|
7
|
import android.app.Activity;
|
6
|
import android.app.Activity;
|
8
|
import android.content.Context;
|
|
|
9
|
import android.content.Intent;
|
|
|
10
|
import android.database.Cursor;
|
7
|
import android.database.Cursor;
|
11
|
import android.net.Uri;
|
8
|
import android.net.Uri;
|
12
|
import android.util.Log;
|
9
|
import android.util.Log;
|
|
|
|
|
16
|
import com.wade.mobile.frame.IWadeMobile;
|
13
|
import com.wade.mobile.frame.IWadeMobile;
|
17
|
import com.wade.mobile.frame.plugin.Plugin;
|
14
|
import com.wade.mobile.frame.plugin.Plugin;
|
18
|
|
15
|
|
|
|
16
|
import java.sql.Date;
|
|
|
17
|
import java.text.SimpleDateFormat;
|
|
|
18
|
|
19
|
public class MobileVideoCompress extends Plugin {
|
19
|
public class MobileVideoCompress extends Plugin {
|
20
|
// String filePath = AppInfoUtil.getSdcardPath() + "/video.mp4";
|
20
|
// String filePath = AppInfoUtil.getSdcardPath() + "/video.mp4";
|
21
|
// String desPath = AppInfoUtil.getSdcardPath() + "/videoto.mp4";
|
21
|
// String desPath = AppInfoUtil.getSdcardPath() + "/videoto.mp4";
|
|
|
|
|
42
|
*/
|
42
|
*/
|
43
|
public void videoCompressor(JSONArray params) throws Exception {
|
43
|
public void videoCompressor(JSONArray params) throws Exception {
|
44
|
String filepath = params.getString(0);
|
44
|
String filepath = params.getString(0);
|
45
|
String decpath = "/sdcard" + "/to.mp4";
|
|
|
|
|
45
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_hhmmss");
|
|
|
46
|
Date date = new Date(System.currentTimeMillis());
|
|
|
47
|
String timeName = format.format(date);
|
|
|
48
|
String decpath = "/sdcard" + "/"+ timeName +".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;
|
49
|
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;
|
47
|
vcUtil.videoCompressor(com, cmd);
|
50
|
vcUtil.videoCompressor(com, cmd);
|
48
|
}
|
51
|
}
|