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.
- 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)
Requires:
Python 3.8+
Pillow
ffmpeg-python
ffmpeg (system binary)
Install Librifygen:
pip install librifygenLibrifygen depends on the ffmpeg binary being present in your system PATH. Here are the easiest installation methods per OS:
choco install ffmpegscoop install ffmpeg- Download from: https://www.gyan.dev/ffmpeg/builds/
- Extract the folder
- Add the
bin/directory to your PATH environment variable
Verify:
ffmpeg -versionbrew install ffmpegsudo port install ffmpegVerify:
ffmpeg -versionsudo apt update
sudo apt install ffmpegsudo dnf install ffmpegsudo pacman -S ffmpegVerify:
ffmpeg -versionAfter installation, the librifygen command becomes available:
librifygen <command> [options]
Available commands:
thumbsβ generate thumbnails for images/videos in a directorypreviewβ generate multi-clip preview videos
librifygen thumbs /path/to/media /path/to/outputlibrifygen thumbs ~/Pictures ~/Thumbs --workers 8librifygen preview ./videos ./previewslibrifygen preview ./videos ./previews \
--num-clips 4 \
--clip-duration 3 \
--workers 4A preview is generated like:
input.mp4 β previews/input_preview.mp4
Use Librifygen directly in your Python code:
from librifygen.thumbnail import generate_image_thumbnail
output = generate_image_thumbnail(
"media/photo.png",
"thumbnails/photo.jpg"
)
print(output)from librifygen.thumbnail import generate_video_thumbnail
thumb = generate_video_thumbnail(
"media/video.mp4",
"thumbnails/video.jpg"
)
print("Thumbnail:", thumb)from librifygen.preview import generate_video_preview
preview = generate_video_preview(
"media/video.mp4",
"previews",
num_clips=4,
clip_duration=5,
)
print(preview)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)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)jpg, jpeg, png, bmp, tiff, webp
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"])- 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
MIT License Β© Me
Pull requests welcome. Please open issues for bugs, feature requests, or ffmpeg compatibility questions.
pip install librifygen
librifygen --help