whyboris / Video-Hub-App

Official repository for Video Hub App
https://videohubapp.com
MIT License
589 stars 176 forks source link

Certain Videos Won't Genrate Thumbnails or Previews #696

Open Dante33rd opened 3 years ago

Dante33rd commented 3 years ago

I'm having an issue with certain video formats not generating any preview or thumbnail images. It doesn't matter if I convert them to mp4 since the video will still result in a black screen.

I tried testing three problem files that won't generate a thumbnail no matter what I do. I have tried to regenerate the thumbnails, move the files, renaming files and converting file type. Nothing I do generates thumbnails for certain files Video Hub App doesn't like, and I have no idea what I'm supposed to be doing to get these files to work.

Black previews and no thumbnails being generated is affecting 20% of my library. According to the FAQ these video formats are supported, and the files display just fine on other media organizing programs. Video Hub App is the only media organizer I use that is resulting in such a high thumbnail failure rate.

File "a" is avi and "b" is wmv. I converted file "a" to mp4 and named it "aa" but it still doesn't generate a thumbnail. 001 002 003

When I check the thumbnail folder, it's empty. 004

As far as I can tell, the program is skipping files for no reason and the failure rate goes way up when large amount of files are imported at once. I've had to batch import files to keep the thumbnail failure rate to a minimum.

Some advice how to fix this issue would be appreciated.

whyboris commented 3 years ago

Thank you for reporting this bug and sharing the screenshots - it helps eliminate giving you advice that doesn't apply.

My hope is that VHA just works no matter the setup, but it seems like sometimes something goes wrong.

Unfortunately I'm unsure what is going wrong in your case. It sounds like it affects about 20% of your library (good to hear it works in other cases). This makes me think it's something to do with the files specifically, but you've eliminated weird filename problems, and even the path (Y:\Test\ rather than a path that includes spaces - which sadly can cause trouble).

One guess I have has to do with the ever-present problem I have making the app extract images without hanging on errors. The way I solved it was to build it a timeout which stops extracting screenshots from a file if it takes "too long" (happens per file, depends on extraction settings like number of screenshots). But here it seems to fail to extract even the first screenshot (which is required before it tries to extract a filmstrip).

Have you tried putting the hub output folder on a local hard drive on your machine, rather than on an external hard drive (network drive)? Perhaps there's some unexpected weirdness there?

Also, you can go to settings, click on 4th tab "Current hub" and then "Edit folders" and "Add missing thumbnails". It's best if your computer isn't doing anything intensive while extracting thumbnails.

Thank you for your patience and troubleshooting -- I would love to figure out the cause and fix it before the next release 🙇

RedAero commented 3 years ago

I am having similar issues, though on my end they seem completely independent of filetype. I have a set of files in a hub which, no matter what I do, will not generate thumbnails. If, however, I create a test hub with one of the files alone, the thumbnails are created fine. Both hubs are local, there is nothing unusual about the setup, I just put the files in a different folder. Although the main hub is rather large, on the order of 60k 30k files.

I did try to "add missing thumbnails", and it did add a couple missing ones, but not all. I suspect there is indeed some sort of timeout issue afoot because I ran the function again afterwards, and it added another thumbnail it didn't create on the first run, but it took inordinately long to do so. Every time I try "add missing thumbnails", it adds a couple, then stops. My guess is that it's encountering a file it can't handle and instead of moving on, it crashes silently.

By the way, I'm not sure what the function of the "screens" parameter is in the database file, but it is displaying the same value on files with no screens as on files with screens. Perhaps, if that value does not indicate the presence of screens, another could be added to indicate it, with values for errors.

whyboris commented 3 years ago

Hey @RedAero - thank you for sharing what you're dealing with. I'm thrilled the app is working for you with 60k files!

I think in your case the timeout is an issue; but it also could be an incomplete download of a file (if the app tries to extract a screenshot from a location where the video doesn't have a bitstream). Another possibility is a video codec that the app doesn't handle well.

If the code works as I expect, if it fails on any screenshot extraction, it should just move on to the next one; but perhaps you're right that it halts for all screenshots after as well.

The extraction process is in order:

  1. extract first thumbnail
  2. extract full filmstrip
  3. if user chose this option, extract a clip

If any of the steps fail, none of the subsequent steps are attempted. So you could end up with a file that has a thumbnail, but when you hover over it, there is no filmstrip. But if there is no thumbnail, there is generally no way for it to have a filmstrip.

Finally, the screens property in the .vha2 file accompanying every video is the number of screens for that file. If you chose a constant number for every video - it will be the same. If you chose the extraction setting like "1 screen every 5 minutes" you'll have a different number in the screens property ✅ (see the interface file explaining all the properties).

If you're open to trying to build the app from code (it's easier than it sounds), I can show you where to increase the time of the timeout that stops thumbnail extraction -- perhaps you can skip waiting until the next version is released to see if you can get screenshots extracted.

ps, @RedAero -- how big is the .vha2 file for you 60k videos? How many MB? I've been considering at some point making it a zip-compressed file - to make it smaller -- helps to know how big yours is.

Meita80 commented 3 years ago

Unfortunately I'm encountering massive problems with the generation of thumbnails, as well. I've been using the program since february '21 and I can't remember ever having these problems, until now.

I created my main hub back in february, and have been using it until a few days ago without any problems. I had to use the "Add missing thumbnails"-feature maybe two or three times to actually generate thumbs for all files, but that was it. Even adding the occasional new file worked flawlessly and thumbnails were created immediately.

A few days ago I migrated my video collection to a bigger harddisk. The disk itself was and still is in the same machine. Nothing changed, same hardware, same windows installation. File names and folder structures are the same on the new drive as they were on the old.

I created a new hub from scratch (deleting the old one, including all thumbnails and filmstrips in the process...big mistake), adding one folder containing a few subfolders and about 4000 files. The inital scan of the files was successful, but only about 300 thumbnails and about 260 filmstrips were created after that. Using "Add missing thumbnails" a few times added maybe 100 more in total, even though the process took about 30-45mins each time. All files that are now missing thumbnails definitely had them in the old hub that was created on the other drive.

From here on I tried various things. Creating new hubs from scratch using v3.0.0 and v3.1.0, either portable or installation. Going back to the old drive. Having the program, "hub-files" and video-collection on the same or different drives. Fiddling with thumbnail-settings. Using admin-mode. Nothing made a difference. Thumbnail creation just seems broken for some reason, even though it used to work perfectly on the same machine. I don't have a different machine to test it on, though.

I'm at a total loss, tbh. Is the program depending on any specific version of Java-Script, Visual C++ or anything else ? And could a recent update of either of those have broken anything ? I'm not a coder/programmer, so forgive my ignorance :D

EDIT:

  1. Another thing I observed is that enabling the generation of clips (which I never did in the past) yields immensly better results in generating thumbnails, for whatever reason. But it still isn't nearly as good as it used to be.

  2. This might be the most important info and I don't know why I didn't remember it in the first place. A few weeks ago I installed a bunch of tools trying to compile the latest version of videohubapp (which I failed miserably at :D ). I don't remember exactly what I did (...) but a lot of things were installed in a power shell. After accepting defeat, I uninstalled everything. After that I didn't use videohubapp for a few weeks, so I can't say for sure if there is a correlation between my current problems with the app and installing those tools.

EDIT #2:

After a fresh Windows installation everything is back to normal again. I opened the hub I created a few days ago, and would you believe it, all of the missing thumbnails were created without any problems. I'm 99% certain that the problems I had before have sth to do with the tools I installed (as mentioned in "2.").

Dante33rd commented 3 years ago

Is there a way to manually create filmstrips and thumbnails if the app fails to do so?

It's not hard to manually generate the filmstrip, but I'm not sure how to tell Video Hub App to associate the image with a certain video file. Having the ability to create those manually for stubborn files would be a nice feature to have.

Meita80 commented 3 years ago

Sadly, it's gone back to not working correctly for me. I wanted to create a new hub (same videos as before, but with smaller thumbnails and without clips) and again, only about 30% of the files get thumbnails.

Dante33rd commented 3 years ago

Sadly, it's gone back to not working correctly for me. I wanted to create a new hub (same videos as before, but with smaller thumbnails and without clips) and again, only about 30% of the files get thumbnails.

I tried having Video Hub App export the thumbnail collection files to a separate external hard drive. I also named to folder on the external drive "@" and so far I've had a 95% success rate generating thumbnails.

When I had the Video Hub App generate within the same folder as the video files, the failure rate goes way up. Not sure if it's just my system. I never installed anything through PowerShell and only used the installer.

Meita80 commented 3 years ago

On a perfectly fresh Windows installation it was running fine, no matter where the thumbnails were created (in fact, they were on the same drive as the video collection). After being happy that it worked, I installed a codec-pack and a bunch of Windows updates and that's when it went back to creating thumbnails for only 30% of the files. Just to be sure, I uninstalled the codec-pack...no change. I'm not gonna wipe my system drive again, just to test the theory of a Windows update breaking the program, though.

Would be nice to have an official update to see if that changes anything.

whyboris commented 3 years ago

Sorry everyone that this app is giving you trouble. My hope has always been for a "you don't have to touch anything, it just works" ™️ 😅

All the required components of VHA are included with the installation file, and so there shouldn't be any affects to how it functions regardless of what else you have installed (or not installed) on your computer. The work-horse for extracting screenshots is FFmpeg and the app includes a copy of it to make sure extraction works.

In the future release (I'll try for early fall) I'm updating the app with a newer version of FFmpeg (though that shouldn't be what makes a big difference) and updating the timeouts that could prevent filmstrip extraction if the user's machine is a bit slow (this could be the main reason so much fails for so many people).

I'll take some time to re-read your comments and think through what could be causing such weird behavior. I have had some people email me saying that no screenshots get generated, so my app might have at least two large problems: (1) failing to generate any thumbnails in some hubs, and (2) failing to generate many thumbnails in some hubs -- these two problems are likely independent and caused by different causes.

RedAero commented 3 years ago

@Meita80:

Is there a way to manually create filmstrips and thumbnails if the app fails to do so?

It's not hard to manually generate the filmstrip, but I'm not sure how to tell Video Hub App to associate the image with a certain video file. Having the ability to create those manually for stubborn files would be a nice feature to have.

The filename of the thumbnail or filmstrip (I assume clip as well, I don't use those) is simply the unique hash of the file as found in the database file (a simple JSON). You can either look that up in the DB itself, or generate it yourself manually if you know a little programming.

@whyboris:

how big is the .vha2 file for you 60k videos? How many MB? I've been considering at some point making it a zip-compressed file - to make it smaller -- helps to know how big yours is.

Sorry, I must have had a brain fart when writing my comment, it's 30k, files, not 60k, but at that size the file is just under 9 MB - just over 9 million characters. I don't have too many tags in use yet, which could increase the per-entry size substantially.

That said, other than tags the only fields in the DB that change in length from entry to entry are the 2 filename fields, the partialPath, and to a lesser degree the duration and the fileSize, so the number of characters needed per entry is fairly fixed. Even with ten times the number of files it should be trivial to load into memory and 100 MB is tiny even to store. I wouldn't bother with zipping, the de- and recompressing would just slow the program down. If anything, the way to improve performance of the DB would be to choose a more efficient storage method with data types instead of straight text - storing all the numeric information as UTF-8 text is far less efficient than storing them as the unsigned integers that they are.

But like I said, this is totally unwarranted - the program starts fast, runs fast, uses relatively little memory for what it does (400MB on my end), and what's great is that the DB is easy to interact with using rudimentary tools. I even wrote a quick program to merge tags back into the DB for when I compress a file (thus the has changes) I already tagged.


But I have good news: I solved my problem, and I think there's a good chance it's the root cause. As so often is the case, the culprit was an antivirus, in this case surprisingly Windows's own.

I was wondering whether VBA was actually hanging on a file and thus using a lot of CPU, or just waiting for something and thus just idling. I open Task Manager, and while VHA was using a good amount of CPU, Windows's Anti malware Service Executable (or something similar) was using the most. So while the process is ongoing, I go to Settings, and in the advanced security settings toggle "Real-time protection" to off and lo and behold, 140 thumbs generated in seconds, with VHA now comfortably using the most CPU (20-50%, my machine is old). I let it finish (about 2 minutes), I closed VHA, relaunched, ran it again, and 130 more thumbnails were created. I now have more thumbnails than VHA says I have files in the sub (deletions, no doubt), so until I randomly find a file with no thumb, I'm assuming this is solved.

Given that there weren't any new significant releases of VHA, and the fact that in the past the thumbnail generation was fine, and especially the experience of @Meita80 with a fresh Windows install, I suspect that a recent Windows update changed something about the behaviour of the malware detection and it's somehow interfering with VHA (possibly FFMPEG directly), slowing it down and causing it to time out. Furthermore, based off my own experience with a relocated hub, I suspect that the vigilance of the antivirus component may be dependent on the location of the hub in the file system - my main hub is in my Documents directory (C:\Users...\Documents...) on the system partition (because it's an SSD), but my test hub was on a random HDD partition, where it ran flawlessly.

Meita80 commented 3 years ago

Amazing, deactivating Windows Defender seems to have solved the problem on my end, as well. Not only did VHA create thumbs for all files in a test hub I created, it's also blazingly fast now.

Dante33rd commented 3 years ago

I can confirm that turning off Windows Defender real time scanning made a big difference. Thumbnails are not being skipped and clip generation is faster. Before only 60% of the file had clips created and now its over 99%. VHP is only using 30% or less of the CPU on my machine.

I did notice that when real-time Windows Defender scanning was on the clips wouldn't display unless you hovered over them. If you scrolled up or down, that clips would be blank until you hover over them again. When I turned off Windows Defender, clips display without having to hover. It seems Windows Defender was interfering with the display properties of VHA.

I have seen looking around Reddit and users have been getting notification that ffmpeg was triggering a malware altar. Apparently, Windows Defender thinks that ffmpeg is making changes to the system and is being blocked on some level.

image