2

When I go to a folder with a video file in (flv, mp4, for example) in Caja, which is my File Explorer program in my version of Linux (Mint MATE), it has a little thumbnail graphic.

Where does this come from? Is it stored in the video's metadata/headers? Is it computed on the fly by Linux? Something else?

Can I extract this image and save it as a jpg?

  • They should all be somewhere in ~/.cache/thumbnails, categorized by their size and named after any hash sum of the file they belong to. Don't know how to find the exact thumbnail that corresponds to a file though other than trying. – Byte Commander Mar 22 '16 at 17:47
2

The thumbnails are likely cahced in ~/.cache/thumbnails - if Caja uses GnomeDesktopThumbnailFactory or is based on some similar code.

A bit more detail here.

The thumbnail name is a md5 hash of the file path; file:// + full path

Thus:

find ~/.cache/thumbnails -name "$(printf "%s" "$file" | md5sum | cut -d' ' -f1)*"

Where file is

file:///full/path/to/video.mp4

As it likely a PNG you can use ImageMagick's convert i.e.:

convert some_thumbnail.png my_copy.jpg
  • Thanks! The folder is actually ~/.thumbnails/normal/ on my machine, but the naming scheme is exactly the same. – Max Williams Mar 23 '16 at 8:48
2

I am not sure if you are hell bent on getting the image that your thumbnail displays or you just want to get "one" frame out of the video to identify it but if your desire is the latter, may I suggest using cvlc, which is the command line interface of vlc for Linux. After you install it, it can very easily extract frames out of mp4 videos (may be other formats as well but my need is for mp4 videos for my Roku app).

Here is the command I use:

cvlc my_video.mp4 \
     --video-filter=scene \
     --start-time=${startINseconds} \
     --stop-time=${stopINseconds} \
     --scene-ratio=1 \
     --scene-prefix=FrameCapture \
     --save-path=/some/writable/path/here \
     vlc://quit

where

  • myvideo.mp4 is the file name that you want to extract frames from

  • startINseconds and stopINseconds is the number of seconds from the beginning of the video where you want to start and stop capturing frames

  • scene-prefix is the prefix of your captured frame files, will be followed by sequence numbers

  • save-path is where you want to store these captured frames.

As an additional piece of advice, capture like 5 seconds of video and look for the largest file size among all the pictures, to find the image with the best contrast, which usually is the best representation of the time range you captured.

  • Thanks Mel - i'm actually doing exactly that already: i think we discussed this in another question :) I was just curious about what was going on in File Explorer's thumbnails. – Max Williams Mar 23 '16 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.