[Executable] Tracker -- 'Thumbnails' view of videofiles in folders - started to evolving (hint : post #21, #23 and #24)

Ahoy,

I hoped I can set in Tracker to show videofiles as thumbnails instead of simple VHS casette icon.

I found the following in combined report of 2022, December

“PulkoMandy made Tracker always use the thumbnail attribute for an icon if there is one, even if Tracker does not know how to generate that thumbnail. This makes it possible for other applications to save previews viewable in Tracker for any filetype they want.”

Does it relate to pictures/image files only ?

Are those can be generated for videofiles too ?

I found a commandline program - ffmpegthumbnailer - and installed

~> pkgman sea thumbnail
Status  Name                      Description                                        
-------------------------------------------------------------------------------------
        blender                   3D Creation/Animation/Publishing System            
        blender28                 3D Creation/Animation/Publishing System            
        blender29                 3D Creation/Animation/Publishing System            
        blender3                  3D Creation/Animation/Publishing System            
        ffmpegthumbnailer         A lightweight video thumbnailer                    
        ffmpegthumbnailer_devel   A lightweight video thumbnailer (development files)
        ffmpegthumbnailer_source  A lightweight video thumbnailer (source files)     
S       gdk_pixbuf                Bitmap rendering and loading support               
        gdk_pixbuf_debuginfo      Bitmap rendering and loading support (debug info)  
        libgsf_tools               The G Structured File Library                     
        libheif_debuginfo         HEIF file format decoder and encoder (debug info)  
        libheif_tools             Tools for libheif package                          
~> pkgman ins ffmpegthumbnailer
100% repochecksum-1 [65 bájt]
Ellenőrzőkód érvényesítése a tárolóhoz (BeSly Software Solutions)...done.
100% repochecksum-1 [65 bájt]
Ellenőrzőkód érvényesítése a tárolóhoz (FatElk_64)...done.
100% repochecksum-1 [65 bájt]
Ellenőrzőkód érvényesítése a tárolóhoz (Haiku)...done.
100% repochecksum-1 [64 bájt]
Ellenőrzőkód érvényesítése a tárolóhoz (HaikuPorts)...done.
100% repochecksum-1 [71 bájt]
Ellenőrzőkód érvényesítése a tárolóhoz (LOTE)...done.
The following changes will be made:
  in system:
    install package ffmpegthumbnailer-2.2.3~git-1 from repository HaikuPorts
Continue? [yes/no] (yes) : 
100% ffmpegthumbnailer-2.2.3~git-1-x86_64.hpkg [296.34 KiB]
Validating checksum for https://eu.hpkg.haiku-os.org/haikuports/r1beta4/x86_64/current/packages/ffmpegthumbnailer-2.2.3~git-1-x86_64.hpkg...done.
[system] Applying changes ...
[system] Changes applied. Old activation state backed up in "state_2024-01-12_08:34:51"
[system] Cleaning up ...
[system] Done.
~> ffmpegthumbnailer -h
Usage: ffmpegthumbnailer [options]

Options:
  -i<s>   : input file
  -o<s>   : output file
  -s<n>   : thumbnail size (use 0 for original size) (default: 128)
  -t<n|s> : time to seek to (percentage or absolute time hh:mm:ss) (default: 10%)
  -q<n>   : image quality (0 = bad, 10 = best) (default: 8)
  -c      : override image format (jpeg, png or rgb) (default: determined by filename)
  -a      : ignore aspect ratio and generate square thumbnail
  -f      : create a movie strip overlay
  -m      : prefer embedded image metadata over video content
  -w      : workaround issues in old versions of ffmpeg
  -v      : print version number
  -h      : display this help
~> ffmpegthumbnailer -v
ffmpegthumbnailer version: 2.2.2
~> apropos ffmpegthumbnailer
apropos: nothing appropriate
~> 

I wonder if thumbnails - in Tracker - could be granted for videofiles as well ?

Also I’m happy that thumbnails scaling is available in Icon view.

Is that possible to add this scaling option to the List view as well ?

I found 96x96 thumbnail (icon) size very usable for simple, smaller pictures, but the screenshots are not so much …
Possibly wallpapers, bigger size pictures, images could be also not really transparent - in the meaning of recognizable/identifyable.
Also the filenames in Icon view cause that : the icons seem like they were thrown away and randomly lie on the desktop in the folder - especially if I had selected a larger icon size.

For them, I have only an expensive idea. Those larger pictures could be gathered in a bunch, showed - all large pics e.g. in 1/4 size - and also in perspective just as a rolling photo album, or a batch of paper pics object.

“What do you think today ?” :sunglasses:

3 Likes

This specific change relates to any file.

Tracker knows how to generate thumbnails. But, it is possible for other applications to generate their own thumbnails when saving files. I did this in the ACE Amstrad CPC emulator for emulator savestates. So you can see the display of the emulated machine in the thumbnail, something that Tracker would have no idea how to generate.

However, for videos I think nothing knows how to generate the thumbnails in a way that ffmpeg can understand, yet. So ffmpegthumbnqiler would need some updates, or some alternative code will have to be written.

1 Like

I should have been more clear.
After I installed ffmpedthumbnailer I understood that it won’t work as I expected.

It can be used (or more simply : I can use it ) in commandline

  1. to create several image format “thumbnail” files from a videofile
  2. from that file I must create an icon,
  3. after I should find the command that assign that icon with the affected videofile
    If I want an icon that scalable too - then I should
    4)) create a .png file ,
  4. and after convert it to Haiku’s vector type icon format,

After I went through this process/flow in theory … well then
I thought to do a search on Haiku site
is there something in Haiku - built-in Tracker or an add-on - to spare me from this manual labour in case all video files.
Especially in case scalable one., when raster → vector conversion is also needed.

This way I asked creating thumbnails working only for picture/image files.

I assume the code you mentioned should be written to cover the steps I described above or similar – to have an automatical or half automatical solution (half-automatical when we ignite the generation of thumbnails for video files).

Thanks for your reply - I just written this post to clarify :
I had not assumed the program I installed will solve the hiatus I have , I just written those 2 things together in topic starter as it happened this way.
Sorry to left out one logical step what led to searching the built-in solution after the single program installed.

My other question was toward List view in tracker :

is there a way to modify List view to have the same scalable image (icon) that available for Icon view ?

List view is more organized for the eyes (at least for me) and have more infos. I would just set the size the icon size as it is possible in Icon view.

From the description, @pulkomandy patch just enables Tracker to use a thumbnail that is already generated and appended to the file. It doesn´t involve the creation of thumbnails.

Since generating the thumbnails would involve a lot of manipulation with ffmpeg, maybe a script that would invoke the necessary programs to create and append the thumbnails to their files would be easier ?

1 Like

Thanks - seems we wrote at the same time. You can read my clarification this way above.
That may explain - I left out a logic step in my topic starter post.

And yes a script is more convenient
… and easier - indeed - if delivered someone else than me

(Sorry for a lazy man - it was too high to not hit immediately 8D )

No, the thumbnails are not in vector format (otherwise they would just be icons). The bitmap image will be scaled, it will not look perfect, but this makes more sense than trying to vectorize arbitrary images still.

The PNG file (or I think preferably a WebP file, we used that in Tracker generation file because the attribute will be smaller then) should be added as an attribute of the original file and with the proper name. This can be done with the “addattr” command. You may also need to add an attribute indicating when the thumbnail was generated (to avoid out of sync attributes if the file contents is changed).

I think the name of the attributes is not currently publicly documented, we should probably do that to help people writing such scripts and tools.

No, I changed only one single thing: if, in Tracker preferences, you uncheck the checkbox to generate thumbnails, Tracker will still display the thumbnails that are already generated. That’s all. I did not touch anything else.

1 Like

At least I will play with ffmpegthumnailer - and will see can I fine tune the process for a bash script.

If I would a developer, I would also create some gui program to create an applet that enables to accurately select the exact (snap)shof picture of the videofile
using timecode of videofile
and a moveable slide and a create button.
Of course I can use VLC or Avidemux to select the accurate scene to save it - that would be GUI.
I ment only those, when the automatic selection creates a boring thumbnail.

Right, anyway : ACK.

Thanks for the document if/when would be available how to create the appropriate attributes to be able to use it in a bash script or commandline.

I have a couple of test scripts that generate thumbnails as part of my TrackRunner project. The create_video_thumbnails.sh script is specific to video files. The thumbnailer.sh script can also generate thumbnails for PDF and postscript files.

4 Likes

Dear @Lrrr ,

It is lifesaver …

khm …khm … I would rather say … time saver ! 8D

EDIT :

Thanks for adding remarks for necessary packages in secondary script - I might need to install some of them :
poppler and imagemagicks installed only if anything use it as dependency I had installed - others should be installed - I think I remember them.

I downloaded both scripts
made them executable
I tried secondary script first (thumbnailer.sh), after the first script file

I executed them on 4 .mp4 files …

should I do additional step after script run ?
or
the files should be shown in Tracker with thumbnail icon directly ?

As for me the VHS casette tape icon remained.
Both when executed on all 4 files altogether in the directory
and
once when 1 file selected.

There should not be any additional steps. The icons should show up immediately but I haven’t tested the script in a while. Maybe Tracker isn’t refreshing the view afterwards.

Edit: I tested it on a couple of mkv and mp4 files and it works fine for me.

As a native Finnish would say :

okkidokki !

(it’s just a joke !)
(sorry for this terrible pun !.. no such finnish word I think :wink: )

Perhaps you have the wrong graphics package installed. The script uses GraphicsMagick not ImageMagick. I need to add some more error checking to the scripts but they were only intended as tests.

I just know basically imagemagick, this way I wrote that - it was my mistake.
You wrote graphicksmagick in the script. It was accurate.

~> pkgman ins poppler graphicsmagick ghostscript_gpl librsvg ffmpegthumbnailer
100% repochecksum-1 [65 bájt]
Ellenőrzőkód érvényesítése a tárolóhoz (BeSly Software Solutions)...done.
100% repochecksum-1 [65 bájt]
Ellenőrzőkód érvényesítése a tárolóhoz (FatElk_64)...done.
100% repochecksum-1 [65 bájt]
Ellenőrzőkód érvényesítése a tárolóhoz (Haiku)...done.
100% repochecksum-1 [64 bájt]
Ellenőrzőkód érvényesítése a tárolóhoz (HaikuPorts)...done.
100% repochecksum-1 [71 bájt]
Ellenőrzőkód érvényesítése a tárolóhoz (LOTE)...done.
ghostscript_gpl-10.02.0-1 from repository system is already installed.
graphicsmagick-1.3.40-1 from repository system is already installed.
poppler-22.01.0-3 from repository system is already installed.
ffmpegthumbnailer-2.2.3~git-1 from repository system is already installed.
librsvg-2.50.7-4 from repository system is already installed.
Nothing to do.
~> 

Anyway …
Everything was installed earlier for other programs - so it was right actually.
I believe your initial guess was right … meanwhile something changed since you created and used your script.

I just got error message first, when I launched the thumbnailer.sh script in itself - to know :
does it ask an input file ?
or
describe usage ? - if needed (like switches, etc. )

I accepted their test status.

We can do something if we get the mentioned howto doc about what attributes exactly we should be created for thumbnail activattion.

Thanks for your reply.

Finished quietly

It doesn’t ask for input but you need to give the files as arguments to the script. Like
thumbnailer.sh myfile.mkv
or
thumbnailer.sh /path/to/*.mp4

Yepp, I used that way, when I saw it works directly and not interactively when the message appeared

Nothing selected.

This way I wrote earlier :

I was in the diredtory with videofiles and

/boot/home/thumbnailer.sh file1.mp4 file2.mp4 file3.mp4 file4.mp4
and
/boot/home/thumbnailer.sh file1.mp4

also

/boot/home/create_video_thumbnails.sh file1.mp4 file2.mp4 file3.mp4 file4.mp4
and
/boot/home/create_video_thumbnails.sh file1.mp4

Now, just for sure, explicitly given - execute on videofiles in this directory - at every file

/boot/home/thumbnailer.sh ./file1.mp4 ./file2.mp4 ./file3.mp4 ./file4.mp4

and

/boot/home/thumbnailer.sh file1.mp4

and finally, to execute for all files

/boot/home/thumbnailer.sh ./*.mp4

Thanks, I just used the script not correctly.

Judging by the thumbnails, this is your p0rncollection? :sunglasses:

1 Like

As you can see in my previous post the thumbnails can be created, and instead of default icon …

the icons will be the created thumbnails

in Icon view
and
in List view as well.

In Icon view :

a bit ugly as the files are in the folder , especially if scaled to bigger size
something pulls them away from each other horizontally
meanwhile vertically the file in next line covers the first line

It is with default icon too, so this is the issue with Icon view
Look at my previous posts’ screenshots.

I checked the options in Tracker on Window tab …
… I found “Resize to fit” or similar ( I mean it is translated for me, so I translated back to English )

As you can see …
… basically it does some fitting, but primaliry fits the window size …
… spacing among files had not solved, as you can see above.

Generally I use List view - that organized better, and have more infos as well.

in List view

The icons are small, not scalable - possibly as to remain condensed and must not roll too much if more files are in the directory.

if we would have a combined featured view for thumbnails

a Thumbnails view

where the icon size is scalable as in Icon view …
then the List view can remain condensed, but
someone who would like bigger thumbnailes
with infos about file
can select this option.