Repository navigation
Expand file tree
/
Copy pathConcatTest.java
More file actions
66 lines (44 loc) · 1.51 KB
/
Copy pathConcatTest.java
File metadata and controls
66 lines (44 loc) · 1.51 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package org.ffmpeg.android.test;
import java.io.File;
import java.util.ArrayList;
import java.util.Locale;
import net.sourceforge.sox.SoxController;
import org.ffmpeg.android.Clip;
import org.ffmpeg.android.FfmpegController;
import org.ffmpeg.android.ShellUtils;
public class ConcatTest {
public static void test (String videoRoot, String fileTmpPath, String fileOut, double fadeLen) throws Exception
{
File fileTmp = new File(fileTmpPath);
File fileAppRoot = new File("");
File fileVideoRoot = new File(videoRoot);
FfmpegController fc = new FfmpegController(null, fileTmp);
SoxController sxCon = new SoxController(null, fileAppRoot, null);
ArrayList<Clip> listVideos = new ArrayList<Clip>();
String[] fileList = fileVideoRoot.list();
for (String fileVideo : fileList)
{
if (fileVideo.endsWith("mp4"))
{
Clip clip = new Clip();
clip.path = new File(fileVideoRoot,fileVideo).getCanonicalPath();
fc.getInfo(clip);
clip.duration = clip.duration-fadeLen;
listVideos.add(clip);
}
}
Clip clipOut = new Clip ();
clipOut.path = new File(fileOut).getCanonicalPath();
fc.concatAndTrimFilesMP4Stream(listVideos, clipOut, false, false, new ShellUtils.ShellCallback() {
@Override
public void shellOut(String shellLine) {
System.out.println("fc>" + shellLine);
}
@Override
public void processComplete(int exitValue) {
if (exitValue < 0)
System.err.println("concat non-zero exit: " + exitValue);
}
});
}
}