summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-09-12 15:31:21 +0200
committerTobias Klauser <tklauser@distanz.ch>2014-09-12 15:31:21 +0200
commit604b8a69d8e941f408822017c0da32a5c563859e (patch)
treeff298a47004a3970c193918ef25cd34ce4b9ef84
parent60fbf331c4f5692bbc6017e05bda9072091b0c51 (diff)
func: Add audio conversion script (audioconv)
-rwxr-xr-x.zsh/func/audioconv32
1 files changed, 32 insertions, 0 deletions
diff --git a/.zsh/func/audioconv b/.zsh/func/audioconv
new file mode 100755
index 0000000..579660d
--- /dev/null
+++ b/.zsh/func/audioconv
@@ -0,0 +1,32 @@
+#!/bin/zsh
+#
+# func/audioconv
+#
+# convert from any audio format to any other (at least the ones that avconv supports)
+#
+# Copyright © 2014 Tobias Klauser <tklauser@distanz.ch>
+# Released under the terms of the Artistic Licence 2.0
+#
+# Source repository: git://git.distanz.ch/dotfiles/zsh.git
+#
+
+if [ $# -lt 2 ]; then
+ echo "Usage: ${0##*/} targetfmt file..."
+ return 1
+fi
+
+if [ -z $(which avconv) ]; then
+ echo avconv not found in PATH
+ return 1
+fi
+
+tfmt=$1
+shift
+
+for f in $argv; do
+ if [ -f $f ]; then
+ t="${f[@]:r}.$tfmt"
+ echo "$f > $t"
+ avconv -i "$f" -qscale:a 0 "$t"
+ fi
+done