Skip to content

duman-dp/Goethe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Goethe - German Sentence Audio Extractor

Learn German by building your own audio library from videos!


🎯 What is Goethe?

Goethe is a tool that helps you learn German by extracting specific sentences from your videos and saving them as MP3 files.

The Problem

I started learning German and wanted to use Anki for vocabulary practice. Anki is great for learning with audio, but I had a problem:

πŸ“Ή German learning videos (hours of content)
        ↓
βœ‚οΈ I needed to cut specific sentences
        ↓
🎧 Convert them to MP3 files
        ↓
πŸ“± Add them to Anki for practice
        ↓
⏰ This took HOURS of manual work!

Every time I wanted to add a new sentence to Anki:

  • I had to find the exact position in the video
  • Cut the audio manually
  • Convert it to MP3
  • Save it with the right name
  • Add it to Anki

This was wasting my study time. I wanted to learn German, not become a video editor!

The Solution

So I built Goethe to do all this work automatically:

πŸ“Ή German Lesson (30 min)
        ↓
πŸ” You write: "Ich habe keine Zeit" in sentences.txt
        ↓
πŸ€– Goethe finds it in the video (2:15 - 2:18)
        ↓
βœ‚οΈ Automatically cuts the audio
        ↓
🎡 Creates: Ich_habe_keine_Zeit.mp3 (3 seconds)
        ↓
πŸ“± Ready to add to Anki in seconds!

Now I can:

  • βœ… Learn German instead of editing videos
  • βœ… Build my Anki audio library quickly
  • βœ… Practice specific sentences anytime
  • βœ… Save hours of manual work

If you're learning German and using Anki, this tool is for you! 🎧


✨ Features

Feature Description
🎀 Speech Recognition Converts video speech to text with timestamps
πŸ” Smart Search Finds sentences even with small differences (fuzzy matching)
🎡 MP3 Extraction Creates high-quality audio clips (192 kbps)
πŸ“ Organized Output MP3 files organized by sentence in individual folders
🎨 Beautiful Interface Colorful, professional output in your terminal
πŸ”„ Resume Support Won't reprocess videos you've already done
⚑ Fast Processing Uses optimized whisper models for speed
πŸš€ Auto-Setup Everything created automatically on first run
πŸ‡©πŸ‡ͺ German Optimized Handles Γ€, ΓΆ, ΓΌ, ß and German grammar

πŸ“‹ Requirements

Before you start, make sure you have:

Requirement Version How to check
Ubuntu 22.04 or later lsb_release -a
Python 3.8 or later python3 --version
FFmpeg Latest ffmpeg -version
Disk Space 10+ GB free df -h

πŸš€ Quick Installation

Step 1: Clone the Repository

git clone https://github.com/duman-dp/Goethe.git
cd Goethe

Step 2: Install FFmpeg (if not installed)

sudo apt update
sudo apt install ffmpeg

Step 3: Setup Python Environment

# Create virtual environment
python3 -m venv venv

# Activate it
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Step 4: Run Auto-Setup

python3 setup.py

This creates all necessary folders and configuration files automatically.

Step 5: Add Your Content

# Add videos to the videos folder
cp /path/to/your/german_video.mp4 videos/

# Add sentences to sentences.txt
nano sentences.txt

Step 6: Start Extracting

python3 main.py

πŸ“ Project Structure

Goethe/
β”‚
β”œβ”€β”€ πŸ“ videos/              ← Put your videos here (.mp4, .mkv, .avi)
β”‚   └── german_lesson.mp4
β”‚
β”œβ”€β”€ πŸ“ transcripts/         ← Speech-to-text results (JSON)
β”‚   └── german_lesson.json
β”‚
β”œβ”€β”€ πŸ“ output/              ← All generated files
β”‚   └── πŸ“ mp3/             ← Your MP3 library! 🎡
β”‚       β”œβ”€β”€ πŸ“ Ich_habe_keine_Zeit/
β”‚       β”‚   └── 🎡 Ich_habe_keine_Zeit_001.mp3
β”‚       β”œβ”€β”€ πŸ“ Wie_geht_es_dir/
β”‚       β”‚   └── 🎡 Wie_geht_es_dir_002.mp3
β”‚       └── πŸ“ Das_ist_kein_Problem/
β”‚           └── 🎡 Das_ist_kein_Problem_003.mp3
β”‚
β”œβ”€β”€ πŸ“ modules/             ← Python modules (don't edit unless you know)
β”‚   β”œβ”€β”€ speech_recognition.py
β”‚   β”œβ”€β”€ sentence_matcher.py
β”‚   β”œβ”€β”€ audio_extractor.py
β”‚   β”œβ”€β”€ beautiful_logger.py
β”‚   └── setup.py
β”‚
β”œβ”€β”€ πŸ“„ config.yaml          ← Configuration settings
β”œβ”€β”€ πŸ“„ sentences.txt        ← Sentences you want to find
β”œβ”€β”€ πŸ“„ main.py              ← Main program (run this)
β”œβ”€β”€ πŸ“„ setup.py             ← First-time setup
β”œβ”€β”€ πŸ“„ requirements.txt     ← Python dependencies
└── πŸ“„ README.md            ← This file

βš™οΈ Configuration

Edit config.yaml to customize how Goethe works:

# ============================================
# Goethe Configuration
# ============================================

# Audio Settings
audio:
  padding_before: 0.03    # Add 0.03s before each sentence (natural sound)
  padding_after: 0.03     # Add 0.03s after each sentence
  bitrate: 192           # MP3 quality: 128, 192, 256

# Speech Recognition
speech:
  model_size: medium       # tiny | small | medium | large (best)
  language: German       # Language to transcribe
  device: cpu            # cpu or cuda (GPU)
  quiet: true            # Less output in terminal

# Sentence Matching
matching:
  fuzzy_threshold: 60    # 0-100 (lower = more matches, but less accurate)

# Paths
paths:
  videos: ./videos
  transcripts: ./transcripts
  output: ./output
  logs: ./logs

Model Size Guide

Model Speed Accuracy Memory Best For
tiny πŸš€ Fastest 70% ~1 GB Testing, short videos
small ⚑ Fast 85% ~2 GB Daily use
medium 🐒 Medium 92% ~5 GB Better accuracy (recommended)
large 🐌 Slow 95% ~10 GB Best quality (if you have RAM)

πŸ“ How to Use

Adding Videos

# Copy videos to the videos folder
cp /path/to/video.mp4 videos/

# Supported formats:
# .mp4, .mkv, .avi, .mov

Adding Sentences

Open sentences.txt:

nano sentences.txt

Add one sentence per line:

Ich habe keine Zeit.
Wie geht es dir?
Das ist kein Problem.
Guten Morgen!
Hallo, wie heißt du?
Ich liebe Deutsch.
Wo ist der Bahnhof?
Ich verstehe nicht.
Kannst du mir helfen?
Was ist das?

Tip: Use shorter sentences for better matches!

Running the Program

python3 main.py

Finding Your MP3s

# List all MP3 files
ls -R output/mp3/

# Play all MP3s
for f in output/mp3/*/*.mp3; do ffplay -autoexit "$f"; done

🎨 Example Output

  ╔════════════════════════════════════════════════════════════════════╗
  β•‘          πŸ“š Goethe - German Sentence Audio Extractor              β•‘
  β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  🎀 Step 1: Speech Recognition                                    β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  ℹ️ Found 1 video(s)
     πŸ“Ή german_lesson.mp4
  ℹ️ ⏩ Skipping: german_lesson.mp4 (transcript exists)

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  πŸ”Ž Step 2: Sentence Matching                                     β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  ℹ️ Searching for 9 sentences
  βœ… Found 6 matches!

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  πŸ“ Matches Found                                              β”‚
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  β”‚  🌟  1. Ich habe keine Zeit                                    β”‚
  β”‚     ⏱️  2:15 - 2:18  β€’  Score: 92%                            β”‚
  β”‚  🌟  2. Wie geht es dir                                        β”‚
  β”‚     ⏱️  5:30 - 5:33  β€’  Score: 88%                            β”‚
  β”‚  🌟  3. Das ist kein Problem                                   β”‚
  β”‚     ⏱️  8:45 - 8:48  β€’  Score: 85%                            β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  🎡 Step 3: Audio Extraction                                     β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  βœ… Created 6 MP3 files!
  πŸ“ Saved to: output/mp3/

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  πŸ“Š Summary                                                    β”‚
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  β”‚  🎬 Videos:          1                                        β”‚
  β”‚  πŸ“ Transcripts:      1                                        β”‚
  β”‚  πŸ”Ž Matches:          6                                        β”‚
  β”‚  🎡 MP3 Files:        6                                        β”‚
  β”‚  ⏱️  Total time:      5.2 seconds                             β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

❓ Frequently Asked Questions

How long does it take?

Video Length tiny model small model
1 minute ~30 seconds ~1 minute
5 minutes ~2 minutes ~5 minutes
10 minutes ~4 minutes ~10 minutes

First time: Longer (downloads AI model ~1GB)

Can I use this for other languages?

Yes! Change language: German to:

  • French, Spanish, Italian, Portuguese
  • English, Chinese, Japanese, Korean
  • Any language supported by Whisper

Where do I get German videos?

  • YouTube
  • Deutsche Welle
  • Easy German
  • Your own recordings
  • German movies/TV

My laptop is getting hot!

Normal! Speech recognition uses a lot of CPU. To reduce heat:

  1. Use model_size: tiny (fastest, coolest)
  2. Process shorter videos (2-3 minutes)
  3. Take breaks between processing
  4. Put laptop on a hard surface for airflow

No matches found?

Try these fixes:

  1. Lower fuzzy_threshold to 50 in config.yaml
  2. Use shorter sentences
  3. Check if sentences actually appear in your video
  4. Use simpler sentences first

Can I process multiple videos?

Yes! Put all videos in the videos/ folder. Goethe will process them all.


πŸ› οΈ Troubleshooting

FFmpeg not found

sudo apt update
sudo apt install ffmpeg

Python packages missing

source venv/bin/activate
pip install -r requirements.txt

Can't see videos folder

# Run setup to create folders
python3 setup.py

Hugging Face token warning

Warning: You are sending unauthenticated requests to the HF Hub

This is normal. To speed up downloads:

  1. Create free account at: https://huggingface.co/join
  2. Get token: https://huggingface.co/settings/tokens
  3. Set token: export HF_TOKEN="hf_xxxxxxxxxx"
  4. Or just wait - it works without token (slower)

Memory error

# Use tiny model
# Edit config.yaml and set:
# model_size: tiny

Error: No such file or directory

# Make sure you're in the right folder
cd ~/Goethe

# Check folder structure
ls -la

πŸ’‘ Pro Tips

Tip Benefit
Use short videos (2-5 min) Faster processing
Use tiny model first Quick testing
Clear audio = better results Higher accuracy
Add simple sentences first Higher match rate
Lower threshold to 50 More matches
Process one video at a time Less memory usage
Close other apps More CPU for processing

🎯 Complete Example

Here's a full example from start to finish:

# 1. Download a German video (example using yt-dlp)
yt-dlp "https://www.youtube.com/watch?v=example" -o videos/german_lesson.mp4

# 2. Create sentences.txt
cat > sentences.txt << EOF
Ich habe keine Zeit.
Wie geht es dir?
Das ist kein Problem.
Guten Morgen!
Hallo, wie heißt du?
Ich liebe Deutsch.
Wo ist der Bahnhof?
Ich verstehe nicht.
Kannst du mir helfen?
Was ist das?
EOF

# 3. Activate environment
source venv/bin/activate

# 4. Run Goethe
python3 main.py

# 5. Find your MP3s
ls output/mp3/

# 6. Listen to them!
ffplay output/mp3/*/*.mp3


🀝 Contributing

Want to help improve Goethe?

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

Areas that need help:

  • Better documentation
  • More language support
  • GUI interface
  • Batch processing improvements
  • Performance optimizations

πŸ“„ License

MIT License β€” Free to use, modify, and share!


πŸ™ Acknowledgements


πŸ“¬ Contact


⭐ Support

If Goethe helped you learn German, please star ⭐ this repository!


Happy Learning! πŸ‡©πŸ‡ͺ🎧

Releases

Packages

Contributors

Languages