Skip to main content

Thumbnail + preview tools for media folders (ffmpeg + pillow helpers).

Project description

Librifygen

High-performance thumbnail & preview generator for videos and images.

Librifygen is a cross-platform media processing toolkit that generates:

  • Image thumbnails
  • Video thumbnails (single-frame extraction)
  • Video preview clips (random segments stitched together)
  • Full CLI tool + clean Python API
  • Designed for automation, content pipelines, and library indexing tools.

Uses ffmpeg for video operations and Pillow for image processing.


🚀 Features

  • Extract thumbnails from videos at midpoint or a provided timestamp
  • Resize images intelligently (crop or letterbox)
  • Batch-scan directories recursively
  • Create multi-clip video previews
  • CLI + Python module
  • Works on Linux, Windows, macOS
  • Safe and predictable processing (temp dirs, logging, error handling)

📦 Installation

Requires:

Python 3.8+
Pillow
ffmpeg-python
ffmpeg (system binary)

Install Librifygen:

pip install librifygen

🔧 Installing ffmpeg (Required)

Librifygen depends on the ffmpeg binary being present in your system PATH. Here are the easiest installation methods per OS:


🟦 Windows

Option A — Use Chocolatey (recommended)

choco install ffmpeg

Option B — Use Scoop

scoop install ffmpeg

Option C — Manual Download

  1. Download from: https://www.gyan.dev/ffmpeg/builds/
  2. Extract the folder
  3. Add the bin/ directory to your PATH environment variable

Verify:

ffmpeg -version

🍎 macOS

Using Homebrew (recommended)

brew install ffmpeg

Using MacPorts

sudo port install ffmpeg

Verify:

ffmpeg -version

🐧 Linux

Debian / Ubuntu

sudo apt update
sudo apt install ffmpeg

Fedora

sudo dnf install ffmpeg

Arch Linux

sudo pacman -S ffmpeg

Verify:

ffmpeg -version

🖥️ CLI Usage

After installation, the librifygen command becomes available:

librifygen <command> [options]

Available commands:

  • thumbs — generate thumbnails for images/videos in a directory
  • preview — generate multi-clip preview videos

▶️ Generate Thumbnails

Basic usage

librifygen thumbs /path/to/media /path/to/output

With workers & custom size

librifygen thumbs ~/Pictures ~/Thumbs --workers 8

🎬 Generate Preview Videos

librifygen preview ./videos ./previews

Custom clips, duration, audio, transitions

librifygen preview ./videos ./previews \
    --num-clips 4 \
    --clip-duration 3 \
    --workers 4

A preview is generated like:

input.mp4 → previews/input_preview.mp4

🐍 Python API Usage

Use Librifygen directly in your Python code:


✔ Generate image thumbnail

from librifygen.thumbnail import generate_image_thumbnail

output = generate_image_thumbnail(
    "media/photo.png",
    "thumbnails/photo.jpg"
)

print(output)

✔ Generate video thumbnail

from librifygen.thumbnail import generate_video_thumbnail

thumb = generate_video_thumbnail(
    "media/video.mp4",
    "thumbnails/video.jpg"
)
print("Thumbnail:", thumb)

✔ Generate preview video

from librifygen.preview import generate_video_preview

preview = generate_video_preview(
    "media/video.mp4",
    "previews",
    num_clips=4,
    clip_duration=5,
)
print(preview)

✔ Batch processing

from librifygen.thumbnail import generate_thumbnails

results = generate_thumbnails(
    input_dir="media",
    output_dir="thumbs",
    max_workers=6
)

for src, out in results:
    print(src, "->", out)

📂 Example Project Structure

You can integrate Librifygen into your own project like:

project/
│
├── media/
│   ├── images/
│   ├── videos/
│
├── thumbs/
│
├── previews/
│
└── generate_media_assets.py

Example script:

from librifygen.thumbnail import generate_thumbnails
from librifygen.preview import batch_create_previews

generate_thumbnails("media", "thumbs", max_workers=8)
batch_create_previews("media/videos", "previews", num_clips=4)

⚙️ Supported Formats

Images

jpg, jpeg, png, bmp, tiff, webp

Videos

mp4, mov, mkv, webm, avi, flv, m4v

Formats are customizable using:

from librifygen.config import set_extensions
set_extensions(video_exts=[".mp4", ".mov"], image_exts=[".jpg"])

🧩 Roadmap

  • GPU-accelerated previews (via CUDA / Vulkan / Metal)
  • Progress bars & verbose CLI
  • Config file support
  • Parallel image-resizing via ProcessPool optimization
  • WebAssembly build (ffmpeg-wasm) for browser-based pipelines

📝 License

MIT License © Me


🤝 Contributing

Pull requests welcome. Please open issues for bugs, feature requests, or ffmpeg compatibility questions.


🧪 Testing your installation

pip install librifygen
librifygen --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

librifygen-0.1.3.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

librifygen-0.1.3-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file librifygen-0.1.3.tar.gz.

File metadata

  • Download URL: librifygen-0.1.3.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for librifygen-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8a35f095e379b9e95df9be1f36c5c2d6b3c366d0920037a963d831fd22df070d
MD5 26a8b39ec4209f9eef46fd14f4a58511
BLAKE2b-256 4ded9a6aef0dfb210ccfb07b61373e97dfca451022acf10db425a442354ac5f8

See more details on using hashes here.

File details

Details for the file librifygen-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: librifygen-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for librifygen-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5f2387b3d8b961bb4cf2870017170499ddbb0ac88c8c5f229eb1ac6b250bf372
MD5 92396a65420339e23350ce8645ced0f5
BLAKE2b-256 739cb536ff4ee47919fe6247c071953fa15ba29027e575153226dd7170250fb7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page