summaryrefslogtreecommitdiffstats
path: root/skripti/transcribe_large_file.sh
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-04-15 10:33:24 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-04-15 10:33:24 +0200
commit1ffa25152f18588b381fa9260f437f07d9a04003 (patch)
tree99b688314ca245b80185798e12f1e3450eb2a667 /skripti/transcribe_large_file.sh
parentdn05p2 (diff)
downloadr-1ffa25152f18588b381fa9260f437f07d9a04003.tar
r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.gz
r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.bz2
r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.lz
r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.xz
r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.zst
r-1ffa25152f18588b381fa9260f437f07d9a04003.zip
Diffstat (limited to '')
-rwxr-xr-xskripti/transcribe_large_file.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/skripti/transcribe_large_file.sh b/skripti/transcribe_large_file.sh
new file mode 100755
index 0000000..e9bcc27
--- /dev/null
+++ b/skripti/transcribe_large_file.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -xeuo pipefail
+p=`rev <<<$0 | cut -d/ -f1 | rev`
+d=`mktemp -p "" -d $p.XXX`
+trap "rm -fr $d" EXIT
+ffmpeg -i $1 -f segment -segment_time 240 -acodec pcm_s16le -ac 1 -ar 16000 $d/%03d.wav
+for i in $d/*.wav
+do
+ curl -X 'POST' \
+ 'http://splet.4a.si.:8000/api/transcribe' \
+ -H 'accept: application/json' \
+ -H 'Content-Type: multipart/form-data' \
+ -F "audio_file=@$i;type=audio/wav" | jq --raw-output .result > $1.`rev <<<$i | cut -d. -f2 | cut -d/ -f1 | rev`.txt
+done