summaryrefslogtreecommitdiffstats
path: root/roles/prerec
diff options
context:
space:
mode:
Diffstat (limited to 'roles/prerec')
-rw-r--r--roles/prerec/templates/Makefile11
-rwxr-xr-xroles/prerec/templates/process-prerec.sh6
-rwxr-xr-xroles/prerec/templates/reencode.sh6
-rwxr-xr-xroles/prerec/templates/upload.sh2
4 files changed, 14 insertions, 11 deletions
diff --git a/roles/prerec/templates/Makefile b/roles/prerec/templates/Makefile
index 8579965..f58c5d6 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 --initial_prompt "Transcribe this talk about Emacs. It may mention Emacs keywords such as Org Mode, Org Roam, Magit, gptel, or chatgpt-shell, or tech keywords such as LLMs. Format function names and keyboard shortcut sequences according to Emacs conventions using Markdown syntax. For example: control h becomes \`C-h\`." "$<"
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..4347576 100755
--- a/roles/prerec/templates/process-prerec.sh
+++ b/roles/prerec/templates/process-prerec.sh
@@ -5,9 +5,11 @@ 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]*-.*?--.*?--.*?--).*/$1reencoded.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" &
+ screen -dmS reencode-$SLUG /bin/bash -c "reencode.sh \"$ORIGINAL\" \"$REENCODED\" && make $MAIN && upload.sh $REENCODED $MAIN && thumbnail.sh \"$MAIN\" && upload.sh $(echo "$MAIN" | sed s/webm$/png/); echo $(date -Iminutes) $SLUG reencoded >> ~/emacsconf.log && make $VTT; echo $(date -Iminutes) $SLUG captioned >> ~/emacsconf.log; exec /bin/bash" &
+else
+ screen -dmS captions-$SLUG /bin/bash -c "make $VTT; echo $(date -Iminutes) $SLUG captioned >> ~/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"
diff --git a/roles/prerec/templates/reencode.sh b/roles/prerec/templates/reencode.sh
index 665fee2..ac5309a 100755
--- a/roles/prerec/templates/reencode.sh
+++ b/roles/prerec/templates/reencode.sh
@@ -10,6 +10,9 @@ print_only=false
limit_resolution={{ res_y }}
limit_fps={{ fps }}
+output_final="${2:-$(echo $input | sed 's/--original.*/--reencoded.webm/')}"
+output_temp="partial--${output_final}" # <-- New temporary name
+
while getopts :q:c:t:s OPT; do
case $OPT in
q|+q)
@@ -47,7 +50,7 @@ ffmpeg -y -i "$input" $time_limit \
fps='$limit_fps'" \
-c:v libvpx-vp9 -b:v 0 -crf $q -c:a libopus \
-row-mt 1 -tile-columns 2 -tile-rows 2 -cpu-used $cpu \
- -pass 2 -threads $cpu -- "$output"
+ -pass 2 -threads $cpu -- "$output_temp"
EOF
)"
@@ -55,4 +58,5 @@ if [ $print_only == true ]; then
echo "$command"
else
eval "$command"
+ mv "$output_temp" "$output_final"
fi
diff --git a/roles/prerec/templates/upload.sh b/roles/prerec/templates/upload.sh
index 09d55d9..03cc66a 100755
--- a/roles/prerec/templates/upload.sh
+++ b/roles/prerec/templates/upload.sh
@@ -2,5 +2,5 @@
# {{ ansible_managed }}
scp $* orga@media.emacsconf.org:~/backstage
-/usr/local/bin/publish-backstage-index.sh
+# /usr/local/bin/publish-backstage-index.sh
rsync -avze ssh orga@media.emacsconf.org:~/backstage/ /data/emacsconf/shared/{{ emacsconf_year }}/cache/