Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

62
LINES

< > BotCompany Repo | #1029708 // Speed up parts of video

JavaX (incomplete)

1  
double speedUpFactor = 100.0;
2  
3  
S text = [[
4  
  Coding 9:25-12:50
5  
  Coding 13:08-13:20
6  
  Coding 13:50-17:00
7  
  Coding 23:29-24:21 
8  
  Coding 25:00-26:22
9  
  Coding 28:06-44:15
10  
  Coding 44:38-45:20
11  
]];
12  
13  
new L<DoubleRange> speedUpRanges;
14  
for (S line : lines(text)) {
15  
  LS l = regexpFirstGroups("(\\d+):(\\d+)-(\\d+):(\\d+)", line);
16  
  if (l == null) continue;
17  
  speedUpRanges.add(doubleRange(minSecToSec(parseInt(l.get(0)), parseInt(l.get(1))),
18  
    minSecToSec(parseInt(l.get(2)), parseInt(l.get(3)));
19  
}
20  
21  
pnl(speedUpRanges);
22  
23  
File inFile = videosDir("scribble.mkv");
24  
25  
// make q files (parts to be sped up)
26  
27  
/*int i = 0;
28  
for (DoubleRange r : speedUpRanges)
29  
  ffmpeg_cutVideo(inFile, videosDir("scribble/scribble-q" + ++i + ".mkv"),
30  
    r.start, r.end);*/
31  
32  
// make n files (parts to stay normal speed)
33  
  
34  
/*ffmpeg_cutVideo(inFile, videosDir("scribble/scribble-n0.mkv"),
35  
  0, first(speedUpRanges).start);
36  
37  
ffmpeg_cutVideoRest(inFile, videosDir("scribble/scribble-n" + l(speedUpRanges) + ".mkv"),
38  
  last(speedUpRanges).end);
39  
40  
for (int i = 1; i < l(speedUpRanges); i++)
41  
  ffmpeg_cutVideo(inFile, videosDir("scribble/scribble-n" + i + ".mkv"),
42  
    speedUpRanges.get(i-1).end, speedUpRanges.get(i).start);*/
43  
44  
// speed up q files
45  
/*for i over speedUpRanges: {
46  
  File in = videosDir("scribble/scribble-q" + (i+1) + ".mkv");
47  
  continue unless fileExists(in);
48  
  ffmpeg_speedUpVideo(in,
49  
    videosDir("scribble/scribble-qq" + (i+1) + ".mkv"),
50  
    speedUpFactor);
51  
}*/
52  
53  
// merge
54  
new L<File> inFiles;
55  
for (int i = 0; i <= l(speedUpRanges)+1; i++) {
56  
  addFileIfExists(inFiles, videosDir("scribble/scribble-n" + i + ".mkv"));
57  
  addFileIfExists(inFiles, videosDir("scribble/scribble-qq" + (i+1) + ".mkv"));
58  
}
59  
60  
ffmpeg_concatVideos(
61  
  inFiles,
62  
  videosDir("scribble/scribble-merged-" + speedUpFactor + ".mkv"));

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1029708
Snippet name: Speed up parts of video
Eternal ID of this version: #1029708/1
Text MD5: c121e31a45123837d6ec4e0c2daf8dd8
Author: stefan
Category: javax
Type: JavaX (incomplete)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-08 10:11:54
Source code size: 1842 bytes / 62 lines
Pitched / IR pitched: No / No
Views / Downloads: 179 / 215
Referenced in: [show references]