diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-04-15 10:33:24 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-04-15 10:33:24 +0200 |
commit | 1ffa25152f18588b381fa9260f437f07d9a04003 (patch) | |
tree | 99b688314ca245b80185798e12f1e3450eb2a667 /skripti/transcribe_large_file.sh | |
parent | dn05p2 (diff) | |
download | r-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 'skripti/transcribe_large_file.sh')
-rwxr-xr-x | skripti/transcribe_large_file.sh | 14 |
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 |