video.sh
1.79 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
function dvdinfo() {
local TRACK="${1:-1,-1,1}"
tccat -i /dev/cdrom -T "${TRACK}" |ffprobe -i -
}
function dvdrip() {
local OPT OPTARG OPTIND
local OPTEND=0
local TRACK="1,-1,1"
local PRESET="veryslow"
local TUNE="film"
local OUTFILE="/home/ghopp/data/dvdrip.mp4"
local USAGE="$(cat <<-EOT
Usage: $0 [-T track] [-p preset] [-t tune] [-o outfile] [MAP]...
EOT
)"
while getopts T:p:t:o:h- OPT
do
case $OPT in
T) TRACK="${OPTARG:-${TRACK}}";;
p) PRESET="${OPTARG:-${PRESET}}";;
t) TUNE="${OPTARG:-${TUNE}}";;
o) OUTFILE="${OPTARG:-${OUTFILE}}";;
-) OPTEND=1;;
h) echo ${USAGE} && return 0;;
?) echo ${USAGE} && return 1;;
esac
[[ $OPTEND -eq 1 ]] && break
done
shift $((OPTIND - 1))
tccat -i /dev/cdrom -T "${TRACK}" |\
ffmpeg -i - -map "${*// / -map }" -c:v libx264 -vf format=yuv420p \
-preset ${PRESET} -tune ${TUNE} -c:a mp3 -ac 1 ${OUTFILE}
}
function filmrip() {
local OPT OPTARG OPTIND
local OPTEND=0
local USAGE="$(cat <<-EOT
Usage: $0 [-T track] [-o outfile] [MAP]...
EOT
)"
while getopts T:p:t:o:h- OPT
do
case $OPT in
T) TRACK="${OPTARG}";;
o) OUTFILE="${OPTARG}";;
-) OPTEND=1;;
h) echo ${USAGE} && return 0;;
?) echo ${USAGE} && return 1;;
esac
[[ $OPTEND -eq 1 ]] && break
done
shift $((OPTIND - 1))
dvdrip -T "${TRACK}" -o "${OUTFILE}" $@
}
function animationrip() {
local OPT OPTARG OPTIND
local OPTEND=0
local USAGE="$(cat <<-EOT
Usage: $0 [-T track] [-o outfile] [MAP]...
EOT
)"
while getopts T:p:t:o:h- OPT
do
case $OPT in
T) TRACK="${OPTARG}";;
o) OUTFILE="${OPTARG}";;
-) OPTEND=1;;
h) echo ${USAGE} && return 0;;
?) echo ${USAGE} && return 1;;
esac
[[ $OPTEND -eq 1 ]] && break
done
shift $((OPTIND - 1))
dvdrip -T "${TRACK}" -o "${OUTFILE}" -t animation $@
}
# vim: set ts=4 sw=4: