From 8f5773905de15194fe3ae88499be8ec615a55587 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 3 Nov 2014 05:49:54 +0300 Subject: [PATCH] Fix ff_catvideo Concatenate video files using intermediate MPEG files. Takes a lot of time and disk space but quite reliable. --- readme.txt | 2 +- video/ff_catvideo | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/readme.txt b/readme.txt index f4746a1..8c9a39d 100644 --- a/readme.txt +++ b/readme.txt @@ -101,8 +101,8 @@ video ----- 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. diff --git a/video/ff_catvideo b/video/ff_catvideo index 7abfbc3..852a349 100755 --- a/video/ff_catvideo +++ b/video/ff_catvideo @@ -1,8 +1,20 @@ #! /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 -- 2.39.5