Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alesr/scriber
https://github.com/alesr/scriber
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alesr/scriber
- Owner: alesr
- License: mit
- Created: 2024-11-01T20:55:05.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-01T20:58:19.000Z (2 months ago)
- Last Synced: 2024-11-01T21:27:30.738Z (2 months ago)
- Language: Go
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Scriber
Scriber is a Go service that processes audio files and transcribes them into subtitles or transcripts using the Whisper API.
## Features
- Convert audio files to WAV format using `ffmpeg`
- Transcribe audio files into subtitles (`.srt`) or transcripts (`.txt`)
- Supports multiple languages## Installation
1. Clone the repository:
```sh
git clone https://github.com/alesr/scriber.git
cd scriber
```2. Install dependencies:
```sh
go mod download
```3. Ensure `ffmpeg` is installed on your system:
```sh
# On macOS
brew install ffmpeg# On Ubuntu
sudo apt-get install ffmpeg
```## Usage
### Example
```go
package mainimport (
"context"
"os"
"log/slog""github.com/alesr/scriber"
"github.com/alesr/whisperclient"
)func main() {
logger := slog.Default()
whisperCli := whisperclient.NewClient("your-api-key")s := scriber.New(logger, whisperCli)
inputFile, err := os.Open("path/to/example.mp4")
if err != nil {
logger.Error("Failed to open input file", slog.Error(err))
os.Exit(1)
}
defer inputFile.Close()input := scriber.Input{
Name: "example.mp4",
OutputType: scriber.OutputTypeSubtitles,
Language: "en",
Data: inputFile,
}ctx := context.Background()
if err := s.Process(ctx, input); err != nil {
logger.Error("Failed to process file", slog.Error(err))
os.Exit(1)
}for result := range s.Collect() {
logger.Info("Transcription result", slog.String("file", result.Name), slog.String("text", string(result.Text)))
}
}```
## Testing
Run the tests:
```sh
go test ./...
```## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.