Alternative recording and conversion scripts.
[recordtv.git] / scripts / convert_audiots_to_ogg.sh
blob2f43514fec98d74e92bd4d041e68a915b033e4bc
1 #!/bin/bash
3 # Usage:
5 # ./convert_audiots_to_ogg.sh file.ts file_converting.ogg prog.ogg old
7 # Converts the supplied MPEG-2 audio ts file to an Ogg Vorbis file
10 TS_FILENAME="$1"
11 CONV_FILENAME="$2"
12 OGG_FILENAME="$3"
13 OLD_DIR="$4"
15 if [ ! -f "$OGG_FILENAME" ]; then
17 echo "Converting $TS_FILENAME to Ogg Vorbis"
19 echo '$ ffmpeg -i "'$TS_FILENAME'" -acodec vorbis -aq 60 "'$CONV_FILENAME'"'
21 ffmpeg -i "$TS_FILENAME" -acodec vorbis -aq 60 "$CONV_FILENAME" > ffmpeg_out.txt 2>&1
23 RETVAL=$?
25 mkdir -p "$OLD_DIR"
26 mv "$TS_FILENAME" "$OLD_DIR"
28 if [[ $RETVAL != 0 ]]; then
30 #echo '$ ffmpeg -i "'$TS_FILENAME'" -acodec vorbis -aq 60 "'$CONV_FILENAME'"'
32 cat mencoder_out.txt
34 echo "Error: ffmpeg returned '"$RETVAL"'"
36 exit 2
37 }; fi
39 mv "$CONV_FILENAME" "$OGG_FILENAME"
41 rm ffmpeg_out.txt
43 else
45 echo "Error: .ogg filename already exists: " $OGG_FILENAME
46 exit 5
47 }; fi