I wanted to speed up my subtitle creation from videos by using Zenity. I have zero experience with Python and some with Zenity. So I did:
#!/bin/bash
cd ~/Desktop
file="$(zenity --title "Video to subtitles: Select a File to convert" --file- selection )"
wavfile="$(zenity --file-selection --save --confirm-overwrite --filename="${file%.*}.wav")"
srtfile="$(zenity --file-selection --save --confirm-overwrite --filename="${file%.*}.srt")"
ffmpeg -i "$file" -c:a pcm_s16le -ac 1 "$wavfile"
cd ~/vosk-api/python/example
time python3 ./test_srt.py "$wavfile" > "$srtfile"
zenity --info --text "Conversion Completed"
Of course, I forgot the last bit uses python to do the conversion, and Python does not get along with bash, so I get zero output.
Any takers? Yours hopefully, Fitch
CodePudding user response:
If just python is a problem, try running it with python test_srt.py
insted of running it as a python3 ./test_srt.py
CodePudding user response:
False alarm. It works fine. I forgot to unzip the vosk model. So the bottom part now reads:
unzip vosk-model-small-en-us-0.3.zip
mv vosk-model-small-en-us-0.3 model
time python3 ./test_srt.py "$wavfile" > "$srtfile"
zenity --info --text "Conversion Completed"
Sorry about that.