{"id":46539048,"url":"https://github.com/jcspeegs/loups","last_synced_at":"2026-03-07T00:30:48.320Z","repository":{"id":320098969,"uuid":"1078580999","full_name":"jcspeegs/loups","owner":"jcspeegs","description":"Extract video chapter timestamps and title screens using template matching adn OCR - perfect for sports, podcasts, and content creation","archived":false,"fork":false,"pushed_at":"2025-11-23T21:26:56.000Z","size":504,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-23T22:08:56.998Z","etag":null,"topics":["automation","cli-tool","computer-vision","content-creation","easyocr","fastpitch","ocr","ocr-python","opencv","opencv-python","python","softball","sport-analytics","ssim","template-matching","video-analysis","video-processing","youtube-chapter-extractor","youtube-chapters"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcspeegs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-18T01:32:24.000Z","updated_at":"2025-11-16T21:14:13.000Z","dependencies_parsed_at":"2025-10-22T00:22:04.729Z","dependency_job_id":"50c9b3f1-9a45-43bb-a0c5-aadf2d317b29","html_url":"https://github.com/jcspeegs/loups","commit_stats":null,"previous_names":["jcspeegs/loups"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/jcspeegs/loups","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcspeegs%2Floups","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcspeegs%2Floups/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcspeegs%2Floups/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcspeegs%2Floups/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcspeegs","download_url":"https://codeload.github.com/jcspeegs/loups/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcspeegs%2Floups/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","cli-tool","computer-vision","content-creation","easyocr","fastpitch","ocr","ocr-python","opencv","opencv-python","python","softball","sport-analytics","ssim","template-matching","video-analysis","video-processing","youtube-chapter-extractor","youtube-chapters"],"created_at":"2026-03-07T00:30:47.734Z","updated_at":"2026-03-07T00:30:48.311Z","avatar_url":"https://github.com/jcspeegs.png","language":"Python","readme":"# ⚾ Loups\n\n\u003e **Automated video chapter generation using template matching and OCR**\n\nAutomatically scan any video with on-screen text overlays to extract information and generate timestamped YouTube chapters! 🎥✨\n\nOriginally designed for Lights Out HB fastpitch softball games, but works with any video content that has consistent identifying frames or text overlays.\n\n[![PyPI version](https://img.shields.io/pypi/v/loups.svg)](https://pypi.org/project/loups/)\n[![Python 3.13+](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/)\n[![GitHub Actions](https://github.com/jcspeegs/loups/actions/workflows/test.yaml/badge.svg)](https://github.com/jcspeegs/loups/actions/workflows/test.yaml)\n[![Documentation](https://img.shields.io/badge/docs-mkdocs-00ffff.svg)](https://jcspeegs.github.io/loups/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Downloads](https://img.shields.io/pypi/dm/loups.svg)](https://pypi.org/project/loups/)\n\n**Links:** [Repository](https://github.com/jcspeegs/loups) • [Documentation](https://jcspeegs.github.io/loups/) • [Issues](https://github.com/jcspeegs/loups/issues) • [PyPI](https://pypi.org/project/loups/) • [Author](mailto:justin@speegs.com)\n\n## ✨ What is Loups?\n\nLoups uses template matching and OCR to automatically scan videos, detect specific frames with identifying information, and generate timestamped chapters.\n\n**Use cases include:**\n- 🥎 **Sports Games** - Track player at-bats, shifts, or appearances (originally designed for fastpitch softball)\n- 🎓 **Educational Content** - Chapter markers for different topics or speakers\n- 🎙️ **Podcasts/Interviews** - Detect guest name overlays or topic cards\n- 🎮 **Gaming** - Mark level changes, character selections, or game modes\n- 📺 **TV Shows/Series** - Detect episode titles or scene markers\n- 🎬 **Any Video** - With consistent text overlays or identifying frames\n\n![terminal-cast](loups.gif)\n\n## 📑 Table of Contents\n\n- [Installation](#-installation)\n- [Quick Start](#-quick-start)\n- [Thumbnail Extraction](#️-thumbnail-extraction)\n- [Common Workflows](#-common-workflows)\n- [CLI Options](#️-cli-options)\n- [Features](#-features)\n- [How It Works](#-how-it-works)\n- [Creating Custom Templates](#-creating-custom-templates)\n- [Tips \u0026 Best Practices](#-tips--best-practices)\n- [Contributing](#-contributing)\n- [License](#-license)\n\n## 📦 Installation\n\n**Requirements:** Python 3.13 or higher\n\n**Supported Platforms:** Linux • macOS • Windows (tested via CI/CD)\n\n```bash\n# Install from PyPI\npip install loups\n\n# Verify installation\nloups --help\n```\n\n**Note:** If you're using an older Python version, you may need to upgrade:\n```bash\n# Check your Python version\npython --version\n\n# Install with specific Python version if needed\npython3.13 -m pip install loups\n```\n\n## 🚀 Quick Start\n\n```bash\n# 🎬 For Lights Out HB games (uses bundled template)\nloups game_video.mp4\n```\n\n**Expected output:**\n```\n🥎 Scanning video for batter at-bats...\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:05:23\n\nFound 12 batters:\n0:00:00 Game Start\n0:01:15 Sarah Johnson #7\n0:03:42 Emma Martinez #12\n0:05:23 Lily Garcia #9\n...\n```\n\n**More examples:**\n```bash\n# 🎨 For any other video (use your own template)\nloups -t my_template.png video.mp4\n\n# 💾 Save results to a file for YouTube chapters\nloups -o chapters.txt video.mp4\n\n# 🤫 Quiet mode for automation/batch processing\nloups -q -o chapters.txt video.mp4\n```\n\n**Important:** Options must be specified *before* the video argument.\n\n## 🖼️ Thumbnail Extraction\n\nLoups can automatically extract thumbnails from your videos using SSIM (Structural Similarity Index) matching!\n\n```bash\n# Extract thumbnail using default template\nloups video.mp4 thumbnail\n\n# Use custom thumbnail template\nloups video.mp4 thumbnail --thumbnail-template my_thumb_template.png\n\n# Customize output location\nloups video.mp4 thumbnail --thumbnail-output ./thumbnails/game_thumb.jpg\n\n# Fine-tune the matching\nloups video.mp4 thumbnail --thumbnail-threshold 0.85 --thumbnail-scan-duration 180\n\n# Extract thumbnail during chapter scanning (options BEFORE video)\nloups --extract-thumbnail --thumbnail-output thumb.jpg video.mp4\n```\n\n### How Thumbnail Extraction Works\n\n1. **🎯 Template Matching** - Scans video frames from the beginning using SSIM scoring\n2. **⚡ First-Match Strategy** - Stops as soon as a frame exceeds the similarity threshold\n3. **💾 Automatic Saving** - Saves the matched frame as a JPEG thumbnail\n4. **⏱️ Configurable Duration** - Only scans the first N seconds (default: 120s)\n\n**Key Features:**\n- 🎯 **SSIM-based matching** - More accurate than simple template matching\n- ⚡ **Efficient scanning** - Stops at first match, doesn't scan entire video\n- 🎨 **Default template support** - Include `thumbnail_template.png` in package data\n- 🔧 **Highly configurable** - Control threshold, scan duration, and frame sampling\n\n**Options:**\n- `--thumbnail-template` - Path to template image (uses default if not specified)\n- `--thumbnail-output` - Where to save thumbnail (default: `\u003cvideo\u003e-thumbnail.jpg` in current directory)\n- `--thumbnail-threshold` - Minimum SSIM score (0.0-1.0, default: 0.35)\n- `--thumbnail-scan-duration` - Max seconds to scan from start (default: 120)\n- `--thumbnail-frames-per-second` - Frame sampling rate (default: 3)\n\n## 📋 Common Workflows\n\n### 📹 Creating YouTube Chapters\n```bash\n# Scan video and save chapters for YouTube description\nloups -o youtube_chapters.txt my_video.mp4\n# Copy the contents of youtube_chapters.txt to your video description!\n```\n\n### 🎨 Using Custom Templates\n```bash\n# Step 1: Create a template from a clear frame\n# (Screenshot the text/overlay you want to detect)\n\n# Step 2: Use your template\nloups -t my_custom_template.png -o chapters.txt video.mp4\n```\n\n### 🔧 Troubleshooting with Logs\n```bash\n# Enable logging to debug detection issues\nloups --log video.mp4\n\n# Use custom log location with debug level\nloups --log /path/to/debug.log --debug video.mp4\n```\n\n### 🤖 Automation \u0026 Batch Processing\n```bash\n# Process multiple videos quietly\nloups -q -o video1_chapters.txt video1.mp4\nloups -q -o video2_chapters.txt video2.mp4\nloups -q -o video3_chapters.txt video3.mp4\n```\n\n### 🖼️ Creating Thumbnails for YouTube\n```bash\n# Extract thumbnail with chapters in one command\nloups -o chapters.txt --extract-thumbnail --thumbnail-output thumbnail.jpg game_video.mp4\n\n# Or extract thumbnail separately\nloups game_video.mp4 thumbnail --thumbnail-template title_screen.png\n\n# Batch thumbnail extraction\nloups video1.mp4 thumbnail --thumbnail-output vid1_thumb.jpg\nloups video2.mp4 thumbnail --thumbnail-output vid2_thumb.jpg\nloups video3.mp4 thumbnail --thumbnail-output vid3_thumb.jpg\n```\n\n## ⚙️ CLI Options\n\n**Command Structure:**\n- Default scanning: `loups [OPTIONS] VIDEO` - Options must come BEFORE the video path\n- Thumbnail extraction: `loups VIDEO thumbnail [OPTIONS]` - Thumbnail options come AFTER the subcommand\n\n### Main Command: `loups [OPTIONS] VIDEO`\n\nScan video for chapters (batter at-bats or any detected frames).\n\n**Required Arguments:**\n\n| Argument | Description |\n|----------|-------------|\n| `VIDEO` | 🎥 Path to the video file to scan (must come AFTER options) |\n\n**Optional Flags:**\n\n| Flag | Short | Description |\n|------|-------|-------------|\n| `--template PATH` | `-t` | 🎨 Path to template image for detection\u003cbr\u003e• Defaults to bundled Lights Out HB template\u003cbr\u003e• Provide your own for any video content |\n| `--output PATH` | `-o` | 💾 Save results to file in YouTube chapter format |\n| `--log [PATH]` | `-l` | 📝 Enable logging (defaults to `loups.log`, or specify custom path)\u003cbr\u003e• Rotates at 10MB\u003cbr\u003e• Keeps 3 backup files |\n| `--quiet` | `-q` | 🤫 Suppress progress display (errors still shown) |\n| `--debug` | `-d` | 🔍 Enable DEBUG level logging (requires `--log`) |\n| `--extract-thumbnail` | | 🖼️ Extract thumbnail during chapter scan |\n| `--thumbnail-template PATH` | | 🎨 Path to thumbnail template (optional) |\n| `--thumbnail-output PATH` | | 💾 Thumbnail save location (default: `\u003cvideo\u003e-thumbnail.jpg`) |\n| `--thumbnail-threshold FLOAT` | | 🎯 SSIM threshold 0.0-1.0 (default: 0.35) |\n| `--thumbnail-scan-duration INT` | | ⏱️ Max seconds to scan for thumbnail (default: 120) |\n| `--thumbnail-frames-per-second INT` | | 📊 Frame sampling rate (default: 3) |\n\n### Thumbnail Command: `loups VIDEO thumbnail [OPTIONS]`\n\nExtract thumbnail from video using SSIM-based template matching.\n\n**Required Arguments:**\n\n| Argument | Description |\n|----------|-------------|\n| `VIDEO` | 🎥 Path to the video file (comes BEFORE the `thumbnail` subcommand) |\n\n**Optional Flags:**\n\n| Flag | Description |\n|------|-------------|\n| `--thumbnail-template PATH` | 🎨 Path to thumbnail template (defaults to bundled template) |\n| `--thumbnail-output PATH` | 💾 Output path (default: `\u003cvideo\u003e-thumbnail.jpg` in cwd) |\n| `--thumbnail-threshold FLOAT` | 🎯 Minimum SSIM score 0.0-1.0 (default: 0.35) |\n| `--thumbnail-scan-duration INT` | ⏱️ Max seconds to scan from start (default: 120) |\n| `--thumbnail-frames-per-second INT` | 📊 Frame sampling rate (default: 3) |\n| `--quiet` | 🤫 Suppress output |\n\n## ⭐ Features\n\n### 🎯 Core Features\n- 🥎 **Animated Progress Display** - Real-time scanning with fun animations\n- 🔍 **Template Matching** - Detects specific frames using image templates\n- 📝 **OCR Text Extraction** - Reads text from matched frames to create chapter titles\n- 📺 **YouTube-Ready Output** - Generates properly formatted chapter timestamps\n- 🖼️ **Thumbnail Extraction** - SSIM-based automatic thumbnail extraction\n- 🎨 **Universal Custom Templates** - Works with ANY video content\n- 🏆 **Bundled Templates** - Ready to use with Lights Out HB fastpitch games\n\n### 🛠️ Technical Features\n- 📝 **Optional Logging** - File logging with automatic rotation (10MB, 3 backups)\n- 🔧 **Debug Mode** - Detailed logs for troubleshooting\n- 🤫 **Quiet Mode** - Perfect for automation and scripting\n- ⚡ **Efficient Processing** - Optimized video frame analysis\n- 🎯 **Smart OCR** - Confidence-based text extraction with filtering\n- 🔄 **Smart Text Sorting** - Left-to-right ordering of OCR results\n\n## 📚 How It Works\n\nLoups processes your video in several steps to create YouTube chapters:\n\n1. **🔍 Template Matching** - Scans video frames looking for your template image\n   - The template acts as a \"trigger\" that identifies frames of interest\n   - When a match is found, Loups knows this frame contains information to extract\n\n2. **📝 OCR Text Extraction** - On each matched frame, OCR reads the visible text\n   - Extracts all text from the matched region (names, numbers, titles, etc.)\n   - Applies confidence filtering to ensure accuracy\n   - Sorts text elements left-to-right for proper ordering\n\n3. **⏱️ Chapter Title \u0026 Timestamp** - Combines the extracted text with video timestamp\n   - Creates a chapter entry like: `0:05:23 John Smith #12`\n   - Each detection becomes a new YouTube chapter marker\n\n4. **💾 YouTube Format Output** - Exports chapters in YouTube-ready format\n   - Copy and paste directly into your video description\n   - Format: `HH:MM:SS Chapter Title`\n\n**Example:**\n```\n0:00:00 Game Start\n0:05:23 Sarah Johnson #7\n0:08:45 Emma Martinez #12\n0:12:30 Lily Garcia #9\n```\n\n## 🎨 Creating Custom Templates\n\nLoups works with any video - just provide a template!\n\n1. **Find a clear frame** - Pause your video where the text/overlay is visible\n2. **Take a screenshot** - Capture the region you want to detect\n3. **Crop the template** - Include the area where text appears\n4. **Use it** - `loups -t my_template.png video.mp4`\n\n**Tips for good templates:**\n- ✅ Clear, high-contrast text\n- ✅ Consistent position throughout video\n- ✅ No motion blur or partial occlusion\n- ✅ Crop tightly around the target region\n\n**Example use cases:**\n- 🎮 Game mode indicators or level titles\n- 🎓 Speaker name overlays in lectures\n- 📺 Episode titles or scene markers\n- 🏆 Scoreboard player names (original use case)\n- 🎵 Song title overlays in music videos\n- 📰 News segment titles or chyrons\n\n## 💡 Tips \u0026 Best Practices\n\n### 🎯 For Best Results\n- ✅ Use high-quality video recordings (720p or higher recommended)\n- ✅ Ensure your template region is consistently visible throughout the video\n- ✅ Steady lighting/contrast improves OCR accuracy\n- ✅ Test on a short clip before processing full videos\n- ✅ The text in matched frames becomes your chapter titles - ensure it's readable!\n\n### 🔧 Troubleshooting\n\n#### Common Issues\n\n**Python Version Errors**\n- **Error:** `ModuleNotFoundError` or `SyntaxError` during installation\n- **Solution:** Loups requires Python 3.13+. Check your version with `python --version` and upgrade if needed\n\n**First Run is Slow**\n- **Behavior:** First execution takes several minutes to start\n- **Why:** EasyOCR automatically downloads OCR models (~100MB) on first run\n- **Solution:** This is normal! Subsequent runs will be much faster. Be patient during the initial setup.\n\n**Detection Issues**\n- **Missed detections?** Enable `--log --debug` to see template matches and OCR results\n- **Wrong text extracted?** Your template might be too large or including unwanted regions\n- **False positives?** Consider cropping your template more tightly around the identifying region\n- **Template not matching?** Ensure the template exactly matches the video frames (size, position, quality)\n\n**OCR Issues**\n- **Names in wrong order?** OCR results are automatically sorted left-to-right\n- **Blank chapter titles?** OCR confidence might be too low - check logs with `--debug`\n- **Garbled text?** Improve video quality or use a clearer template region\n\n**Video Codec Issues**\n- **Error:** `cv2.error` or video won't open\n- **Solution:** Some video formats require additional codecs. Try converting to MP4 (H.264) format\n\n## 🤝 Contributing\n\nContributions are welcome! Whether it's:\n- 🐛 Bug reports\n- 💡 Feature suggestions\n- 📝 Documentation improvements\n- 🔧 Code contributions\n- 🎨 Sharing interesting use cases and templates\n\nPlease open an issue or pull request on GitHub.\n\n## 📄 License\n\nThis project is licensed under the MIT License.\n\n## 🙏 Acknowledgments\n\nOriginally created for Lights Out HB fastpitch softball coverage, now a flexible tool for any video content creator!\n\n---\n\nMade with ❤️ for content creators 🎬\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcspeegs%2Floups","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcspeegs%2Floups","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcspeegs%2Floups/lists"}