From 4bbd85cc7f5986417f7b9b866d075de33a4be0f4 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 5 Nov 2014 02:00:40 +0300 Subject: [PATCH] Pass output as a parameter; allow to pass many input files Pass output as a parameter; default is output.avi. Allow to pass many input files like *.vob. --- video/ff_catvideo | 9 +++++---- video/ff_cropdetect | 10 ++++++++-- video/ff_encode | 14 +++++++------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/video/ff_catvideo b/video/ff_catvideo index 852a349..34aafd2 100755 --- a/video/ff_catvideo +++ b/video/ff_catvideo @@ -1,12 +1,13 @@ #! /bin/sh -if [ -z "$2" ]; then - echo "Usage: $0 output.avi input1.avi [input2.avi...]" +if [ -z "$1" ]; then + echo "Usage: [output=output.avi] $0 input1 [input2...]" exit 1 fi -output="$1" -shift +if [ -z "$output" ]; then + output=output.avi +fi i=1 for input in "$@"; do diff --git a/video/ff_cropdetect b/video/ff_cropdetect index 59a2c40..9703298 100755 --- a/video/ff_cropdetect +++ b/video/ff_cropdetect @@ -1,8 +1,14 @@ #! /bin/sh if [ -z "$1" ]; then - echo "Usage: $0 input.avi" + echo "Usage: $0 input1 [input2...]" exit 1 fi -exec ffmpeg -i "$1" -vf cropdetect -an -f rawvideo -y /dev/null +if [ $# -eq 1 ]; then + input="$1" +else + input=concat:"`echo \"$@\" | sed 's/ /|/g'`" +fi + +exec ffmpeg -i "$input" -vf cropdetect -an -f rawvideo -y /dev/null diff --git a/video/ff_encode b/video/ff_encode index befff9d..c265ecd 100755 --- a/video/ff_encode +++ b/video/ff_encode @@ -1,7 +1,7 @@ #! /bin/sh if [ -z "$1" ]; then - echo "Usage: [vcodec=s] [vbitrate=n] [vscale=s] [acodec=s] [abitrate=n] [ascale=s] [pass=n] [input_opts=input_opts] [output_opts=output_opts] $0 input [output]" + echo "Usage: [vcodec=s] [vbitrate=n] [vscale=s] [acodec=s] [abitrate=n] [ascale=s] [pass=n] [input_opts=input_opts] [output_opts=output_opts] [output=output.avi] $0 input1 [input2...]" exit 1 fi @@ -29,13 +29,13 @@ if [ -z "$pass" ]; then pass=1 fi -input="$1" -shift - -if [ -n "$1" ]; then - output="$1" - shift +if [ $# -eq 1 ]; then + input="$1" else + input=concat:"`echo \"$@\" | sed 's/ /|/g'`" +fi + +if [ -z "$output" ]; then output=output.avi fi -- 2.39.2