summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2025-09-19 18:53:18 -0400
committerSacha Chua <sacha@sachachua.com>2025-09-19 18:53:38 -0400
commit8f272a96965fb15be36ce3666e1f7533353759b0 (patch)
tree71072d651204f37e254acde07edd6b3378caef03
parent37a7046cd6d2cf95a36c4f251cca6506d1069315 (diff)
downloademacsconf-ansible-8f272a96965fb15be36ce3666e1f7533353759b0.tar.xz
emacsconf-ansible-8f272a96965fb15be36ce3666e1f7533353759b0.zip
add mpv, captions
-rwxr-xr-xroles/caption/templates/process-captions.py2
-rw-r--r--roles/prerec/templates/Makefile11
-rwxr-xr-xroles/prerec/templates/process-prerec.sh3
3 files changed, 7 insertions, 9 deletions
diff --git a/roles/caption/templates/process-captions.py b/roles/caption/templates/process-captions.py
index fde766c..bdbfa1e 100755
--- a/roles/caption/templates/process-captions.py
+++ b/roles/caption/templates/process-captions.py
@@ -40,7 +40,7 @@ import json
import torch
THREADS = {{ cpus }}
-VIDEO_REGEXP = '\\.(webm|mov|mp4|mkv)$'
+VIDEO_REGEXP = '\\.(webm|mov|mp4|mkv|mpv)$'
AUDIO_REGEXP = '\\.(ogg|opus)$'
ALWAYS = False
TRIM_AUDIO = False
diff --git a/roles/prerec/templates/Makefile b/roles/prerec/templates/Makefile
index 8579965..d841cda 100644
--- a/roles/prerec/templates/Makefile
+++ b/roles/prerec/templates/Makefile
@@ -2,14 +2,13 @@
# To recreate this file, use ansible-playbook -i inventory.yml prod-playbook.yml --tags prerec-make
-VIDEO_EXTS = mp4 mkv webm mov
+VIDEO_EXTS = mp4 mkv webm mov mpv
source_patterns = $(foreach ext,$(VIDEO_EXTS),$(1)--original.$(ext))
PRERECS_ORIGINAL := $(wildcard emacsconf-*--original.*)
PREFIXES := $(shell for f in $(PRERECS_ORIGINAL); do echo "$${f%--original.*}"; done)
PRERECS_REENCODED := $(addsuffix --reencoded.webm, $(PREFIXES))
PRERECS_OPUS := $(addsuffix --reencoded.opus, $(PREFIXES))
-PRERECS_NORMAL := $(addsuffix --normalized.opus, $(PREFIXES))
PRERECS_MAIN := $(addsuffix --main.webm, $(PREFIXES))
PRERECS_CAPTIONS := $(addsuffix --reencoded.vtt, $(PREFIXES))
PRERECS_FINAL := $(wildcard emacsconf-*--final.webm)
@@ -17,14 +16,12 @@ LINODE_BBB_ID := 67329098
.PHONY: all
-all: reencoded opus normal main
+all: reencoded opus main
reencoded: $(PRERECS_REENCODED)
opus: $(PRERECS_OPUS)
-normal: $(PRERECS_NORMAL)
-
captions: $(PRERECS_CAPTIONS)
main: $(PRERECS_MAIN)
@@ -38,7 +35,7 @@ emacsconf-%--reencoded.webm:
exit 1; \
fi
@echo "Using source: $(SOURCE)"
- ./reencode-in-screen.sh "$(SOURCE)"
+ reencode-in-screen.sh "$(SOURCE)"
emacsconf-%--reencoded.opus: emacsconf-%--reencoded.webm
ffmpeg -y -i "$<" -c:a copy "$@"
@@ -70,7 +67,7 @@ emacsconf-%--main.opus: emacsconf-%--main.webm
ffmpeg -y -i "$<" -c:a copy "$@"
emacsconf-%--reencoded.vtt: emacsconf-%--reencoded.opus
- whisperx --model large-v2 --align_model WAV2VEC2_ASR_LARGE_LV60K_960H --compute_type int8 --print_progress True --max_line_width 50 --segment_resolution chunk --max_line_count 1 --language en "$<"
+ whisperx --model large-v3 --align_model WAV2VEC2_ASR_LARGE_LV60K_960H --compute_type int8 --print_progress True --max_line_width 50 --segment_resolution chunk --max_line_count 1 --language en "$<"
emacsconf-%--backstage--silences.csv: emacsconf-%--reencoded.opus
ffmpeg -i "$<" -af silencedetect=noise=-30dB:d=0.5 -f null - 2>&1 | awk '/silence_start/ {start=$$NF} /silence_end/ {print start "," (start + $$NF)}' > "$@"
diff --git a/roles/prerec/templates/process-prerec.sh b/roles/prerec/templates/process-prerec.sh
index d98337f..d0f5fa7 100755
--- a/roles/prerec/templates/process-prerec.sh
+++ b/roles/prerec/templates/process-prerec.sh
@@ -5,9 +5,10 @@ ORIGINAL=$1
REENCODED=$(echo "$ORIGINAL" | perl -pe 's/^(emacsconf-[0-9]*-.*?--.*?--.*?--).*/$1reencoded.webm/')
SLUG=$(echo "$ORIGINAL" | perl -ne '/^emacsconf-[0-9]*-(.*?)--/ && print $1')
MAIN=$(echo "$ORIGINAL" | perl -pe 's/^(emacsconf-[0-9]*-.*?--.*?--.*?--).*/$1main.webm/')
+VTT=$(echo "$ORIGINAL" | perl -pe 's/^(emacsconf-[0-9]*-.*?--.*?--.*?--).*/$1main.vtt/')
# ( cd /data/emacsconf/cache; ./update-cache )
# /data/emacsconf/admin/{{ emacsconf_year }}/scripts/talk $SLUG "WAITING_FOR_PREREC" "PROCESSING"
if [[ ! -f "$REENCODED" ]]; then
screen -dmS reencode-$SLUG /bin/bash -c "reencode.sh \"$ORIGINAL\" \"$REENCODED\" && upload.sh $REENCODED $MAIN && thumbnail.sh \"$MAIN\" && upload.sh $(echo "$MAIN" | sed s/webm$/png/); echo $(date -Iminutes) $SLUG reencoded >> ~/emacsconf.log && exec /bin/bash" &
fi
-screen -dmS captions-$SLUG /bin/bash -c "/data/emacsconf/admin/{{ emacsconf_year }}/scripts/process-captions.py $(dirname $ORIGINAL); echo $(date -Iminutes) $SLUG captioned >> ~/emacsconf.log; exec /bin/bash"
+screen -dmS captions-$SLUG /bin/bash -c "make $VTT; echo $(date -Iminutes) $SLUG captioned >> ~/emacsconf.log; exec /bin/bash"