double speedUpFactor = 100.0; S text = [[ Coding 9:25-12:50 Coding 13:08-13:20 Coding 13:50-17:00 Coding 23:29-24:21 Coding 25:00-26:22 Coding 28:06-44:15 Coding 44:38-45:20 ]]; new L<DoubleRange> speedUpRanges; for (S line : lines(text)) { LS l = regexpFirstGroups("(\\d+):(\\d+)-(\\d+):(\\d+)", line); if (l == null) continue; speedUpRanges.add(doubleRange(minSecToSec(parseInt(l.get(0)), parseInt(l.get(1))), minSecToSec(parseInt(l.get(2)), parseInt(l.get(3))); } pnl(speedUpRanges); File inFile = videosDir("scribble.mkv"); // make q files (parts to be sped up) /*int i = 0; for (DoubleRange r : speedUpRanges) ffmpeg_cutVideo(inFile, videosDir("scribble/scribble-q" + ++i + ".mkv"), r.start, r.end);*/ // make n files (parts to stay normal speed) /*ffmpeg_cutVideo(inFile, videosDir("scribble/scribble-n0.mkv"), 0, first(speedUpRanges).start); ffmpeg_cutVideoRest(inFile, videosDir("scribble/scribble-n" + l(speedUpRanges) + ".mkv"), last(speedUpRanges).end); for (int i = 1; i < l(speedUpRanges); i++) ffmpeg_cutVideo(inFile, videosDir("scribble/scribble-n" + i + ".mkv"), speedUpRanges.get(i-1).end, speedUpRanges.get(i).start);*/ // speed up q files /*for i over speedUpRanges: { File in = videosDir("scribble/scribble-q" + (i+1) + ".mkv"); continue unless fileExists(in); ffmpeg_speedUpVideo(in, videosDir("scribble/scribble-qq" + (i+1) + ".mkv"), speedUpFactor); }*/ // merge new L<File> inFiles; for (int i = 0; i <= l(speedUpRanges)+1; i++) { addFileIfExists(inFiles, videosDir("scribble/scribble-n" + i + ".mkv")); addFileIfExists(inFiles, videosDir("scribble/scribble-qq" + (i+1) + ".mkv")); } ffmpeg_concatVideos( inFiles, 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: | 178 / 214 |
Referenced in: | -