summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon GECOS <u@adam>2022-11-28 22:54:05 -0500
committerAndrew Cady <d@cryptonomic.net>2023-04-04 16:37:00 -0400
commit861b9ae3f2e250e45efc5bd4e8e045cd8c0da1bb (patch)
treef261c08af9e71fad372fd08b3bb3a9041d3cf9cf
parent20ee182befabc679b12d26e7ee64f52f58332802 (diff)
new command: 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