-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstt.sh
executable file
·56 lines (49 loc) · 1.21 KB
/
stt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env zsh
# ==================================
# Speech To Transcript Script
# ==================================
#
# Description:
# Transcribes video/audio files using whisper-faster-xxl with optimised settings
#
# Usage:
# ./stt.sh <input_file>
#
# Example:
# ./stt.sh video.mp4
# ./stt.sh /path/to/video.mp4
#
# Requirements:
# - whisper-faster-xxl must be installed and in your PATH
# - Input file must be a valid audio/video file
#
# Note:
# - Output will be a txt file in the same directory as the input file
# - Script will exit if no input file is provided
# ==================================
# Exit on error
set -e
# Check if input file is provided
if [[ $# -eq 0 ]]; then
echo "Error: No input file provided"
echo "Usage: $0 <input_file>"
exit 1
fi
# Check if file exists
if [[ ! -f "$1" ]]; then
echo "Error: File '$1' not found"
exit 1
fi
# Extract file path
file_path=$(dirname "$1")"/"
# Run transcription
whisper-faster-xxl "$1" \
--model medium \
--language en \
--word_timestamps False \
--task stt \
--output_format txt \
--output_dir "$file_path" \
--vad_filter True \
--compute_type auto
echo "Transcription complete for: $1"