Skip to content

Create video thumbnails via kde dolphin or the command line simply and conveniently, using technologies such as 🎬 ffmpeg and πŸ§™β€β™‚οΈ imagemagick.

License

Notifications You must be signed in to change notification settings

AntonioNarcilio/generate-thumbnails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

50 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Thumbnail generator

Create thumbnails of a video in a simple and practical way


GitHub repo size licença GitHub last commit

PortuguΓͺs Brasileiro πŸ‡§πŸ‡·



πŸ“ Description

The development of this thumbnail generator was thinking about meeting a need I felt (or maybe yours) that not only found the generation of video thumbnails very practical but also didn't like the final generated file. Searching quickly on the internet you will find several scripts or even applications like SMPLAYER, VLC that generate thumbnails, but as I described before, the final file is not exactly what I want, as the file that contains the video thumbnails usually comes with information related to the resolution, size, frames...( see the example ). Regarding the file generated by SMPLAYER in particular, I even developed a script that does the cropping process, removing what I don't want from the image, leaving only the video frames, but besides not being practical, because to generate a thumbnail, I need to open the video file in the program and select the option related to generating thumbnails (I don't know if it has this option via the command line), when trying to run this script on another machine, the expected result ends up not being exactly the same, because SMPLAYER, when adding the data referring to certain video information in the thumbnail, ends up using the system's default font, making the file different from the one expected, with a larger or smaller size; in case the system (probably) uses a different font than the one I used (in my system) when developing the clipping script.

Doing several researches and also as I already have a certain knowledge about the tools / technologies (ImageMagick, FFmpeg e Kdialog), i developed this thumbnail generation script.



🚧 Dependencies

For the thumbnail generation script to work as expected, you must first have the following dependencies installed on your machine.

Where is it used?
Used in pop-up notifications and dialogs such as:

Get superuser/administrator password (only used in installation file).

Grid choice in thumbnail generation.

Show messages (pop-up) containing information about the thumbnail generation process...

How to install ?

First, make sure you have kdialog installed on your machine (if you prefer, the install.sh file does this check for you).

kdialog --version

πŸ’‘ If returning something other than kdialog <version_number> is a sign that you don't have this dependency installed on your machine, if this is exactly your situation, continue with the brief installation process below.

Briefly, run the following command in the terminal to install the dependency:

Distros Debian
sudo apt update && sudo apt install kdialog -y
Distro Arch Linux
sudo pacman -Sy kdialog

πŸ’‘ For more, click on the name kdialog (in blue) there at the beginning of the thread; where you will be redirected to the app's official page.


Where is it used?

Used to generate thumbnails (separate files) at a time interval...

How to install ?

First, make sure you have FFmpeg installed on your machine (if you prefer, the install.sh file does this check for you).

ffmpeg -version

πŸ’‘ If returning something other than ffmpeg version <numero_da_versao> Copyright ... is a sign that you don't have this dependency installed on your machine, if this is exactly your situation, continue with the brief installation process below.

Briefly, run the following command in the terminal to install the dependency:

Distros Debian
sudo apt update && sudo apt install ffmpeg -y
Distro Arch Linux
sudo pacman -Sy ffmpeg

πŸ’‘ For more, click on the name FFmpeg (in blue) there at the beginning of the thread; where you will be redirected to the app's official page.


Where is it used?

ImageMagick is a very powerful command line image manipulation tool. Here, it is used to convert the separate thumbnails into a final file (join files) and optimize it.

How to install ?

The files described above will be copied to their respective directories: First, make sure you have ImageMagick installed on your machine (if you prefer, the `install.sh` file does this check for you).
convert --version

πŸ’‘ If returning something other than Version: ImageMagick <numero_da_versao> Copyright ... is a sign that you don't have this dependency installed on your machine, if this is exactly your situation, continue with the brief installation process below.

Briefly, run the following command in the terminal to install the dependency:

Distros Debian
sudo apt update && sudo apt install imagemagick -y
Distro Arch Linux
sudo pacman -Sy imagemagick

πŸ’‘ For more, click on the name ImageMagick (in blue) there at the beginning of the thread; where you will be redirected to the app's official page.



πŸ‘ Recommendations

I recommend using the excellent dolphin file manager, through it you can use the script via the context menu see more on how to use it.

πŸ›Έ Features

  • Thumbnail generation via context menu in file manager dolphin. See how to use.
  • Thumbnail generation via command line. See how to use.
  • Option to choose which structure will have the final file containing the thumbnails (4x4, 5x5, 6x6).

πŸ“½ Identified video formats

By default, the following formats are identified when trying to generate a thumbnail, via the command line (terminal) or via the dolphin file manager.

Extensions Extensions
.avi - .mp4
.m4v - .mov
.mpg - .mpeg
.wmv - .mkv
.ts -

πŸ’‘ In the dolphin file manager, for example, the "shortcut" in the context menu will only appear if you select a video that has one of the extensions specified above. Read more at, how to use



πŸš€ Install

Installation is very simple, just run the install script (install.sh) and it will do the rest for you, but pay attention to the initial setup πŸ‘‡.

Initial setting

Before running the installation file install.sh, you need permission to run it. There are two ways to go about this process.
  1. Via dolphin file manager (graphical interface): Right-click the install.sh file and select properties > permissions and check the is executable box.

    is-executable

  2. Via command line (terminal):

    chmod +x ./install.sh

How to use?

There are also two ways to run the script:
  1. Via dolphin file manager (graphical interface): Double-click the install.sh file.

    run-script

  2. Via command line (terminal):

    ./install.sh

After running the install.sh file, a dialog box asking for the superuser / administrator password will appear, pass the password to proceed with the installation process.

user-password

The script will check if all dependencies are installed, if the return is positive it will continue with the installation process, at the end of the process if everything goes as expected, a pop-up will appear informing you that the installation was successful. Otherwise, a message (pop-up) will appear informing you of the error found.

successfully-installed

What does this script do ?

This script is to automate the "installation" process of the thumbnail generator

What types of files will be installed ?

In fact, it will copy the following files, all found in the repository.
.
β”œβ”€β”€ emojis
β”‚Β Β  β”œβ”€β”€ emoji_u1f389.svg
β”‚Β Β  β”œβ”€β”€ emoji_u1f39e.svg
β”‚Β Β  β”œβ”€β”€ emoji_u1f3ac.svg
β”‚Β Β  β”œβ”€β”€ emoji_u1f5bc.svg
β”‚Β Β  β”œβ”€β”€ emoji_u1f9d9_1f3fc_200d_2642.svg
β”‚Β Β  └── emoji_u1f9e9.svg
β”œβ”€β”€ fonts
β”‚Β Β  └── Roboto-Regular.ttf
β”œβ”€β”€ icons
β”‚Β Β  β”œβ”€β”€ an-alert.svg
β”‚Β Β  β”œβ”€β”€ an-edition.svg
β”‚Β Β  β”œβ”€β”€ an-effects.svg
β”‚Β Β  β”œβ”€β”€ an-error.svg
β”‚Β Β  β”œβ”€β”€ an-scripts.svg
β”‚Β Β  └── an-utilities.svg
β”œβ”€β”€ generate_thumbnails
└── generate-thumbnails.desktop

Where will these files be copied to ?

The files described above will be copied to their respective directories:

usr > share > pixmaps

.
β”œβ”€β”€ emojis
β”‚Β Β  β”œβ”€β”€ emoji_u1f389.svg
β”‚Β Β  β”œβ”€β”€ emoji_u1f39e.svg
β”‚Β Β  β”œβ”€β”€ emoji_u1f3ac.svg
β”‚Β Β  β”œβ”€β”€ emoji_u1f5bc.svg
β”‚Β Β  β”œβ”€β”€ emoji_u1f9d9_1f3fc_200d_2642.svg
β”‚Β Β  └── emoji_u1f9e9.svg
└──  icons
Β Β  β”œβ”€β”€ an-alert.svg
Β Β  β”œβ”€β”€ an-edition.svg
Β Β  β”œβ”€β”€ an-effects.svg
Β Β  β”œβ”€β”€ an-error.svg
Β Β  β”œβ”€β”€ an-scripts.svg
Β Β  └── an-utilities.svg

usr > local > share > fonts > r

.
└── fonts
     └── Roboto-Regular.ttf

usr > bin

.
└──  generate_thumbnails

home > user_name > .local > share > kservices5 > ServiceMenus

.
└──  generate-thumbnails.desktop



πŸ€” How to use?

There are two ways to generate thumbnails related to a specific video, through the context menu of the file manager dolphin or through the line command (terminal).

Through the dolphin file manager

  1. Right click on the video you want to generate the thumbnail to open the context menu, an option called Generate thumbnails will appear, click on it.

    dolphin-context-menu

  2. A dialog will appear asking whether or not you want to continue, click yes.

    kdialog-yesno

  3. Then another successful dialog asking which grid the final file will have, select an option. (for more see: final result)

    tile
  4. If everything goes as expected, a pop-up will appear informing you that the thumbnail was successfully generated and also the path where it was saved, clicking on the path (link) the image will open in the default image viewer.

    kdialog-popup


Through the command line (terminal)

If you want to generate the thumbnails via the command line, just run the command
$ generate_thumbnails "caminho/nome_do_arquivo_de_video"

command-line-generate-thumbnails

With that, just follow the same step-by-step described above in the generation of thumbnails by the dolphin file manager



πŸ₯³ Expected result

The files generated during the thumbnail creation process are saved in the directory:
tmp > thumbnails-file_name-random_number (removed on system restart)
The final file will be saved in the same directory where the selected video is located.

Thumbnail options

Grid Final file
4x4
5x5
6x6



πŸ“œ License

This project is under license MIT




created by @antonionarcilio

About

Create video thumbnails via kde dolphin or the command line simply and conveniently, using technologies such as 🎬 ffmpeg and πŸ§™β€β™‚οΈ imagemagick.

Topics

Resources

License

Stars

Watchers

Forks

Languages