From 566d1807fe5a63a3071f9b559438b60761512069 Mon Sep 17 00:00:00 2001 From: Jan Koppe Date: Fri, 1 Nov 2024 21:31:38 +0100 Subject: [PATCH] render script for chunked recordings v1: it's slow, but it works --- dhcp2024/render-chunks.sh | 135 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100755 dhcp2024/render-chunks.sh diff --git a/dhcp2024/render-chunks.sh b/dhcp2024/render-chunks.sh new file mode 100755 index 0000000..f5eb5d5 --- /dev/null +++ b/dhcp2024/render-chunks.sh @@ -0,0 +1,135 @@ +#!/usr/bin/env bash +set -euxo pipefail + +# This script requires you to have ffmpeg and fzf installed. +which ffmpeg >/dev/null || (echo "Please install ffmpeg" ; exit 1) +which fzf >/dev/null || (echo "Please install fzf" ; exit 1) +which mpv >/dev/null || (echo "Please install mpv" ; exit 1) + +INTROS_PATH="/Users/j/dhcp24_voc_files/intros" +OUTROS_PATH="/Users/j/dhcp24_voc_files/outros" +CHUNKS_PATH="/Users/j/voc_obs/obs_record" +OUTPUT_PATH="/Users/j/voc_obs/obs_record/rendered" + +# Select the appropriate files +SELECTED_INTRO="$(find "$INTROS_PATH" -type f | sort --reverse --human-numeric-sort | fzf --delimiter / --with-nth -1 --prompt "Intro File:")" +SELECTED_OUTRO="$(find "$OUTROS_PATH" -type f | sort --reverse --human-numeric-sort | fzf --delimiter / --with-nth -1 --prompt "Outro File:")" +SELECTED_CHUNKS="$(find "$CHUNKS_PATH" -type f | sort --reverse | fzf --delimiter / --with-nth -1 -m --prompt "Video Chunks (use tab to select multiple):" | sort )" +readarray -t CHUNKS_ARRAY < <(echo "$SELECTED_CHUNKS") + +# find the start-offset for the first chunk +read -p "Do you want to play the first chunk ${CHUNKS_ARRAY[0]} to find the start-offset? (y/n) [n]: " PLAY_FIRST_CHUNK +PLAY_FIRST_CHUNK="${PLAY_FIRST_CHUNK:-n}" + +[[ "$PLAY_FIRST_CHUNK" == "y" ]] && mpv "${CHUNKS_ARRAY[0]}" --osd-level=3 --osd-status-msg='${=time-pos}' --really-quiet + +read -p "Enter the start-offset in seconds for the first chunk ${CHUNKS_ARRAY[0]} [0]: " START_OFFSET +START_OFFSET="${START_OFFSET:-0}" + + +# find the end-offset for the last chunk +read -p "Do you want to play the last chunk ${CHUNKS_ARRAY[-1]} to find the end-offset? (y/n) [n]: " PLAY_LAST_CHUNK +PLAY_LAST_CHUNK="${PLAY_LAST_CHUNK:-n}" + +[[ "$PLAY_LAST_CHUNK" == "y" ]] && mpv "${CHUNKS_ARRAY[-1]}" --osd-level=3 --osd-status-msg='${=time-pos}' --really-quiet + +read -p "Enter the end-offset in seconds for the last chunk ${CHUNKS_ARRAY[0]} [1]: " END_OFFSET +END_OFFSET="${END_OFFSET:-1}" + +cat <