From faa4e859d23670c5750304418c245004fe59e102 Mon Sep 17 00:00:00 2001 From: GrailFinder Date: Sun, 5 Feb 2023 12:53:17 +0300 Subject: Feat: add outdir; use metadata --- cut_by_vtt.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cut_by_vtt.sh b/cut_by_vtt.sh index a4576a2..ceb58cb 100755 --- a/cut_by_vtt.sh +++ b/cut_by_vtt.sh @@ -5,8 +5,16 @@ set -e filename=${1:-} audioname=$(printf "$filename" | sed "s/\(.*\).vtt/\1/") +outdir=$(dirname "$filename")/utterances +mkdir -p "$outdir" + # given vtt what is original ext? -ffmpeg_commands=$(grep "\-->" $filename | awk -F " " -v aname="$audioname" '{print "ffmpeg -i "aname" -ss " $1 " -to " $3 " -vn -acodec copy " NR ".ogg"}') +ffmpeg_commands=$(grep "\-->" $filename | awk -F " " \ + -v aname="$audioname" \ + -v outdir="$outdir" \ + '{print "ffmpeg -i "aname" -ss " $1 " -to " $3 \ + " -metadata text_source=" aname ".vtt" \ + " -vn -acodec copy " outdir "/" $1"_"$3 ".ogg"}') while read cline; do -- cgit v1.2.3