Support a time range in the transcribe video scripts

This commit is contained in:
2023-08-07 17:22:07 -04:00
parent 90c312e954
commit ba9a776867
15 changed files with 201 additions and 22 deletions

View File

@@ -354,36 +354,51 @@ function my_transcribe_video() {
file="$1"
output="$2"
include_small=$3
start_time="$4"
end_time="$5"
if [[ $file == "" ]]; then
error "Usage: <input video> <optional output name>"
error "Usage: <input video> <optional output name> <optional include small model (1 or 0)> <optional start time> <optional end time>"
return
fi
if [[ $output == "" ]]; then
output="${1%.*}" # just use the input name without the extension.
fi
if [[ $start_time == "" ]]; then start_time="0"; fi
if [[ $end_time == "" ]]; then end_time="0"; fi
# Tiny is fast and semi-accurate, so whatever.
# Base is pretty good overall. It has good punctuation inserting and
# catches most words. Small and medium can do better word detection at
# times, but suffer from bad punctuation. Medium is particularly bad and
# not adding commas and periods.
if [[ $include_small -eq 1 ]]; then
transcribe-video "$file" "$output" tiny base small
transcribe-video "$file" "$output" $start_time $end_time tiny base small
else
transcribe-video "$file" "$output" tiny base
transcribe-video "$file" "$output" $start_time $end_time tiny base
fi
}
function my_transcribe_video_all_models() {
file="$1"
output="$2"
start_time="$3"
end_time="$4"
if [[ $file == "" ]]; then
error "Usage: <input video> <optional output name>"
error "Usage: <input video> <optional output name> <optional start time> <optional end time>"
return
fi
if [[ $output == "" ]]; then
output="${1%.*}" # just use the input name without the extension.
fi
transcribe-video "$file" "$output" tiny base small medium
if [[ $start_time == "" ]]; then start_time="0"; fi
if [[ $end_time == "" ]]; then end_time="0"; fi
transcribe-video "$file" "$output" $start_time $end_time tiny base small medium
}