Video Thumbnail Generation

So after I fixed my Vista Media Center yesterday, I got tired of how long it took to generate thumbnails for the video files in Media Center. I understand it has to open each video file and create a thumbnail from that and since all my videos are located on a file server (even though it’s on a gigabit network), I can see why it’s taking awhile. Of course it caches it and stores it into ehThumbs.db, but once in awhile, it decides that those thumbnails are out of date and clears and redoes everything.

I had learnt a trick that if you have a jpg with the same file name (i.e. video1.avi and video1.jpg), Media Center will load that image instead of generating its own. I’m actually not sure if Media Center 2005 supports this, but I know Vista Media Center does. So I decided to check how fast it took to load all those images on a test directory and BOY WAS IT FAST! I had just taken a random image and copied it a bunch of times after naming it after the video files in that directory.

So now I needed a video thumbnail generation software, hopefully something that will automatically go through directories, create these jpgs images, and then name it correctly. Sounded like a very specific program and a brief search resulted in nothing. It did however give me an idea that instead of generating a thumbnail, I can maybe go with a screenshot. I know Media Player Classic and a couple other video software I have allows me to take screenshots, but having almost 1,000 video files, doing that manually would really suck.

So I talked to RayAlome and we decided the best way to do was find a program that can take screenshots from videos via a command line, which I can then script to automatically run that line on all the videos under a certain directory and subdirectories. RayAlome suggested virtualdub, but I decided to take a look at my Gallery and see what it uses to generate thumbnails for the video files. It uses this thing called FFmpeg, which somehow led me to MPlayer. Apparently MPlayer allows you to save screenshots via command line after reading this: Re: Video output to jpeg/png file and Tools for extracting individual frames of an AVI movie file.

So I decided to give it a try:
mplayer.exe -vo jpeg -frames 1 -ss 300 X:\video1.avi

and it worked! I got an image named 00000001.jpg in the current directory. Renaming and moving the file should be simple enough. What was funny was the fact when it created the screenshot, audio was played for about a second. I knew that’d get annoying if it was processing hundreds or thousands of video files, so I added the -nosound option to it.

I got off starting to write a script. I did mine in Perl, though any scripting language would’ve worked. I realized my Perl knowledge was quite lacking after not using it for so long, but searching for Perl commands online wasn’t that bad. Interestingly enough, Perl doesn’t have a way for you to check if an item exists in an array (or none that I saw) and you had to inverse the array (as a hashtable) and check by calling the hashtable’s key. Another weird thing is that their way of defining methods and functions really sucks. They’re actually called sub (short for subroutines) and looks rather ugly.

Anyway, what the final script does is take a starting directory (current working directory if no starting directory is specified) and finds all the files with the preset list of extensions (changeable) and generates thumbnails for it. You’ll need to download MPlayer for Windows and update the path to it in the script.

There’s also a few other defaults you can change. I set the default time to take a screenshot at 300 seconds (5 minutes).

Another thing I added was to skip processing videos that already had an associating screenshot/thumbnail. Since I was testing this script out quite a bit, I realized that it was redoing a lot of screenshots that already existed. However, you can pass in the -f option and it’ll force it to regenerate everything under the starting directory.

One thing you must realize is that if the video file is not long enough to generate a screenshot at the given time, it just skips it. My HD trailers typically run from about 30 seconds to 2 minutes and having a 5 minute capture time basically skips over all of those. I then reran the script with a screenshot time of 30 seconds in that directory and everything came out fine.

Since I feel that others may be in my situation, I’ve decided to share the script here in case anyone wants to use it:
Generate Video Thumbnails for Media Center Perl Script

Usage: generateThumbnails.pl [-OPTIONS [-MORE_OPTIONS]]

OPTIONS:
-d StartingDirectory Sets the starting directory [cwd]
-f Forces Thumbnail Generation [off]
-t TimeInSecs Time in video to grab screenshot [300s]

Use this script at your own risk. I will not take any responsibility for any damage it causes. Of course to use this, you’ll need perl for your system. I also have cygwin installed, so I’m not sure if there’s any environmental differences.

As noted earlier, these are generating screenshots, not thumbnails. So depending on the resolution of your video, it can result in a screenshot that varies from about 30KB to 100KB. I’ve thought about finding a command line utility to shrink the screenshots to thumbnail sizes, but for now, this will work and until either it becomes intolerably slow again or if someone has knowledge of how to do so and is willing to share it with me, I’m probably not going to add this feature any time soon.

After running this script on all my video files, I will have to say that browsing videos in Media Center became a lot quicker and faster. Enjoy!

Windows Update Error: 80070490

So yesterday when I was playing with my Vista Media Center, I was playing around with WebGuide and I was getting long delays when browsing through the folders. I know there was a network transfer bug in Vista that caused it to be slow and since all the files I was sharing were located off box, I decided to see if there was a new patch to fix this. That’s when I noticed that my system hasn’t done a Windows Update since December 5th, 2007. So after clicking on check for new updates, I get this error code: 80070490

Looked simple enough. I thought if I search online for this number along with windows update, I’d get a simple solution on how to fix it. Boy was I wrong.

First, I tried the Windows Update help file. It showed me a different bunch of error codes, but none that match mine.

So the next thing was the search engine. There were a bunch of hits, but none with a simple solution. According to FAQShop.com, 80070490 means Permission denied / [Problem initializing or using session variables] or Element not found. Not really sure what to do about that.

There were no official solutions. People have contacted Microsoft Support, but the only fix is to “upgrade” your Vista. I’ll elaborate later. The 2 most helpful sites I found in regards to this issue were actually threads:

I believe they both originate from the microsoft.public.windowsupdate newsgroup, but there’s several additional replies in the Google one. I also like the formatting of the Google one better as they hide the replies.

Here are the several solutions suggested:

I recently encountered this problem as well, and what the technician told me to do was enter the services menu, and reset the following services in this order: BITS (Background Intelligent Transfer Service) – Cryptographic Services – Windows Update)

then restart your system. that worked for me once but it only worked until i restarted my computer again. any other more permanent ideas would be greatly appreciated, and i hope that these suggestions help somebody.

I wasn’t exactly sure what “reset” meant, so I restarted the following 3 services in order:

  • Background Intelligent Transfer Service
  • Cryptographic Services
  • Windows Update

I then restarted my computer. Windows Update still didn’t work and still returned the dreaded 80070490 error code.

The problem was eventually resolved by Microsoft Support via their free service for update issues – thanks for that advice, PA Bear. In spite of trying various ‘fixes’ with guidance from Microsoft, I ultimately had to ‘upgrade’ (not reinstall) Windows using the original Windows Vista disk. This process takes much longer than a typical install – so long in fact that at one stage I thought the system had frozen and that I’d have to do a complete reinstall. Fortunately ‘upgrade’ eventually completed the various tasks and all original data, other installed software and setting were preserved, so ‘upgrading’ was the better option – for me at least.

I hope this helps. Good luck.

This is actually the solution that has worked for most people that encountered this error and is in fact the current solution provided by Microsoft Support. What you do is stick in your original Vista DVD, perform what you would do with new install, and when the option comes up to for Upgrade or Advance/Custom, select Upgrade. I’m not exactly sure what it means to Upgrade when I already have Vista Ultimate installed, but what the heck, I just followed directions. They note that it does take several hours to complete. Of course that depends on how fast your machine is.

Anyway, I’m already somewhat pissed. What the heck is this error and why am I repairing my Vista install when I haven’t done anything to it in the past month. But worse of all, half way through the repair, it says my system isn’t compatible to install this version of Vista and tells me to run the compatibility tool. It then reboots and restores the previous configuration. I tried this like 3x, each time waiting an hour or so before it hits this error.

I finally gave up with this Upgrade solution.

– MY SOLUTION –

An idea hit me. Since the last successful Windows Update was on December 5th, 2007, what if I try doing a System Restore to the last point before that date. I hate doing System Restores as it smudges up tons of settings and breaks applications you’ve installed after that date. Anyway, I do a System Restore to November 30th, 2007 and behold, Windows Update suddenly works again! I had to reinstall WebGuide and a couple other apps, but this error needs to be better documented.

Update: David has provide an extra solution for people who have installed Daemon Tools or Alcohol 120%. Apparently there was a problematic file (sptd.sys – Scsi Pass Through Direct) that causes Windows Upgrade to fail. I’m guessing the file is what allows you to have virtual cd/dvd drives. The solution was to delete the problematic file, upgrade Daemon Tools, or uninstall it altogether. You can read more about the solution in his comments.

Update #2: Patrick provided a very interesting tool to try:

When Googleing for answers I found out that many people had this problem and that it was not easy to fix. But one guy (jhaysITQ) found a Microsoft tool called “System Update Readiness Tool” that fixed 3 systems for him. I tried it and TADA, it worked for me too!

I hope it helps some of you people too!

Check out his original post here: 80070490 Vista Windows Update Failing

Tool info and download here (about 70 – 75 MB): System Update Readiness Tool

Welcome to the NHK!

So I finished watching Welcome to the NHK recently and it was just PURE AWESOME!

welcome to the nhkwelcome to the nhkwelcome to the nhk

Based on the covers, if you think the anime is porn or hentai, you’ll be highly disappointed. That’s what I thought at first, but it wasn’t until Tera told me that Welcome to the NHK and Mushi-shi were the best 2 animes of 2007, that got me interested. Mushi-shi is another awesome anime which I haven’t had time to post my review yet. Looking around, it appears that Welcome to the NHK is about a NEET (not in education, employment or training) who is a hermit that hides in his apartment all day long. Somewhere down the line, he has come to the conclusion that there’s an organization called N.H.K. (basically the TV station’s name) that has a conspiracy to create hermits/NEETs and has sworn to take it down.

That was my assumption of the anime before I began watching it and boy was the anime SO MUCH MORE!

I’m going to take a step back and give you a little introduction that CrimsonAngel told me over my vacation. By the way, he got me this really cute deer (Japanese shrine charm), which I originally thought was a reindeer:
japanese shrine charm - deer

Back to CrimsonAngel, he’s currently doing his Masters in Japan and he did an essay on Otakus/Hikikomoris. Today, most Americans think otakus are people into anime, while other some people whole know a bit more assumes that otakus are hobbyists. However did you know the phrase お宅 (otaku) originally was a term used to mean you (honorific), your house, your home, your family? Later on, since the term could mean your home/house, it began to refer to people who would stay home all the time. His story continues with some serial killer loose in Japan and proclaimed himself to be an otaku. Even though the serial killer was caught, the term otaku had a very bad connotation associated to it and it wasn’t until recently when it became popular again. Nowadays, オタク (otaku) can refer to geeks, nerds, enthusiasts, basically someone who is very into something, and are most likely introverts or at least not very sociable.

The other term is 引きこもり (hikikmori) which means a shut-in, a stay-at-home, or people who withdraw from society. I’ve used the term hermit as I believe that’s our slang for it. Anyway, the story is about Satou, a hermit and how he overcomes hikikomori ways (oh, did I just ruin the ending?). He was a college dropout and after he was expelled from college, he basically became a hermit, living off what his parents transfered into his bank account every month. Misaki, the main female character appears soon with the intention of helping Satou get rid of his hikikomori ways. However, you learn very little of Misaki, but you can feel that her past is very painful. At first Satou of course denies he’s a hikikomori, but the first step to fix a problem is of course accepting the fact you have a problem.

The anime has it’s light moments, poking fun at the otaku/hikikomori culture, while it does have it’s very dark and deep moments that question the purpose of life itself, why do hikikomoris fear, how people get lost in fantasy role playing games (mmorpgs), how a child’s upbringing affects their view on life, why people commit suicide and what goes through their mind, etc.

Speaking of suicide, you’ve probably heard that it’s quite common for Japanese people to jump in front of trains to commit suicide. And you’ve probably heard that Japanese trains are really packed. Imagine the train conductor taking one of those riot shields and pushing people into the train. That’s how pack it is. Anyway, when someone kills themselves in front of a train, this causes major delays and problems on an already overloaded transportation system. Imagine thousands or ten thousands of people getting delayed 30mins because of your stunt. That’s a lot of lost time. That’s a lot of lost money. The train company will then send your parents a letter saying they’re sorry for your lost and a BILL for the damage/delay you’ve caused. Just imagine that! I’m not saying it’s a bad or good system. Someone has to be held accountable for it and I don’t blame the train company for holding the parents responsible.

Anyway, back to the anime. The story goes on as Misaki tries to help Satou, but curing hikikomori isn’t an overnight thing and it takes a lot of patience and I applaud Misaki for sticking it in there. However, it’s when you learn of Misaki’s true past, where you feel a very deep sadness and why she is trying to help Satou so much. Satou of course takes Misaki for granted. One thing you have to realize that is a hikikomori lifestyle isn’t sustainable without outside support, but getting a hikikomori to adapt to society is a very difficult task. All in all, I have to say Welcome to the NHK is a very touching roller coaster ride.

ukms[z] – Reflections

So I was cleaning out my downloads folder and I found an anime music video that Artemyst had shared with me awhile back and I wanted to share it with you guys.

It’s titled Reflections by ukms[z]:

ukms[z] - reflections
(DivX/Stage6 mirror)

This AMV was first submitted to AKROSS, which I’m assuming is a Russian anime convention. It actually won quite a few awards.

The music video features scenes from Haibane Renmei and Kimi Ga Nozomu Eien. I’ve never watched Haibane Renmei, but if anyone out there recommends it (or not), please do tell. I watched Kimi Ga Nozomu Eien recently (also called Rumbling Hearts) and it was rather heart wretching to watch due to the love triangle.

Then there was the music, which was just awesome! After digging around and as some of the text suggested, the song is indeed Russian. The song is by Maksim, titled Do You Know? You can watch the music video on YouTube.

Belldandy asked if there was a version with the lyrics translated available, and searching on YouTube, I found: Reflections (HR) (Subtitled). I expected the lyrics to somewhat suck, but I was surprised. The lyrics actually matched and watching the video with the lyrics translated made me look at the video in a completely different angle.

Weekly Top Posts (12/23/2007 to 12/29/2007)

Here’s this week’s top post, albeit a bit late:

  1. How to download HD Trailers from Apple.com (Last week: #1)
  2. up arrow 4 Free Xbox Live Arcade Games (Last week: #3)
  3. down arrow Print USPS First Class, Media Mail, Parcel Mail Postage for FREE! (Last week: #2)
  4. up arrow Spinning Dancer (Last week: #9)
  5. Free AutoCheck Report (Similar to Carfax) (Last week: #5)
  6. down arrow Haloid (Last week: #4)
  7. down arrow LeekSpin (Last week: #6)
  8. up arrow iTunes Album Views (Last week: #10)
  9. up arrow Era – Misere Mani (New)
  10. down arrow Canon PSC-1000 (Last week: #8)

Previously…

Happy New Year

Just wanted to wish everyone a HAPPY NEW YEAR!

I’m not much of a resolutions type of guy, so I never make resolutions for the next year. It’s probably because if it’s important enough, I’ll do it w/o even making a resolution. If not, I’d end up giving up anyway. So there really isn’t any point.

Since Xyon posted his 2007 ventures, here’s a look back at my 2007:

  • Noticed I was getting fat
  • Got into cardio exercising (exercise bike + elliptical)
  • Got into strength building (Ungsunghero being my advisor)
  • Started on my HD-Trailers.net project
  • Built my home theater setup
  • Built my new File Server (I know I still owe you a blog post on that – since I’ve gotten my 6th and last hard drive, it’s planned to be written after I install it)
  • Hurt my wrist and had to wear a splint for about a month
  • Discovered M&M Dark Chocolate
  • Found Mexi-Coke
  • Found a giant hole in one of my tooth
  • Got my first speeding ticket
  • Got my first speeding ticket nullified
  • Discovered Rainbow Sherbert ice cream had a different name: Pineapple, Raspberry & Orange Sherbet
  • Had my first flat tire
  • Dressed up for Halloween for the 1st time since… elementary school?
  • Read a book voluntarily for the 1st time since… elementary school?

My mail got delivered in a big chunk today and it took an hour going through all the mail. At least 1/5 of it was rebates. I got a total of a 14 rebate checks, totaling a sum of $525. That was nice.

Also got this Maker’s Mark gift (I had signed up for some freebie thing back in college, and they continue to send me neat things every year). This time, it was a wax seal stamp:
maker's mark wax seal stampmaker's mark wax seal stampmaker's mark wax seal stamp

I wonder if this wax will work with my ink stamp.