summaryrefslogtreecommitdiffstats
path: root/tools/audio_extract
diff options
context:
space:
mode:
authorOle Kristian Lien <ole.k.lien@gmail.com>2009-12-10 06:22:08 +0000
committerOle Kristian Lien <ole.k.lien@gmail.com>2009-12-10 06:22:08 +0000
commiteb0f5ffae76f0834076793b5755e1e7c12705e88 (patch)
treec4f2b9aa79e14e9bb4cab1fddab4828811571741 /tools/audio_extract
parentf109c2fc7c7ed195003d9deb20710b49d86f12c8 (diff)
Diverse fikser :)
Diffstat (limited to 'tools/audio_extract')
-rw-r--r--tools/audio_extract29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/audio_extract b/tools/audio_extract
new file mode 100644
index 0000000..bd0afa8
--- /dev/null
+++ b/tools/audio_extract
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+# Date: 2009-11-30
+# Author: Ole Kristian Lien
+# License: GNU General Public License
+#
+# Extract audio from video-file
+
+EXT=`echo "$1"|awk -F . '{print $NF}'`
+NAME=`basename $1 .$EXT`
+FORMAT=`./audio_format $1`
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 <video-file> [<start-pos> <duration>]"
+ exit 1
+fi
+
+if [ "$FORMAT" == "pcm_s16le" ]; then
+ FORMAT="wav"
+fi
+
+if [ "$3" ]; then
+ #DURATION="30" #`./duration$1`
+ DURATION="$3"
+ #echo "start: $2 - Dur: $DURATION"
+ ffmpeg -i $1 -ss $2 -t $DURATION -vn -acodec copy $NAME.$FORMAT 2> /dev/null
+else
+ ffmpeg -i $1 -vn -acodec copy $NAME.$FORMAT 2> /dev/null
+fi