Fixed a bug where delete didn't work from a page where you supplied a "path".
[recordtv.git] / scripts / convert_ts_to_mp2.sh
blobdab1b853f9840b78e07ef26e9f0f860a2109fb2a
1 #!/bin/bash
3 # Usage:
5 # ./convert_ts_to_mp2.sh a/file.ts b/c/prog_converting.avi b/c/prog.avi a/old
7 # Converts the supplied MPEG-2 ts file to MPEG-2 640x480 format.
10 TS_FILENAME="$1"
11 CONV_FILENAME="$2"
12 MP2_FILENAME="$3"
13 OLD_DIR="$4"
15 SIZE=640x480
17 if [ ! -f "$MP2_FILENAME" ]; then
19 #echo "Converting $TS_FILENAME to MPEG-2 .avi"
20 echo $TS_FILENAME
22 #echo '$ mencoder -quiet '"'$TS_FILENAME'"' -o '"'$CONV_FILENAME'"' -vf pp=li,scale=640:480 -oac mp3lame -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=1200'
24 mencoder -quiet "$TS_FILENAME" -o "$CONV_FILENAME" -vf pp=li,scale=640:480 -oac mp3lame -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=1200 > mencoder_out.txt 2>&1
26 RETVAL=$?
28 mkdir -p "$OLD_DIR"
29 mv "$TS_FILENAME" "$OLD_DIR"
31 if [[ $RETVAL != 0 ]]; then
33 echo '$ mencoder -quiet '"'$TS_FILENAME'"' -o '"'$CONV_FILENAME'"' -vf pp=li,scale=640:480 -oac mp3lame -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=1200'
35 cat mencoder_out.txt
37 echo "** Error: mplayer returned '"$RETVAL"' **"
39 exit 2
40 }; fi
42 mv "$CONV_FILENAME" "$MP2_FILENAME"
44 rm mencoder_out.txt
46 else
48 echo "** Error: .mp2 filename already exists: " $MP2_FILENAME " **"
49 exit 5
50 }; fi