-
Notifications
You must be signed in to change notification settings - Fork 1
/
mks60
executable file
·48 lines (37 loc) · 1.06 KB
/
mks60
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
42
43
44
45
46
47
48
#!/bin/bash
. mp4tools
[ "$#" -lt 1 ] && exec echo "usage: $0 <file> [outfile] [bitrate]"
X264OPTS='nocabac:qcomp=0.8:level_idc=12:ref=3:partitions=all:direct=auto:me=umh:subme=7:mixed-refs'
#XVIDOPTS='max_bframes=0:chroma_opt'
TWIDTH=320
THEIGHT=240
VQ=${3:-24}
OUTFILE="${1%.*}.mp4"
[ "$#" -gt 1 ] && OUTFILE="$2"
analyse "$1"
scaleres $WIDTH $HEIGHT $TWIDTH $THEIGHT
if [ $HAS_AUDIO ]
then
audiorip "$1" /tmp/audio.$$.wav lavcresample=44100 || clean_tmp
normalize /tmp/audio.$$.wav || clean_tmp
if [ -z $HAS_VIDEO ]
then
AQ='0.2'
green "Audio only file, increasing quality a bit"
fi
aacplusencode /tmp/audio.$$.wav /tmp/audio.$$.aac $AQ || clean_tmp
rm -f /tmp/audio.$$.wav
fi
if [ $HAS_VIDEO ]
then
# OFPS=15
h264enc "$1" /tmp/video.$$.264 $X264OPTS $VQ || clean_tmp
# xvidenc "$1" /tmp/video.$$.m4v $XVIDOPTS $VB || clean_tmp
fi
avmux "$OUTFILE" || clean_tmp
if [ -n "$TITLE$ARTIST$ALBUM$YEAR$GENRE" -a -z "$HAS_VIDEO" ]
then
green "Writing Nokia Tags"
nokiatagger -t "$TITLE" -a "$ARTIST" -A "$ALBUM" -y "$YEAR" -g "$GENRE" "$OUTFILE"
fi
clean_tmp 0