summaryrefslogtreecommitdiffstats
path: root/tools/audio_extract
diff options
context:
space:
mode:
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