-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstack-tbcs
executable file
·61 lines (57 loc) · 1.63 KB
/
stack-tbcs
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
#!/bin/bash -ex
# Read (and dropout-correct) several .tbc files representing the same video,
# and combine them using ffmpeg.
#
# Output is in .tbc format to stdout, for piping into ld-chroma-decoder using
# the JSON file from one of the inputs.
# XXX Assumes 3 inputs
if [ "$#" != 3 ]; then
echo "Must supply three input .tbc files"
exit 1
fi
in1="$1"
in2="$2"
in3="$3"
# XXX Assumes PAL
format="-f rawvideo -pix_fmt gray16 -s 1135x626 -r 25"
# XXX Option for this
mode="docmedian"
case "$mode" in
median)
# Median of three copies (does a pretty good job of removing dropouts by itself)
ffmpeg \
$format -i "$in1" \
$format -i "$in2" \
$format -i "$in3" \
-filter_complex xmedian=inputs=3 \
$format -
;;
docmedian)
# Median of three dropout-corrected copies
ffmpeg \
$format -i <(ld-dropout-correct --overcorrect --output-json /dev/null "$in1" -) \
$format -i <(ld-dropout-correct --overcorrect --output-json /dev/null "$in2" -) \
$format -i <(ld-dropout-correct --overcorrect --output-json /dev/null "$in3" -) \
-filter_complex xmedian=inputs=3 \
$format -
;;
mean)
# Mean of three copies
# XXX docs for mix call the option "nb_inputs"
ffmpeg \
$format -i "$in1" \
$format -i "$in2" \
$format -i "$in3" \
-filter_complex mix=inputs=3 \
$format -
;;
docmean)
# Mean of three dropout-corrected copies
ffmpeg \
$format -i <(ld-dropout-correct --overcorrect --output-json /dev/null "$in1" -) \
$format -i <(ld-dropout-correct --overcorrect --output-json /dev/null "$in2" -) \
$format -i <(ld-dropout-correct --overcorrect --output-json /dev/null "$in3" -) \
-filter_complex mix=inputs=3 \
$format -
;;
esac