Create thumbnails of a video in a simple and practical way
PortuguΓͺs Brasileiro π§π·
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.
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...
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:
sudo apt update && sudo apt install kdialog -y
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.
Used to generate thumbnails (separate files) at a time interval...
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:
sudo apt update && sudo apt install ffmpeg -y
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.
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.
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:
sudo apt update && sudo apt install imagemagick -y
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.
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.
- 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).
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
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 π.
Before running the installation file install.sh, you need permission to run it. There are two ways to go about this process.
-
Via dolphin file manager (graphical interface): Right-click the
install.sh
file and select properties > permissions and check theis executable
box.
-
Via command line (terminal):
chmod +x ./install.sh
There are also two ways to run the script:
-
Via dolphin file manager (graphical interface): Double-click the
install.sh
file.
-
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.
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.
This script is to automate the "installation" process of the thumbnail generator
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
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
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).
-
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.
-
A dialog will appear asking whether or not you want to continue, click yes.
-
Then another successful dialog asking which grid the final file will have, select an option. (for more see: final result)
-
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.
If you want to generate the thumbnails via the command line, just run the command
$ generate_thumbnails "caminho/nome_do_arquivo_de_video"
With that, just follow the same step-by-step described above in the generation of thumbnails by the dolphin file manager
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.
Grid | Final file |
---|---|
4x4 | |
5x5 | |
6x6 |
This project is under license MIT
created by @antonionarcilio