blob: 3fbcf81afd77de1861035f2c6ae7af9582fd2443 (
plain) (
blame)
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
|
#!/bin/sh
set -eu
makefile_pre() {
cat <<'EOF'
.POSIX:
FFMFLAGS = -y -hide_banner -loglevel warning
.SUFFIXES:
.SUFFIXES: .mpd .webmx .txt
.mpd.webmx:
cd $(?D) && ffmpeg $(FFMFLAGS) -i $(<F) $(*F).webm
touch $@
.txt.webmx:
ffmpeg $(FFMFLAGS) -f concat -i $< -c copy $*.webm
mkdir -p processed/"`basename $(*D)`"
ln -f $*.webm processed/"`basename $(*D)`"/
touch $@
all:
EOF
}
makefile_post() {
cat <<'EOF'
sources.webmx = $(sources.mpd:.mpd=.webmx)
combined.webmx = $(combined.txt:.txt=.webmx)
all: $(sources.webmx) $(combined.txt) $(combined.webmx)
$(combined.txt):
cd $(@D) && find */live.webm | LANG=POSIX.UTF-8 sort | \
sed 's|^|file |' > $(@F)
EOF
}
mpds() {
find data/*/*/live.mpd | LANG=POSIX.UTF-8 sort
}
mkdeps() {
mpds | varlist 'sources.mpd'
mpds | cut -d/ -f1-2 | sed 's,$,/combined.txt,' | uniq |
varlist 'combined.txt'
printf '\n'
mpds | sed 's/^\(.*\)\.mpd$/\1.webmx:\t\1.mpd/'
mpds | sed 's/^\(.*\)\.mpd$/\1.webm:\t\1.webmx/'
printf '\n'
mpds | sed 's/\.mpd$/.webm/' | awk -F/ '{
printf "data/%s/combined.txt:\t%s\n", $2, $0
}'
mpds | xargs dirname | xargs dirname | uniq |
sed 's|^\(.*\)$|\1/combined.webm:\t\1combined.txt|'
}
{
makefile_pre
mkdeps
makefile_post
} | make -f-
|