Skip to content

Instantly share code, notes, and snippets.

@amb
Last active September 9, 2023 06:29
Show Gist options
  • Save amb/ddeb0c766dfcc1fc7c7c63cd4352766e to your computer and use it in GitHub Desktop.
Save amb/ddeb0c766dfcc1fc7c7c63cd4352766e to your computer and use it in GitHub Desktop.
Transcribe a directory of mp3 files using whisper.cpp and ffmpeg
@echo off
setlocal enabledelayedexpansion
rem Set the directory containing your MP3 files
set mp3_dir=%1
set "mp3_dir=!mp3_dir:"=!"
rem Loop through each MP3 file in the directory
for %%i in ("%mp3_dir%\*.mp3") do (
set "mp3_file=%%~nxi"
set "mp3_file=%mp3_dir%\!mp3_file!"
echo Processing: !mp3_file!
ffmpeg -i "!mp3_file!" ^
-hide_banner ^
-vn ^
-loglevel error ^
-ar 16000 ^
-ac 1 ^
-c:a pcm_s16le ^
-y ^
"!mp3_file!.wav"
build\bin\Release\main.exe -f "!mp3_file!.wav" -t 20 -otxt -m models/ggml-medium.en.bin
)
endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment