Purpose
Automatically recognize the voice in a video or audio file and export it as an SRT file with timestamp.
Code
Please refer to my repository.
Requirement
Nvidia GPU with CUDA, CUDA toolkit, linux system, python, docker
Comptiable file extension
mp3, wav, m4a, flac, aac, ogg, mp4, mkv
Guide
- Pull the repo to local
git clone https://github.com/WinchellWang/voice2subtitle.git - Copy the video or audio files into the repo folder.
- Change the language in ‘run.sh’ on line 17 to match the primary language of the file.
- Execute
./run.sh
You should see two SRT files after the task. ‘file_name.srt’ and ‘file_name_merged.srt’. The latter is the final version.
Run the program in the background while keeping the log by executing the command
nohup bash run.sh > whisper.log 2>&1 &. You should then be able to track the status in the ‘whisper.log’ file in the same folder.
Check the GPU usage regularly using the command
watch -n 5 nvidia-smi