Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I want to generate thumbnails previews for a very large number or videos, before sorting them out. I tested VCSI and a few other tools for that purpose, but I noticed that most of them got the colors wrong, including VCSI, MTN, Scorp Video Thumbnails Maker, MPC-HC ; only SMPlayer got the colors right, but it doesn't allow to generate those previews in batch, by treating an entire directory, or to be launched by command line, so I can't practically consider using it for this task. The source files are 1920x1080 AVI / GAVC, and the color conversion matrix should be Bt.709, but apparently ffmpeg uses the Bt.601 by default. I asked for guidance on that matter on VideoHelp forum, ran some tests doing screenshots with ffmpeg and the suggested switches : I obtained the right colors (from a video I edited showing at some point a still picture which I took of a red car, so I could easily see if the colors were right or wrong) with the following switch :
Side question : I also noticed that the thumbnails generated by MPC-HC were slightly sharper than the others (and those generated by MTN definitely blurrier – perhaps it creates JPEG-compressed temporary files, I can't say, it comes as an already compiled .exe and hasn't been updated since 2008 so I doubt that I could reach the author...). Perhaps this could be improved in VCSI by adding a ffmpeg switch to resize with the Lanczos algorithm instead of the default one ?
Another small quibble : the fields available for the file information header are less complete than with MTN : with the video I used for those tests, MTN can display the general average bitrate, the video average bitrate, and the precise type of codec / format used, namely “h264 (High) (GAVC / 0x43564147), yuvj420p (pc, progressive)“, whereas with the current VCSI script no video bitrate field is proposed in the options, and the format is more broadly designated as “H.264 / AVC / MPEG-4 AVC”. VCSI is still better than MPC-HC and SMPlayer in that regard. The Scorp tool is in between in that regard, displaying “GAVC” (which seems more specific than “AVC”) and the video average bitrate, but with the free licence it puts a giant logo on each generated image, and the colors are also wrong, so it's not usable. Right now VCSI looks like the best option.
By the way, what does the “I” stand for in “VCSI” ?
It would be nice to have a quick feedback, at least regarding the main issue (color shifting), so I could get started with this task which is going to be a long hassle in and of itself ! :^p
The relevant threads on VideoHelp :
Regarding the main question : I managed to get correct colors by adding this line to all three instances of ffmpeg calls in the vcsi.py script, then re-installing it :
You can see that the greens are less “flashy” and the reds more vivid, same as the preview generated by SMPlayer. So this should be the default behaviour for “HD” footage (starting from 1280 pixels in width), and there should be an added option to select another color conversion matrix if needed (for instance Canon DSLR cameras are known to generate footage with the Bt.601 matrix).
I can run the intended task with this modified script, but I would still appreciate a feedback regarding this and the other issues I mentioned.
Many videos don't have Color flags in there metadata, FFMPEG only pass the metadata through, it doesn't convert the Matrix, transfer or prime colors.
Yes, As long as it has proper FFMPEG format(Filters need to be in quotes).
Example: "-vf", "fps=15,scale=480
bicubic is ffmpegs default resizer, Lanczos is very similar to Bicubic. Spline would be a better choice since it contains better AA. The jpeg compression will always reduce quality, PNG is better format to use, filesize will be slightly larger.
Not sure on the reason why it lacks these fields since FFprobe does have some of them. Which can be easily added.
MTN Creates some of it's headers from scratch and doesn't count on external resources.
You can also use Mediainfo & MediaInfo DevKit that has allot more details on the video. Then Build your own.
If you want MTN with Newer Codec Support: https://github.com/Revan654/movie-thumbnailer-mtn
Thanks for these detailed replies.
But isn't it a widespread convention that "HD" footage should be treated with the Bt.709 matrix ?
What does "AA" stand for here ?
Yet MTN is also by far the fastest, among those who can treat a whole directory in batch. As a test, I ran them on a folder containing about 350 videos, AVI format, ~112MB each, and stopped after 60 seconds, here is the number of preview pictures generated by each tool during that time :
So, ideally, I'd like to get the speed of MTN with at least the quality of VCSI, and ideally the quality of MPC-HC, and an option for selecting the color conversion method.
The info part is a nice refinement but not a priority. The options provided by MTN are enough for my purposes. If detailed informations are needed it's better to create TXT files with MediaInfo CLI.
How should I proceed to compile it ? Is it likely to improve the output quality, compared with the version I've tried so far ?
So I tried this modified MTN, and to my surprise the files it generates are exactly the same (same size / checksum) at the same settings as those generated by the older version relying on older libraries... If you worked on the actual code, how does it proceed to create the tiles / thumbnails, and could this behaviour be improved somehow ?
Should, Yes. However I seen countless HD/4K videos use BT.601 / bt470m instead.
I assume you mean the old MTN, The version that is included with StaxRip has support for PNG.
Default format is jpg since it's faster to create then PNG.
It's likely adding an Sharpener, along with AA among a few other filters to make it look cleaner & Colorful. Plus converting the color to RGB before capture.
jpg adds compression, You want a lossless format like PNG or Tiff.
Try the internal StaxRip Thumbnail Maker(Version 2.0). It should be allot cleaner, Since the captures are not passed a Encoder that can reduce the quality of the capture, but created from the ground up internally.
It's very likely MPC is DirectShow Driven Application. You Might want to Check out PotPlayer which also has Thumbnailer Creator.
You can also make one with MPV too with a small script.
MTN is written in C# and only uses the dll files when needed, C# is the fastest code around. Python and such has to compile first before start then has to wait for FFMPEG.exe to capture each from. Which is longer process. It also depends on FFMPEG build too and how it was compiled.
Try StaxRip internal Thumbnail Maker, It uses C type Coding & has detail header. It also has support for Lossless formats and uncompressed format. The Next Build will include tweaks for colorspace & such.
It does Require Avisynth FrameServer to be installed.
That Build was put together very quickly. I've cut down External Files needed, Only FFMPEG & GD files are now needed.
For Window Builds you need MinGW, FFMPEG Dev & Shared Files(32 Bits) + LibGD.
I suggest Making a Folder Directly on the C Drive and Name it something like MinGW.
Once you have all the files in the correct location & Path are correct you just need to type
I forgot I even did this, This is a tweaked version with MediaInfo Support, Removed a few lines and This might have the correct FrameRate data(Certain FrameRates will return Null results).
I also removed some of External modules in favor for pre-installed modules which might have increased the speed a bit.
Changes a few of the defaults values.
I also removed allot of the text that prints to screen, Which got annoying.
This is the Result Now:
Yes, I've discovered this when doing further testing with your fork. The integrated help or the descriptions on GitHub don't explicitly mention that possibility.
Already tried (StaxRip 184.108.40.206 which is the latest stable release), it doesn't work with the kind of file format I have to inventory (AVC in AVI container), I get this error :
With a random MKV file (HEVC / 5.1 AAC) it works but makes StaxRip crash right afterward. Works fine with a small MP4 file.
Again, compression is not the issue here. JPEG output from VCSI or the other tools looks good enough, while even PNG output from MTN lacks detail in comparison. It would probably go unnoticed for small thumbnails like the examples you provided, but with 4 tiles of 960x540 pixels it's quite conspicuous.
Could you please elaborate ?
Well, where is this other tweaked version ? Or you mean the one you linked earlier ? (This one I already tried, see my previous post, or the issue I opened on the dedicated page.)
Speaking of which, running MTN with those AVI/AVC files I got many warnings like “data partitioning is not implemented, update your FFmpeg version...” or “deprecated pixel format used, make sure you did set range correctly” ; it works anyway but is annoying indeed.
Staxrip accepts all forms of AVC.
Like I said Try 2.0, Since there was some small issues with Length Names & Dotnet not wanting to accept them.
That's beyond my control, That all at the end of FFMPEG dll and How FFMPEG reads everything.
I'm Talking about a Tweaked version of VCSi.
It Uses MultiSelect, You can Select all the files you want.
If you want larger tiles adjust the optargs. 2x2 is useless to have since it only grabs 4 shots and doesn't show the entire clip.
Sorry, I didn't realize that you were one of the main authors of StaxRip, so you definitely know where it's at ! :) And I downloaded version 220.127.116.11 on October 26th, it happens that the new version was released just that day...
What about recursive directory processing ? I'll try anyway...
Oh, sorry for the confusion... but where can I find this tweaked VCSi ?
Those are short videos, less than 2min. so it's enough for that particular purpose.
I'll get around to one Day, New Functions have to be built for Opening a Folder Browser with Thumbnail Creator, Then Function for Searching inside Given Folder. It's allot of Code that has to be added, Plus I have other Projects I'm working on.
You need all three py Files + MediaInfo DLL File.
@abolibibelot1980 Sorry for such a late reply.
Thank you for opening this issue.
If I understand correctly, you would like:
Is that correct?
I hope this answers some of your questions.