Skip to content

Console app that transcribes or translates given audio and video files, using ffmpeg and OpenAI Whisper

Notifications You must be signed in to change notification settings

raffareis/VideoToSubtitle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisites

  • .NET 7.0 SDK
  • FFmpeg (for video to audio conversion)
  • OpenAI Whisper API Key

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/VideoToSubtitle.git
  1. Navigate to the project directory:
cd VideoToSubtitle
  1. Build the project:
dotnet build
  1. 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.

  1. Obtain an OpenAI Whisper API Key:
  1. 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.

Usage

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.

Example

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.

Supported Formats

Video Formats

  • MP4
  • MPEG
  • WEBM

Audio Formats

  • MP3
  • MPGA
  • M4A
  • WAV

About

Console app that transcribes or translates given audio and video files, using ffmpeg and OpenAI Whisper

Resources

Stars

Watchers

Forks