summaryrefslogtreecommitdiffstats
path: root/tools/cut_video
diff options
context:
space:
mode:
authorOle Kristian Lien <ole.k.lien@gmail.com>2009-12-01 06:42:04 +0000
committerOle Kristian Lien <ole.k.lien@gmail.com>2009-12-01 06:42:04 +0000
commit0118f00cfc3d3f46fce44584fc0b2079c27db360 (patch)
tree1977ab8208d5ef9b5e684d9c981f470cfdd6c11e /tools/cut_video
parent4326a42534d68f2dc62ce4d2a19c5df1dd902758 (diff)
added some more scripts
Diffstat (limited to 'tools/cut_video')
-rw-r--r--tools/cut_video24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/cut_video b/tools/cut_video
new file mode 100644
index 0000000..2e12be9
--- /dev/null
+++ b/tools/cut_video
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# Date: 2009-11-30
+# Author: Ole Kristian Lien
+# License: GNU General Public License
+#
+# Cut video from x to y (seconds or hh:mm:ss).
+# Default duration, is the rest of the video.
+
+EXT=`echo "$1"|awk -F . '{print $NF}'`
+NAME=`basename $1 .$EXT`
+
+if [ -z "$3" ]; then
+ echo "Usage: $0 <video-file> <new-video-file> <start-pos> [<duration>]"
+ exit 1
+fi
+
+if [ -z "$4" ]; then
+ DURATION=`./duration $1`
+ ffmpeg -i $1 -ss $3 -t $DURATION -vcodec copy -acodec copy $NAME-new.$EXT
+
+else
+ ffmpeg -i $1 -ss $3 -t $4 -vcodec copy -acodec copy $NAME-new.$EXT
+fi