-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeShake.java
More file actions
35 lines (30 loc) · 1.24 KB
/
Copy pathDeShake.java
File metadata and controls
35 lines (30 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package org.myjava.shell;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
public class DeShake {
public static void main(String[] args) {
String bin = "/Users/liugang/Downloads/ffmpeg/bin/" ;
String source = "/Users/liugang/Downloads/source/sucai" ;
for (int i = 1; i <13 ; i++) {
callCMD(bin+"ffmpeg -y -i "+ i +".MP4 -vf vidstabdetect=result=transforms.trf:shakiness=10:tripod=1:show=1 -f null -",source);
callCMD(bin+"ffmpeg -y -i "+ i +".MP4 -vf vidstabtransform=input=transforms.trf:tripod=1 -b:v 5518k "+ i +"out.mp4",source);
}
}
private static void callCMD(String cmd, String... workspace) {
try {
File dir = null;
if (workspace[0] != null) {
dir = new File(workspace[0]);
}
Process process = Runtime.getRuntime().exec(cmd, null, dir);
int status = process.waitFor();
if (status != 0) {
System.err.println("Failed to call shell's command and the return status's is: " + status);
}
System.err.println(cmd + " " + "执行完成") ;
} catch (Exception e) {
e.printStackTrace();
}
}
}