GPTWhisperCaptions

package module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 10 Imported by: 0

README

GPT-Whisper-Captions

Description

This repository contains a Go module for video transcription using OpenAI's Whisper API. It allows you to extract audio from a video file, send it to the Whisper API for transcription, and then embed the transcribed text back into the video as subtitles.

Installation

  1. Make sure you have Go installed on your system. If not, you can download and install it from here.

  2. Make sure FFmpeg is installed on your system. If not, you can download it from here.

As a library

go get github.com/stevenlawton/GPT-Whisper-captions

Usage

In your Go app you can do something like

package main

import (
    "log"
    "os"

    captions "github.com/stevenlawton/GPT-Whisper-captions"
)

func main() {
   // Check if FFmpeg is installed
   err = captions.CheckFFmpegInstallation()
   if err != nil {
      log.Fatal("FFmpeg is not installed: ", err)
      return
   }

}

Features

  • Audio extraction from video using FFmpeg
  • Audio segmentation for more manageable transcription
  • Transcription using OpenAI's Whisper API
  • SRT file generation for subtitles
  • Embedding subtitles back into the video

Contributing

Feel free to open issues or submit pull requests. Your contributions are welcome!

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFFmpegInstallation

func CheckFFmpegInstallation() error

CheckFFmpegInstallation checks if FFmpeg is installed on the system

func EmbedSubtitles

func EmbedSubtitles(videoFilename string, srtFilename string, outputVideoFilename string) error

func ExtractAudio

func ExtractAudio(videoFilename string, audioFilename string) error

ExtractAudio Extracts audio from a video file using FFmpeg

func GenerateSRT

func GenerateSRT(timedTexts []TimedText, srtFilename string) error

func SegmentAudio

func SegmentAudio(audioFilename string, segmentLength int) error

func SendToWhisper

func SendToWhisper(audioFilename string, apiKey string) (string, error)

SendToWhisper Sends the audio file to OpenAI's Whisper API

Types

type TimedText

type TimedText struct {
	Start float64 // start time in seconds
	End   float64 // end time in seconds
	Text  string  // the transcribed text
}

type TranscriptionResponse

type TranscriptionResponse struct {
	Text string `json:"text"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL