Concatenate video files using intermediate MPEG files.
Takes a lot of time and disk space but quite reliable.
-----
Using ffmpeg:
-ff_encode - 1 and 2-pass encoding using different codecs.
ff_catvideo - concatenate few video files into one.
+ff_encode - 1 and 2-pass encoding using different codecs.
Using mplayer/mencoder:
m_catvideo - concatenate few video files into one.
#! /bin/sh
-if [ -z "$1" ]; then
- echo "Usage: $0 input.avi output.avi"
+if [ -z "$2" ]; then
+ echo "Usage: $0 output.avi input1.avi [input2.avi...]"
exit 1
fi
-exec ffmpeg -i "$1" -c copy "$2"
+output="$1"
+shift
+
+i=1
+for input in "$@"; do
+ iii="`printf \"%03d\" $i`"
+ ffmpeg -i "$input" -qscale:v 1 _tmp_$iii.mpg
+ i="`expr $i + 1`"
+done &&
+
+cat _tmp_*.mpg >_tmp_all.mpg &&
+ffmpeg -i _tmp_all.mpg -qscale:v 2 "$output" &&
+exec rm _tmp_*.mpg