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)
pygamevideo module helps developer to embed videos into their Pygame display

pygamevideo module helps developer to embed videos into their Pygame display. Audio playback doesn't use pygame.mixer.

Kadir Aksoy 10 Dec 28, 2022
Telegram Music/ Video Streaming Bot Using Pytgcalls

Video Player 🔥 ᴢᴀɪᴅ ᴠᴄ ᴘʟᴀyᴇʀ ɪꜱ ᴀ ᴛᴇʟᴇɢʀᴀᴍ ᴘʀᴏᴊᴇᴄᴛ ʙᴀꜱᴇᴅ ᴏɴ ᴘʏʀᴏɢʀᴀᴍ ꜰᴏʀ ᴘʟᴀʏ ᴍᴜꜱɪᴄꜱ ɪɴ ᴠᴄ ᴄʜᴀᴛꜱ... 🅡🅔🅟🅞 🅢🅣🅐🅣🅢 ʀᴇQᴜɪʀᴇᴍᴇɴᴛꜱ 📝 FFmpeg NodeJ

16 Nov 30, 2022
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 simple Python Youtube Wachtime for YTbebot

Simple bot that was development in python 3.7, that automatically watch youtube videos. It can be used to give more views in your channel helping in the spread and increase the followers because your

Rian eka wiratma 1 Dec 05, 2021
Synchronize Two Cameras in Real Time using Multiprocessing

Synchronize Two Cameras in Real Time using Multiprocessing In progress ... 📁 Project Structure 📚 Install Libraries for this Project (requirements.tx

Eduardo Carvalho Nunes 2 Oct 31, 2021
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
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
Video-to-GIF-Converter - A small code snippet that can be used to convert any video to a gif

Video to GIF Converter Project Description: This is a small code snippet that ca

Hassan Shahzad 3 Jun 22, 2022
Convert Video Files To Text And Audio

Video-To-Text Convert Video Files To Text And Audio Convert To Audio 1: open dvtt folder in cmd 2: run this command in cmd = main.py Audio Convert To

Delta Inc. 2 Dec 05, 2021
Add a "flame" effect on each hand's index onto a video stream.

Add a "flame" effect on each hand's index onto a video stream. recording.webm.mov This script is just a quick hack, it's a bit of glue between mediapi

Paul Willot 7 Sep 15, 2022
Boltstream Live Video Streaming Website + Backend

Boltstream Self-hosted Live Video Streaming Website + Backend Reference

Ben Wilber 1.7k Dec 28, 2022
This program is to make a video based on Deep Dream

This program is to make a video based on Deep Dream. The program is modified from DeepDreamAnim and DeepDreamVideo with additional functions for bleding two frames based on the optical flows. It also

Aertist 23 Jan 22, 2022
Python application that can be used to generate video thumbnail for mp4 and mkv file types.

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

Tharindu N. 13 Jan 03, 2023
Python based script to operate FFMPEG.

FMPConvert Python based script to operate FFMPEG. Ver 1.0 -- 2022.02.08 Feature ✅ Maximum compatibility: Third-party dependency libraries unused ✅ Che

cybern000b 1 Feb 28, 2022
Script simples para baixar vídeos/áudios/playlist do YouTube

🔗 VilelaTube ▶️ Script simples para baixar vídeos/áudios/playlist do YouTube Requisitos • Como usar • Melhorias futuras ⚠️ Atenção! ⚠️ Lembre-se de a

João Victor Vilela dos Santos 2 Nov 03, 2021
Docker container to expose a local RTMP, RTSP, and HLS stream for all your Wyze cameras including v3

Docker container to expose a local RTMP, RTSP, and HLS stream for all your Wyze cameras including v3. No Third-party or special firmware required.

1.2k Jan 07, 2023
pyffstream - A CLI frontend for streaming over SRT and RTMP specializing in sending off files

pyffstream - A CLI frontend for streaming over SRT and RTMP specializing in sending off files

Gregory Beauregard 3 Mar 04, 2022
A simple Telegram bot to extract hard-coded subtitle from videos using FFmpeg & Tesseract.

Video Subtitle Extractor Bot A simple Telegram bot to extract hard-coded subtitle from videos using FFmpeg & Tesseract. Note that the accuracy of reco

14 Oct 28, 2022
Converts Betaflight blackbox gyro to MP4 GoPro Meta data so it can be used with ReelSteady GO

Here are a bunch of scripts that I created some time ago as a proof of concept that Betaflight blackbox gyro data can be converted to GoPro Metadata F

108 Oct 05, 2022
Python Script for Streaming YouTube Videos in VLC Media Player.

Short Description Use this Simple Script to stream YouTube Video to VLC

Sijey 6 May 27, 2021