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

Overview

Thumbnail Generator 🎬

github actions Codacy Badge made-with-python PyPI version

What is This


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

Imgur

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 = 20
CUSTOM_TEXT = 
BG_COLOUR = white
FONT_COLOUR = black

Usage

Usage options

Usage: thumb-gen file file
usage: thumb-gen dir dir

Options:
  -h, --help     show this help message and exit
  -c, --config   configurations (images, image quality, font, font size,
                 custom text, bg color, font color)
  -v, --version  show thumb-gen version and exit

Console

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

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

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

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

~$ thumb-gen "/videos"
~$ thumb-gen "/videos" "/videos2"
~$ thumb-gen "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 import Generator

#video_path, output_path='', custom_text=True, font_dir='', font_size=0, bg_colour='', font_colour=''
app = Generator("C:/input/video.mp4", "C:/output/", "www.example.com", "C:/Windows/Fonts/Arial.ttf", 30)
app.run()

Example 2

import os
from thumb_gen 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()
You might also like...
This plugin generates json files used by deovr allowing you to play 2d and 3d video's using the player

deovr-plugin This plugin generates json files used by deovr allowing you to play 2d and 3d video's using the player. Deovr looks for an index file /de

A pure python media player that can be used in AI media API development.

A pure python media player that can be used in AI media API development.

Text2Video's purpose is to help people create videos quickly and easily by simply typing out the video’s script and a description of images to include in the video.
Text2Video's purpose is to help people create videos quickly and easily by simply typing out the video’s script and a description of images to include in the video.

Text2Video Text2Video's purpose is to help people create videos quickly and easily by simply typing out the video’s script and a description of images

Takes a video as an input and creates a video which is suitable to upload on Youtube Shorts and Tik Tok (1080x1920 resolution).

Shorts-Tik-Tok-Creator Takes a video as an input and creates a video which is suitable to upload on Youtube Shorts and Tik Tok (1080x1920 resolution).

Repository to create Ascii art in CMD based on video file.
Repository to create Ascii art in CMD based on video file.

Made to take any file format, and transform it into ascii art, displayed as a video in the cmd. If the cmd formatting is wrong, try zooming a little and remember to make cmd fullscreen. I made my cmd fullscreen, and zoomed out one tic. Written in Python 3.9

 Extracting frames from video and create video using frames
Extracting frames from video and create video using frames

Extracting frames from video and create video using frames This program uses opencv library to extract the frames from video and create video from ext

This application makes a webrtc video call with jitsi meet signaling

gstreamer-jitsi-meet This application makes a webrtc video call with jitsi meet signaling. Other end can be any jitsi meet app or web app. It doesn't

Streamlink is a CLI utility which pipes video streams from various services into a video player

Streamlink is a CLI utility which pipes video streams from various services into a video player

Filtering user-generated video content(SberZvukTechDays)Filtering user-generated video content(SberZvukTechDays)
Filtering user-generated video content(SberZvukTechDays)Filtering user-generated video content(SberZvukTechDays)

Filtering user-generated video content(SberZvukTechDays) Table of contents General info Team members Technologies Setup Result General info This is a

Comments
  • Sending more variables with the

    Sending more variables with the "Generator"

    import os
    from thumb_gen 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()
    

    This code is very useful, but I want to send more veriables, eg: row size of images, or columns size of images.

    Another issue is with custom text. Custom text is under images when it's too long.

    opened by metin02oktay 2
  • [Feature] Adding more formats as compatible.

    [Feature] Adding more formats as compatible.

    Hi there, thanks for this nice script. I've modified it to work with more formats, the only problem I've found where the 4 digit extensions of "webm", it seems the script used self.output_path = self.video_path[:-4] which removed 4 last characters to add a new extension ("." included). The webm extension has 4 letters + 1 ".", meaning that output thumb files where named "file..jpg" if they where made from a .webm source (this is because self.output_path = self.video_path[:-4] would not remove the "." character)

    Here are the small modifications I've made in case you want to modify the script:

    worker.py:

    
            if output_path == '':
                if video_path.endswith('webm'):
                    self.output_path = self.video_path[:-5]
                    self.output_folder = listToString(re.split(pattern = r"[/\\]", string = self.video_path)[:-1], "sys")
                else:
                    self.output_path = self.video_path[:-4]
                    self.output_folder = listToString(re.split(pattern = r"[/\\]", string = self.video_path)[:-1], "sys")
    
            else:
                if video_path.endswith('webm'):
                    self.filename = re.split(pattern = r"[/\\]", string = self.video_path)[-1]
                    self.output_path = os.path.join(output_path, self.filename[:-5])
                    self.output_folder = self.output_path
                else:
                    self.filename = re.split(pattern = r"[/\\]", string = self.video_path)[-1]
                    self.output_path = os.path.join(output_path, self.filename[:-4])
                    self.output_folder = self.output_path
    
    

    main.py:

    def check_files(paths_or_files):
        videos = []
        current_directory = os.getcwd()
    
        for path_or_file in paths_or_files:
            if not os.path.exists(path_or_file):
                if not os.path.exists(os.path.join(current_directory, path_or_file)):
                    sys.exit("{}: no such file or directory".format(path_or_file))
                else:
                    real_path = os.path.join(current_directory, path_or_file)
            else:
                if os.path.isfile(path_or_file):
                    real_path = path_or_file
                else:
                    real_path = os.path.join(current_directory, path_or_file)
    
            if os.path.isfile(real_path):
                if real_path.endswith(('mp4', 'mkv', 'm4v', 'webm', 'avi', 'wmv')):
                    videos.append(real_path)
                else:
                    sys.exit("{}: file not supported".format(real_path))
            elif os.path.isdir(real_path):
                for file in os.listdir(real_path):
                    if file.endswith(('mp4', 'mkv', 'm4v', 'webm', 'avi', 'wmv')):
                        videos.append(os.path.join(real_path, file))
                if videos == []:
                    sys.exit("{}: all of files in the directory are not supported".format(real_path))
    
        return videos
    
    opened by masterofobzene 0
Releases(v4.0.1)
A project that uses optical flow and machine learning to detect aimhacking in video clips.

waldo-anticheat A project that aims to use optical flow and machine learning to visually detect cheating or hacking in video clips from fps games. Che

RicanSamurai 542 Dec 03, 2022
A Simple Telegram Bot By @Tellybots to add Subtitle Files in Video

Video-subtitle-merger A Simple Telegram Bot By @Tellybots to add Subtitle Files in Video Features Force Sub Button Added Soon Support Media Type Such

6 Dec 31, 2021
Tweet stream in OBS browser source

OBS-Twitter-Stream OBSなどの配信ソフトのブラウザソースで特定のキーワードを含んだツイートを表示します 使い方 使い方については以下のwikiを御覧ください https://github.com/CubeZeero/OBS-Twitter-Stream/wiki ダウンロード W

Cube 23 Dec 18, 2022
This is a simple script to generate a .opml file from a list of youtube channels.

Youtube to rss Don't spend more time than you need to on youtube.com This is a simple script to generate a .opml file from a list of youtube channels.

Kostas 1 Oct 04, 2022
Image and video quality assessment

CenseoQoE: 视觉感知画质评价框架 项目介绍 图像/视频在编解码、传输和显示等过程中难免引入不同类型/程度的失真导致图像质量下降。图像/视频质量评价(IVQA)的研究目标是希望模仿人类视觉感知系统, 通过算法评估图片/视频在终端用户的眼中画质主观体验的好坏,目前在视频编解码、画质增强、画质监。

Tencent 133 Dec 20, 2022
Create a Video Membership app using FastAPI & NoSQL

Video Membership Create a Video Membership app using FastAPI & NoSQL. In this series, we're going to explore building a membership application using F

Coding For Entrepreneurs 69 Dec 25, 2022
MPV remote controller is a program for remote controlling mpv player with device in your local network through web browser.

MPV remote controller is a program for remote controlling mpv player with device in your local network through web browser.

5 May 26, 2022
camKapture is an open source application that allows users to access their webcam device and take pictures or create videos.

camKapture is an open source application that allows users to access their webcam device and take pictures or create videos.

manoj 1 Jun 21, 2022
Use ZWO astronomy camera as an IP camera.

ZWO Astronomy Camera as IP Camera Astronomy cameras are known for their high sensitivity and flexibility on whether to have IR pass through and bayer

Yan Wang 9 Oct 15, 2022
Video stream recording dockerized server using python/ffmpeg.

Stream Recording Server Video stream recording dockerized server using python/ffmpeg. Usage Configuration Prepare .env file, check .env.example for th

GR 2 Jan 14, 2022
GStreamer Inspector GUI

gst-explorer GStreamer GUI Interface Tool GUI interface for inspecting GStreamer Plugins, Elements and Type Finders. Expects Python3 Qt, PyQt5 and GSt

Jetsonhacks 31 Nov 29, 2022
A Advanced Anime Theme VC Video Player created for playing vidio in the voice chats of Telegram Groups

Yui Vidio Player A Advanced Anime Theme VC Video Player created for playing vidio in the voice chats of Telegram Groups Demo Setting up Add this Bot t

Achu biju 32 Sep 16, 2021
Python program - to extract slides from videos

Programa em Python - que fiz em algumas horas e que provavelmente tem bugs - para extrair slides de vídeos.

Natanael Antonioli 45 Nov 12, 2022
A pure python media player that can be used in AI media API development.

A pure python media player that can be used in AI media API development.

YDOOK 1 Dec 04, 2021
Terminal-Video-Player - A program that can display video in the terminal using ascii characters

Terminal-Video-Player - A program that can display video in the terminal using ascii characters

15 Nov 10, 2022
This is an example of building a video Question-Answer system using Jina.

example-video-search This is an example of building a video Question-Answer system using Jina. The index data is subtitle files of YouTube videos. Aft

Jina AI 9 Oct 18, 2022
A Telegram bot to convert videos into x265/x264 format via ffmpeg.

Video Encoder Bot A Telegram bot to convert videos into x265/x264 format via ffmpeg. Configuration Add values in environment variables or add them in

1 Mar 08, 2022
Python bindings for FFmpeg - with complex filtering support

ffmpeg-python: Python bindings for FFmpeg Overview There are tons of Python FFmpeg wrappers out there but they seem to lack complex filter support. ff

Karl Kroening 7.7k Jan 03, 2023
Spotify playlist video generator

This program creates a video version of your Spotify playlist by using the Spotify API and YouTube-dl.

0 Mar 03, 2022
Code for the manim-generated scenes used in 3blue1brown videos

Code for the manim-generated scenes used in 3blue1brown videos

Grant Sanderson 4.1k Jan 09, 2023