#!/bin/sh
|
|
exist_file()
|
{
|
if [ -e "$1" ]
|
then
|
return 1
|
else
|
return 2
|
fi
|
}
|
|
if [ $# != 2 ] ; then
|
echo "USAGE: $0 media_src1 media_src2"
|
exit 1;
|
fi
|
|
arg1=`basename $1`
|
|
arg2=`basename $2`
|
|
mainN1=${arg1%%.*}
|
mainE=${arg1#*.}
|
mainN2=${arg2%%.*}
|
|
dirname=`dirname $1`
|
|
exist_file $1
|
value=$?
|
|
if [ $value -eq 2 ]
|
then
|
echo "No source media ${arg1} found in the directory! Put it here firstly!\n"
|
exit
|
fi
|
|
exist_file $2
|
value=$?
|
|
if [ $value -eq 2 ]
|
then
|
echo "No source media ${arg2} found in the directory! Put it here firstly!\n"
|
exit
|
fi
|
|
output1=${mainN1}.ts
|
output2=${mainN2}.ts
|
|
ffmpeg -i $1 -vcodec copy -acodec copy -vbsf h264_mp4toannexb ${output1}
|
ffmpeg -i $2 -vcodec copy -acodec copy -vbsf h264_mp4toannexb ${output2}
|
ffmpeg -i "concat:${output1}|${output2}" -acodec copy -vcodec copy -absf aac_adtstoasc ${mainN1}.${mainE}
|
|
rm -rf ${output1}
|
rm -rf ${output2}
|
rm -rf $1
|
mv ${mainN1}.${mainE} ${dirname}
|