If you work with videos regularly, creating subtitles one file at a time can be slow and repetitive. OpenAI’s Whisper CLI makes high-quality speech-to-text easy, and with a simple Windows batch script, you can automatically generate subtitles for every video in a folder in one go. This article shows a clean and practical way to do exactly that.
If you’re thinking about purchasing a new GPU, we’d greatly appreciate it if you used our Amazon Associate links. The price you pay will be exactly the same, but Amazon provides us with a small commission for each purchase. It’s a simple way to support our site and helps us keep creating useful content for you. Recommended GPUs: RTX 5090, RTX 5080, and RTX 5070. #ad
Why Use Whisper for Subtitles?
Whisper is known for its strong transcription accuracy, especially for spoken dialogue in real-world audio. It supports multiple languages, produces reliable timestamps, and can export directly to subtitle formats like SRT, making it ideal for YouTube videos, tutorials, and social media clips.
On Windows, combining Whisper with a batch script allows you to process multiple videos without manual input, which is perfect for content creators and editors.
Python Modules
Install these modules. If you don’t have a GPU, follow the instructions for CPU-only setup. Otherwise, follow the GPU setup.
CPU-only setup:
(make sure ffmpeg is installed)
GPU setup (CUDA 12.8):
This ensures Whisper runs efficiently on GPU, especially for large models like large or medium.
The Batch Script Explained
Below is a simple Windows batch file that processes all MP4 files in the current folder and outputs SRT subtitle files:
@echo off
setlocal enabledelayedexpansion
REM ---- SETTINGS ----
set MODEL=large
set LANGUAGE=en
REM ------------------
for %%F in (*.mp4) do (
echo Processing %%F ...
whisper "%%F" --model %MODEL% --language %LANGUAGE% --output_format srt --verbose False
)
echo.
echo All files processed.
pause
How It Works
The script loops through every .mp4 file in the folder and runs Whisper on each one automatically. The large model is used for better transcription accuracy, and the language is fixed to English to avoid unnecessary auto-detection. Each video produces a matching .srt subtitle file in the same directory.
This setup is intentionally minimal. It avoids unnecessary options while remaining reliable and easy to modify.
Useful Improvements You Can Add
If you want a cleaner output structure, you can tell Whisper to place subtitles in a separate folder using --output_dir. For systems with a GPU, enabling FP16 can improve performance. You can also remove the language option entirely if you work with mixed-language content.
These tweaks keep the script flexible without making it harder to understand or maintain.
When This Workflow Makes Sense
This approach is ideal when you already have video files ready and just need subtitles quickly. It works especially well for YouTube uploads, archive projects, and short-form video content where speed and consistency matter more than manual fine-tuning.
Conclusion
Using Whisper CLI with a Windows batch script is a simple but powerful way to automate subtitle generation. Once set up, you can drop new videos into a folder, run the script, and walk away while Whisper handles the rest. For anyone producing video content at scale, this small automation can save a surprising amount of time.
References
-
OpenAI Whisper (Official GitHub Repository):
https://github.com/openai/whisper -
OpenAI, Robust Speech Recognition via Large-Scale Weak Supervision:
https://cdn.openai.com/papers/whisper.pdf
Leave a Reply