From 604b8a69d8e941f408822017c0da32a5c563859e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 12 Sep 2014 15:31:21 +0200 Subject: func: Add audio conversion script (audioconv) --- .zsh/func/audioconv | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 .zsh/func/audioconv (limited to '.zsh/func/audioconv') 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 +# 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 -- cgit v1.2.3-54-g00ecf