Added away-detect
[tpope-extra.git] / bin / nokia-media-converter
1 #!/bin/sh
2 # Author: Tim Pope
3
4 # Converts a media file to a format capable of being played on a supported
5 # mobile phone, such as the Nokia 3650 and 7650.
6
7 # Most software required by this script is fairly standard.  You will need
8 # a copy of RealProducer Basic 8.51 for Linux, which is free-as-in-beer,
9 # although a bit hard to come by.  A version might be available at
10 # <http://www.ezytech.com.cn/real/RealDownload/dlindex.htm>
11
12 [ -z "$TMPDIR" ] && TMPDIR=/tmp
13
14 if [ -z "$2" ]; then
15     echo "Usage: `basename $0` <infile> <outfile>"
16     exit 1
17 fi
18
19 IN="$1"
20 OUT="$2"
21
22 mencoder -oac mp3lame -channels 1 -ovc xvid -xvidencopts bitrate=800:me_quality=6:4mv -ofps 15 -vf scale=176:-2 -sws 2 -o "$TMPDIR/$OUT.avi" "$IN"
23 transcode -y mov -F 'raw ',twos -N 0x1 -P 0 -I 3 -k -z -i "$TMPDIR/$OUT.avi" -o "$TMPDIR/$OUT.mov"
24 rm -f "$TMPDIR/$OUT.avi"
25 realproducer -t 2 -a 1 -r 1 -k 1 -h "Tim Pope" -i "$TMPDIR/$OUT.mov" -o "$OUT" \
26     && rm -f "$TMPDIR/$OUT.mov"