summaryrefslogtreecommitdiffstats
path: root/convert2mp3
diff options
context:
space:
mode:
authorFlorian Pritz <f-p@gmx.at>2009-04-21 15:12:11 +0200
committerFlorian Pritz <f-p@gmx.at>2009-04-21 15:12:11 +0200
commit3fb1b0ebde6e7d81d20d1aee7d8d4576e1bf296e (patch)
tree302048335b0b990dacde4ea6ede64863d2273e3a /convert2mp3
parentd04aa0b80f216b3b24558cbcb139bc110c214913 (diff)
downloadbin-3fb1b0ebde6e7d81d20d1aee7d8d4576e1bf296e.tar.gz
bin-3fb1b0ebde6e7d81d20d1aee7d8d4576e1bf296e.tar.xz
script to convert audio to mp3
uses mplayer and lame
Diffstat (limited to 'convert2mp3')
-rwxr-xr-xconvert2mp327
1 files changed, 27 insertions, 0 deletions
diff --git a/convert2mp3 b/convert2mp3
new file mode 100755
index 0000000..5f5a2fa
--- /dev/null
+++ b/convert2mp3
@@ -0,0 +1,27 @@
+#!/bin/bash
+#----------------------------------------------------
+# Version: 0.1.0
+# Author: Florian "Bluewind" Pritz <f-p@gmx.at>
+#
+# Copyright (C) 2009 Florian Pritz
+#
+# Licensed under GNU General Public License v3
+# (see COPYING for full license text)
+#
+#----------------------------------------------------
+# Converts a file to an MP3
+#----------------------------------------------------
+
+for i in "$@"; do
+ pushd . &> /dev/null
+ cd "$(dirname "$i")"
+
+ file="$(basename "$i")"
+ file_mp3="$(echo ${file} | sed 's/\(.*\)\..*/\1/').mp3"
+ tmpfile="$(mktemp)"
+
+ mplayer -ao pcm:fast -novideo -vc null -vo null -ao pcm:file="$tmpfile" "$file"
+ lame -h "$tmpfile" "$file_mp3"
+
+ popd &> /dev/null
+done