Download Jar. Uses 11463K of libraries. Compilation Failed (6709L/45K).
1 | !7 |
2 | |
3 | lib 1013798 // jave |
4 | |
5 | import it.sauronsoftware.jave.*; |
6 | |
7 | p { |
8 | L<File> sources = map gudrun_silent(ll("hallo", "du")); |
9 | File target = programFile("hallo-du.mp3"); |
10 | mergeMP3s(source, target); |
11 | printFileInfo(target); |
12 | } |
13 | |
14 | svoid mergeMP3s(L<File> sources, File out) ctex { |
15 | new DefaultFFMPEGLocator locator; |
16 | FFMPEGExecutor ffmpeg = locator.createExecutor(); |
17 | |
18 | ffmpeg.addArgument("-i"); |
19 | ffmpeg.addArgument("concat:" + join("|", map f2s(sources))); |
20 | |
21 | if (codec != null) { |
22 | ffmpeg.addArgument("-acodec"); |
23 | ffmpeg.addArgument("copy"); |
24 | } |
25 | |
26 | ffmpeg.addArgument(f2s(out)); |
27 | |
28 | ffmpeg.execute(); |
29 | |
30 | try { |
31 | String lastWarning = null; |
32 | long duration; |
33 | long progress = 0; |
34 | RBufferedReader reader = null; |
35 | reader = new RBufferedReader(new InputStreamReader(ffmpeg |
36 | .getErrorStream())); |
37 | MultimediaInfo info = parseMultimediaInfo(source, reader); |
38 | if (durationAttribute != null) { |
39 | duration = (long) Math |
40 | .round((durationAttribute.floatValue() * 1000L)); |
41 | } else { |
42 | duration = info.getDuration(); |
43 | if (offsetAttribute != null) { |
44 | duration -= (long) Math |
45 | .round((offsetAttribute.floatValue() * 1000L)); |
46 | } |
47 | } |
48 | if (listener != null) { |
49 | listener.sourceInfo(info); |
50 | } |
51 | int step = 0; |
52 | String line; |
53 | while ((line = reader.readLine()) != null) { |
54 | if (step == 0) { |
55 | if (line.startsWith("WARNING: ")) { |
56 | if (listener != null) { |
57 | listener.message(line); |
58 | } |
59 | } else if (!line.startsWith("Output #0")) { |
60 | throw new EncoderException(line); |
61 | } else { |
62 | step++; |
63 | } |
64 | } else if (step == 1) { |
65 | if (!line.startsWith(" ")) { |
66 | step++; |
67 | } |
68 | } |
69 | if (step == 2) { |
70 | if (!line.startsWith("Stream mapping:")) { |
71 | throw new EncoderException(line); |
72 | } else { |
73 | step++; |
74 | } |
75 | } else if (step == 3) { |
76 | if (!line.startsWith(" ")) { |
77 | step++; |
78 | } |
79 | } |
80 | if (step == 4) { |
81 | line = line.trim(); |
82 | if (line.length() > 0) { |
83 | Hashtable table = parseProgressInfoLine(line); |
84 | if (table == null) { |
85 | if (listener != null) { |
86 | listener.message(line); |
87 | } |
88 | lastWarning = line; |
89 | } else { |
90 | if (listener != null) { |
91 | String time = (String) table.get("time"); |
92 | if (time != null) { |
93 | int dot = time.indexOf('.'); |
94 | if (dot > 0 && dot == time.length() - 2 |
95 | && duration > 0) { |
96 | String p1 = time.substring(0, dot); |
97 | String p2 = time.substring(dot + 1); |
98 | try { |
99 | long i1 = Long.parseLong(p1); |
100 | long i2 = Long.parseLong(p2); |
101 | progress = (i1 * 1000L) |
102 | + (i2 * 100L); |
103 | int perm = (int) Math |
104 | .round((double) (progress * 1000L) |
105 | / (double) duration); |
106 | if (perm > 1000) { |
107 | perm = 1000; |
108 | } |
109 | listener.progress(perm); |
110 | } catch (NumberFormatException e) { |
111 | ; |
112 | } |
113 | } |
114 | } |
115 | } |
116 | lastWarning = null; |
117 | } |
118 | } |
119 | } |
120 | } |
121 | if (lastWarning != null) { |
122 | if (!SUCCESS_PATTERN.matcher(lastWarning).matches()) { |
123 | throw new EncoderException(lastWarning); |
124 | } |
125 | } |
126 | } finally { |
127 | ffmpeg.destroy(); |
128 | } |
129 | } |
Began life as a copy of #1013799
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1014079 |
Snippet name: | Concat MP3s using JAVE/ffmpeg Spike [dev.] |
Eternal ID of this version: | #1014079/1 |
Text MD5: | a83e0f7b2d1ca4a216ea03a14e3fe99f |
Transpilation MD5: | 2720a24e09c37d216f1c3f9bf2fc6fc4 |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-03-28 17:44:35 |
Source code size: | 3217 bytes / 129 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 451 / 997 |
Referenced in: | [show references] |