Skip to content

Creating Custom Templates

Learn how to create templates for any video content to use with Loups.


โ“ What is a Template?

A template is an image that acts as a trigger - Loups scans your video looking for frames that match this template. When a match is found, Loups extracts the text from that frame to create a chapter entry.

Template Analogy

Think of the template as a "bookmark shape" - Loups flips through your video looking for frames that look like your bookmark. When it finds one, it reads the text on that page.


๐Ÿ‘ฃ 4-Step Process

1โƒฃ Find a Clear Frame

Pause your video where the identifying text overlay is clearly visible:

  • Sports: Scoreboard with player name
  • Podcasts: Guest name overlay
  • Gaming: Level title card
  • Educational: Speaker introduction

Best Practices

  • Text is fully visible and readable
  • No motion blur
  • Consistent lighting
  • Frame appears multiple times in video

2โƒฃ Take a Screenshot

Capture the frame:

  • Press โŒ˜ + Shift + 4
  • Select area to capture
  • File saved to Desktop
  • Press Win + Shift + S
  • Select area
  • Save from clipboard
  • Use screenshot tool
  • Or: gnome-screenshot -a

3โƒฃ Crop the Template

Open in image editor and crop to include:

  • The region where text appears
  • Some surrounding context (helps matching)
  • Exclude elements that change frame-to-frame

Crop Carefully

Too large: May include changing elements โ†’ false negatives Too small: May not match reliably โ†’ missed detections

Just right: Includes text region + stable surrounding area

4โƒฃ Save and Use

Save as PNG (recommended) or JPG:

loups -t my_template.png video.mp4

๐ŸŽจ Template Examples

Sports Scoreboard

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  BATTER: Sarah Johnson #7   โ”‚  โ† Include this
โ”‚  INNING: 3   SCORE: 2-1     โ”‚  โ† Crop around text
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

What to include: - Player name area - Jersey number location - Stable background elements

What to exclude: - Changing score - Moving elements - Video timestamp

Podcast Guest Overlay

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  NOW SPEAKING:       โ”‚
โ”‚  Dr. Jane Smith      โ”‚  โ† Crop this region
โ”‚  AI Researcher       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

What to include: - Name card background - "NOW SPEAKING" label if consistent - Text region

Game Level Card

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  LEVEL 5        โ”‚  โ† Level text
โ”‚  The Castle     โ”‚  โ† Level name
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

What to include: - Level indicator - Title text area - Consistent UI elements


โœ… Template Quality Checklist

Good Template Characteristics

  • High contrast - Text clearly visible
  • Consistent position - Same location throughout video
  • Clear text - No blur, pixelation, or distortion
  • Stable background - Unchanging elements
  • Appropriate size - Not too large, not too small
  • Good resolution - Match video quality

Avoid These Issues

  • Motion blur or partial frames
  • Changing elements (scores, timers)
  • Low resolution or compression artifacts
  • Text partially cut off
  • Inconsistent appearance across video

๐Ÿงช Testing Your Template

Step 1: Test on Short Clip

Create a test clip first:

# Extract first 2 minutes with ffmpeg
ffmpeg -i full_video.mp4 -t 120 -c copy test_clip.mp4

Step 2: Run with Logging

loups --log --debug -t my_template.png test_clip.mp4

Step 3: Check Results

# View the log
cat loups.log

# Look for:
# - Template match timestamps
# - OCR confidence scores
# - Extracted text

Step 4: Adjust if Needed

Troubleshooting

Too many matches? โ†’ Crop template more tightly Missing matches? โ†’ Include more surrounding context Wrong text extracted? โ†’ Adjust template boundaries Garbled OCR? โ†’ Use higher quality source frame


๐Ÿ’ก Advanced Tips

Multiple Templates

Can't find one template that works for all frames? Use different templates:

# Process same video multiple times with different templates
loups -t template1.png -o chapters1.txt video.mp4
loups -t template2.png -o chapters2.txt video.mp4

# Combine results manually
cat chapters1.txt chapters2.txt | sort > all_chapters.txt

Template for Thumbnails

Create a separate template for thumbnail extraction:

# Different template for title screen
loups video.mp4 thumbnail --thumbnail-template title_screen_template.png

Video Quality Matters

Source Quality

Template matching works best with:

  • 720p or higher video resolution
  • Minimal compression artifacts
  • Steady camera (for handheld footage)
  • Good lighting and contrast

Use Case Examples

Educational Lecture

Scenario: Video with speaker name overlays

Template includes:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ‘ค Speaker Name     โ”‚
โ”‚    Title/Role       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Result:

0:00:00 Introduction
0:05:30 Dr. Sarah Chen - Computer Science
0:25:15 Prof. Michael Brown - Mathematics
0:45:00 Dr. Lisa Wang - Physics

Music Performance

Scenario: Song title cards between performances

Template includes:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ๐ŸŽต Now Playing:     โ”‚
โ”‚  [Song Title]        โ”‚
โ”‚  [Artist Name]       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Result:

0:00:00 Opening
0:03:45 Song Title - Artist Name
0:08:20 Another Song - Different Artist

TV Series

Scenario: Episode title cards

Template includes:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  EPISODE 5         โ”‚
โ”‚  "Episode Title"   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ›  Tools for Template Creation

Tool Platform Free Use Case
Preview macOS Built-in, simple cropping
Paint Windows Basic editing
GIMP All Advanced editing
ffmpeg All Extract frames
VLC All Screenshot frames

Extract Frame with ffmpeg

Get a perfect frame from exact timestamp:

# Extract frame at 01:23:45
ffmpeg -ss 01:23:45 -i video.mp4 -frames:v 1 template.png

๐Ÿ”— Next Steps

Now that you have a template:

  1. Quick Start - Use your template
  2. CLI Reference - Template options
  3. API Reference - Programmatic usage

โ“ Common Questions

Can I use the same template for different videos?

Yes, if the videos have the same overlay/UI format!

For example: - All episodes of same TV series - Same game with consistent UI - Videos from same production

What image format should I use?

PNG recommended for best quality (lossless compression)

Also supported: - JPG/JPEG (acceptable, slightly lower quality) - BMP (works but larger files)

Does template size matter?

Yes! Template should be:

  • Same resolution as video (or close)
  • Large enough to be distinctive
  • Small enough to avoid changing elements

Typically 200-800 pixels wide works well.

Can I create templates from YouTube videos?

Absolutely! Take screenshots while watching:

  • Pause at the overlay you want
  • Screenshot the browser window
  • Crop to just the overlay region
  • Use with downloaded video file
My template isn't matching. What now?

Try these steps:

  1. Enable debug logging: loups --log --debug -t template.png video.mp4
  2. Check the log for match confidence scores
  3. Verify template matches video frames exactly
  4. Adjust crop - try larger/smaller regions
  5. Check resolution - template should match video quality

Still stuck? Open an issue with: - Sample frame from video - Your template image - Debug log output