summaryrefslogtreecommitdiffstats
path: root/tools/join_video
blob: ff752fa9aaa4a7481965b39787be67d225a56749 (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
34
35
36
37
38
39
#!/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 -n " * Joining video-files using cat..."
	cat ${array[*]} > $1
else
# elsif ext hdv video - m2t
echo -n " * Joining video-files using mencoder..."
	mencoder -oac copy -ovc copy -idx -o $1 ${array[*]} > "$NAME.log" 2>&1
	#rm $NAME.log
fi
echo -e "OK!"

# mencoder må hyssje!
# -quiet