feat: scripts
This commit is contained in:
29
scripts/ffmpegfaststart.js
Normal file
29
scripts/ffmpegfaststart.js
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env runjs
|
||||
|
||||
|
||||
var main = function() {
|
||||
if ($ARGS.length == 0) {
|
||||
xprintln('[ERROR] No arguments.');
|
||||
return;
|
||||
}
|
||||
var f = __.rfile.from($ARGS[0]);
|
||||
if (f.notExists()) {
|
||||
xprintln('[ERROR] File not exists: ' + $ARGS[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
var o = $ARGS[0];
|
||||
var n = $ARGS[0] + '.processed.mp4';
|
||||
xprintln('[INFO] Start process: ' + o);
|
||||
$$.shell(true).commands('ffmpeg', '-i', o, '-c:a', 'copy', '-c:v', 'copy', '-movflags', 'faststart', n).run();
|
||||
|
||||
$$.sleep(500);
|
||||
if ($ARGS.length > 1 && $STR($ARGS[1]) == "re") {
|
||||
if (__.rfile.from(n).exists()) {
|
||||
__.rfile.from(o).file().delete();
|
||||
$$.shell(true).commands("mv", n, o).run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user