5 # ./convert_ts_to_flv.sh a/file.ts b/c/conv_unproc.flv b/c/conv.flv a/old
7 # Converts the supplied MPEG-2 ts file to FLV format.
17 UP_SUFFIX
=_before_flvtool2
19 if [ ! -f "$FLV_UP_FILENAME" -a \
20 ! -f "$FLV_FILENAME" ]; then
22 echo "Converting $TS_FILENAME"
23 ffmpeg
-re -r 25 -y -i "$TS_FILENAME" -b 900k
-async 1000 -ar 44100 -s $SIZE -f flv
-ar 22050 -acodec mp3
"$FLV_UP_FILENAME" 2> ffmpeg_stderr.txt
27 #echo 'mkdir -p "'$OLD_DIR'"'
29 #echo 'mv "'$TS_FILENAME'" "'$OLD_DIR'"'
30 mv "$TS_FILENAME" "$OLD_DIR"
31 #echo 'mv returned ' $?
33 if [[ $RETVAL != 0 ]]; then
35 echo '$ ffmpeg -re -r 25 -y -i "'$TS_FILENAME'" -b 900k -async 1000 -ar 44100 -s '$SIZE' -f flv -ar 22050 -acodec mp3 "'$FLV_FILENAME'"'
39 echo "Error: ffmpeg returned '"$RETVAL"'"
48 if [ -f "$FLV_FILENAME" ]; then
50 echo "Error: .flv filename already exists: " $FLV_FILENAME
53 elif [ -f "$FLV_UP_FILENAME" ]; then
55 echo "unprocessed filename already exists. Just converting it: " $FLV_UP_FILENAME
57 #echo 'mkdir -p "'$OLD_DIR'"'
59 #echo 'mv "'$TS_FILENAME'" "'$OLD_DIR'"'
60 mv "$TS_FILENAME" "$OLD_DIR"
61 #echo 'mv returned ' $?
65 echo "Error: did not convert but neither .flv nor unprocessed files exist."
71 if [ -f $FLV_UP_FILENAME ]; then
73 if [ ! -f $FLV_FILENAME ]; then
75 /home
/andy
/cvs
/flvtoolpp
/flvtoolpp
"$FLV_UP_FILENAME" "$FLV_FILENAME"
78 if [[ $RETVAL == 0 ]]; then
84 echo "Error: flvtoolpp returned non-zero!"
90 echo "Error: $FLV_UP_FILENAME would clash with existing file $FLV_FILENAME!"
96 echo "Error: unprocessed file does not exist after ffmpeg."