summaryrefslogtreecommitdiffstats
path: root/tools/join_video
blob: 666314849856ec40644557748a03b19986912f85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
#
# Date:    2009-12-16
# Author:  Ole Kristian Lien
# License: GNU General Public License
#
# Joins together two or more video-files

EXT=`echo "$1"|awk -F . '{print $NF}'`
NAME=`basename $1 .$EXT`

if [ -z "$3" ]; then
        echo "Usage: $0 <new-file> <video-file> <video-file> [...]"
        exit 1
fi

array=()

for arg in $*; do
	array[${#array[*]}]=$arg
done

# remove first entry
unset array[0]

# todo: Concatenating works with MPEG-1, MPEG-2 PS and DV
if [ $EXT == "dv" ] ; then
echo "Joining video-files using cat..."
	cat ${array[*]} > $1
else
echo "Joining video-files using mencoder.."
	mencoder -oac copy -ovc copy -idx -o ${array[*]}
fi