summaryrefslogtreecommitdiff
path: root/dot/local/bin/webm2opus
diff options
context:
space:
mode:
Diffstat (limited to 'dot/local/bin/webm2opus')
-rwxr-xr-xdot/local/bin/webm2opus32
1 files changed, 32 insertions, 0 deletions
diff --git a/dot/local/bin/webm2opus b/dot/local/bin/webm2opus
new file mode 100755
index 0000000..07688dd
--- /dev/null
+++ b/dot/local/bin/webm2opus
@@ -0,0 +1,32 @@
1#!/bin/sh
2OVERWRITE=
3printf_ds()
4{
5 local s
6 [ "$2" = 1 ] && s= || s=s
7 printf "$1" "$2" "$s"
8}
9
10fail=0
11skip=0
12for f in "$@"
13do
14 out=${f%.webm}.opus
15 if [ ! "$OVERWRITE" -a -e "$out" ]
16 then
17 skip=$((skip + 1))
18 continue
19 fi
20 ffmpeg -i "$f" -c:a copy "$out" || fail=$((fail + 1))
21done
22
23if [ "$skip" -gt 0 ]
24then
25 printf_ds 'Warning: refused to overwrite %d file%s\n' "$skip" "$s" >&2
26fi
27
28if [ "$fail" -gt 0 ]
29then
30 printf_ds 'Error: ffmpeg failed to convert %d file%s\n' "$fail" >&2
31 exit 1
32fi