Skip to main content

Python application that can be used to generate video thumbnail for mp4 and mkv file types.

Project description

https://github.com/truethari/thumb-gen/actions/workflows/thumb-gen.yml/badge.svg https://app.codacy.com/project/badge/Grade/01b66feeb94743ac80e413e4e9075595

What is This?

This is a Python application that can be used to generate video thumbnail for mp4 and mkv file types.

https://i.imgur.com/CXJbxUl.png

Installation

You can use pip:

~$ pip3 install thumb-gen

Configurations

  • The number of screen images that should be included in the final thumbnail image.

  • Thumbnail image quality

  • Font type in the video info panel. You can add a file path of a font file (.ttf) to this.

  • Font size in the video info panel

  • Custom text in the video info panel

  • Background color of the thumbnail (Hex codes are also supported)

  • Font colour of the thumbnail (Hex codes are also supported)

Download font files : FontSquirrel

~$ thumb-gen -c

or

~$ thumb-gen --config

By program default:

IMAGES = 12
IMAGE_QUALITY = 80
FONT =
FONT_SIZE = 30
CUSTOM_TEXT =
BG_COLOUR = white
FONT_COLOUR = black

Usage

Usage options:

-h, --help      show this help message and exit

-c, --config    configurations

-v, --version   show program's version number and exit

-f, --file      input a single video

-d, --dir       input videos from a directory

Console

~$ thumb-gen -h
~$ thumb-gen --help

~$ thumb-gen -c
~$ thumb-gen --config

~$ thumb-gen -v
~$ thumb-gen --version

~$ thumb-gen -f input.mp4
~$ thumb-gen --file input.mp4
~$ thumb-gen --file "d:/videos/input.mp4"

~$ thumb-gen -d videos
~$ thumb-gen --dir videos
~$ thumb-gen --dir "d:/videos"

Python

  • If you don’t set an output folder, thumbnail images will be saved in the video folder (video_path).

  • If you don’t need a custom text and custom font file (including font size) and you have already set these for the configuration file (using console or defaults), it will be added automatically. To avoid this set the custom_text value to False and add a custom font file location.

Example 1

from thumb_gen.worker import Generator

#video_path, output_path='', custom_text=True
app = Generator("C:/input/video.mp4", "C:/output/", "www.example.com")
app.run()

Example 2

import os
from thumb_gen.worker import Generator

folder = 'C:/input'
for video in os.listdir(folder):
   if video.endswith('.mp4') or video.endswith('.mkv'):
      app = Generator(os.path.join(folder, video), custom_text=False, font_dir="C:/Project/font.ttf", font_size=25, bg_colour='blue', font_colour='red')
      app.run()

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

thumb_gen-1.0.5.tar.gz (11.2 kB view hashes)

Uploaded Source

Built Distribution

thumb_gen-1.0.5-py3-none-any.whl (85.4 kB view hashes)

Uploaded Python 3

Supported by

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