-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathfix_left2stereo
executable file
·41 lines (31 loc) · 1.3 KB
/
fix_left2stereo
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
40
41
#!/bin/bash
# left 2 stereo mix
scriptdir=`dirname "$0"`
. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;};
cleanup(){
log -a "Process aborted"
exit 1
}
trap cleanup SIGHUP SIGINT SIGTERM
log -b
suffix="_left2stereo"
if test $# != 1 ; then
report -wt "You must supply one argument. Refer to a file after calling the `basename $0` script."; exit
fi
while [ "$*" != "" ] ; do
input_movie="$1"
name=`basename "$1"`
codec_tag_string=`ffprobe -show_streams -print_format compact "$input_movie" 2>/dev/null| grep codec_type=video | grep -o "codec_tag_string=[^|]*" | cut -d= -f2`
[ "$codec_tag_string" = "mpeg" ] && { ffmpeg_opts+=" -c:v copy -c:a pcm_s24le " ; extension="mxf" ; } ;
[ "$codec_tag_string" = "mpeg" ] || { ffmpeg_opts+=" -c:v copy -c:a pcm_s24le " ; extension="mov" ; } ;
if [ -f "${input_movie%.*}${suffix}.${extension}" ] ; then
report -wt "The intended output of `basename $0` already exists. Skipping for now. Please delete \"${input_movie%.*}${suffix}.${extension}\" and rerun or figure out why you are trying to do this."
else
cmd="ffmpeg -i '$input_movie' $ffmpeg_opts -filter pan=stereo:c0=c0:c1=c0 '${input_movie%.*}${suffix}.${extension}'"
echo "$cmd"
eval "$cmd"
report -dt " `basename $0` is done with ${name}."
fi
shift
done
log -e