blob: 87702ad221d99c158e3d4a172bcf69a7e4bd6e27 (
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
|
#!/usr/bin/env bash
# {{ ansible_managed }}
# Mixes in captions
# Usage: scripts/mux-subs.sh $video $vtt
set -euo pipefail
cleanup() {
if [[ -v tmp_file ]]; then
rm -f -- "$tmp_file"
fi
}
trap cleanup EXIT
vid="$1"
sub="$2"
if head -1 "$sub" | grep -q -- captioned; then
tmp_file="$(basename "$vid" ".webm")-new.webm"
ffmpeg -y -i "$vid" -i "$sub" -c copy -metadata:s:s:0 language=eng -disposition:s:s:0 default "$tmp_file" && \
mv "$tmp_file" "$vid"
else
touch -m "$vid"
fi
|