- .NET 7.0 SDK
- FFmpeg (for video to audio conversion)
- OpenAI Whisper API Key
- Clone the repository:
git clone https://github.com/yourusername/VideoToSubtitle.git
- Navigate to the project directory:
cd VideoToSubtitle
- Build the project:
dotnet build
- Install FFmpeg:
- Download FFmpeg from the official website: https://ffmpeg.org/download.html
- Extract the downloaded archive.
- Add the FFmpeg
bin
folder to your system's PATH environment variable.
For more detailed instructions on installing FFmpeg, please refer to the official documentation.
- Obtain an OpenAI Whisper API Key:
- Sign up for an OpenAI account if you don't have one: https://beta.openai.com/signup/
- Follow the instructions in the OpenAI Help Center to find your secret API key.
- Set the OpenAI Whisper API Key as an environment variable:
For Windows:
setx WHISPER_API_KEY "your_api_key"
For Linux and macOS:
export WHISPER_API_KEY="your_api_key"
Make sure to replace your_api_key
with your actual OpenAI Whisper API Key.
dotnet run -- [input-file] [--translate]
input-file
: The path to the video or audio file you want to transcribe.--translate
: (Optional) Use this flag if you want to translate the transcription.
dotnet run -- "path/to/video.mp4"
This will generate a subtitle file (SRT) in the same directory as the input file.
dotnet run -- "path/to/audio.mp3" --translate
This will generate a plain text file (TXT) with the translated transcription in the same directory as the input file.
- MP4
- MPEG
- WEBM
- MP3
- MPGA
- M4A
- WAV