-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathframes.coffee
39 lines (27 loc) · 1.01 KB
/
frames.coffee
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
require 'shelljs/global'
arg = require 'commander'
arg
.option('-i, --input <input>', 'Input', '')
.option('-o, --output <output>', 'Output', '')
.option('-f, --framerate <framerate>', 'Framerate', 24)
.option('-d, --duration <duration>', 'Duration', '')
.parse(process.argv)
mkdir '-p', arg.output
cmds = []
cmds.push "ffmpeg -i #{arg.input} -r #{arg.framerate} -t #{arg.duration} -q:v 1 -f image2 #{arg.output}/%01d.jpg"
cmds.push "ffmpeg -i #{arg.input} -t #{arg.duration} -vn -acodec copy #{arg.output}/audio.aac "
cmds.push "ffmpeg -i #{arg.input} -t #{arg.duration} -vn -b:a 192K #{arg.output}/audio.mp3 "
cmds.push "ffmpeg -i #{arg.input} -t #{arg.duration} -vn -acodec libvorbis #{arg.output}/audio.ogg "
num_cmds = cmds.length
progress = 0
run = (cmds) =>
if cmds.length is 0
return echo 'done'
echo "Progress #{progress} / #{num_cmds}"
cmd = cmds.shift()
exec cmd, (code, output) ->
# console.log('Exit code:', code);
# console.log('Program output:', output);
progress++
run cmds
run cmds