Microsoft Windows and all that goes with it

Movie Maker and Mp4 Audio Sync

It all started when I used Microsoft’s LifeCam under Windows 8 to record a bit of video. At the end of this quite easy process I was greeted with MP4 file. All that I had to do is to import it in Movie Maker to do some processing. How hard can that be?

Well, quite hard actually. As I imported video in Movie Maker, I noticed that sound was not in sync with video. At first I was thinking that input video had an error but every video player worked correctly. For some reason only video editing software had an issue. What followed was few hours of swimming through Internet and learning everything possible about variable frame rate and how it can make your life a misery. Here is how I got this mess sorted out.

First tool I used was a GraphStudioNext. Once I opened my video this tool showed me processing graph my video goes through. I just went in and deleted last step in audio processing (Default WaveOut Device). That left AC3Filter with unconnected out pin. I used File -> Save As Graph to get MyVideo.grf.

Next in line was AviSynth. Once it got installed, I created file MyVideo.avs with following content:

video=DirectShowSource("C:\MyVideo.mp4", audio=false, fps=29.97, convertfps=true)
audio=DirectShowSource("C:\MyVideo.grf", video=false)
audio=AssumeSampleRate(audio, 44100)
audio=TimeStretch(audio, pitch=108.8435)
AudioDub(video,audio) 
EnsureVBRMP3Sync()

This deserves a bit of explaining. First line loads video with constant frame rate of 29.97 which coincides with my camera’s output. After that it loads audio (sampled at 48 kHz). And no, I could not use DirectShowSource to open both audio and video together because audio would sped up for some reason. To get everything back in sync, next line assumes that audio is 44.1 kHz. Notice that this is not true and it will make voice sound very deep. However, it will fix sync. TimeStretch will bring back pitch of our voice while preserving sample rate (value 108.84 is simply 48000/44100*100).

File MyVideo.avs can now be loaded in any video player. Only program that refuses to load this file is Movie Maker. It was time to cheat a bit. I used VirtualDub to open MyVideo.avs and and then I just exported audio (File -> Save WAV).

Last step was to load original video in Movie Maker and mute video volume. Then I used Add music to insert MyVideo.wav as a track. And with that Movie Maker had everything it needed to export final video.

From One to Two Processors in Windows XP

I used to have physical machine running XP that could not be upgraded (don’t let me start about reasons… :/). Since having old machine around gets annoying quite quickly, I used Sysinternals disk2vhd in order to have it work in VirtualBox. And it worked flawlessly. Or so I thought.

Few days ago I tried to run a bit higher load on this virtual machine and I was surprised to learn that only single processor was used regardless of two virtual ones that were available. Task manager simply reported one processor while it was clear from Device Manager that there were two available. This curiosity probably had lot to do with detected Advanced Configuration and Power Interface (ACPI) PC which actually has no multiprocessor support.

When I checked boot.ini its content was:

[boot loader]
timeout=3
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect /KERNEL=ntkrpuni.exe /HAL=halacpi.dll

Notice how there uniprocessor HAL is forced by using /KERNEL=ntkrpuni.exe /HAL=halacpi.dll. This happens when you use disk2vhd to do physical to virtual conversion. In order to make it more compatible, it will restrict it to single processor. To have any chance of detecting second processor you must remove both /KERNEL and /HAL arguments completely.

Next step is to actually replace HAL. Official way of doing this is Windows recovery but there is also a possibility of using devcon.exe command-line tool. Its example code page lists Forcibly update the HAL as example 44. This sounds exactly as something we would need.

Procedure is simple:

> devcon sethwid @ROOT\ACPI_HAL\0000 := +acpiapic_mp !acpipic_up
ROOT\ACPI_HAL\0000 : acpiapic_mp
Modified 1 hardware ID(s).

> devcon update c:\WINDOWS\inf\hal.inf acpiapic_mp
Updating drivers for acpiapic_mp from c:\WINDOWS\inf\hal.inf.
Drivers updated successfully.

If everything went ok, you will need to restart. And then restart once more when asked to. After second boot your Windows XP system will (hopefully) use both processors.

PS: If you ever want to get back to using single processor, it is even simpler - just re-add /KERNEL=ntkrpuni.exe /HAL=halacpi.dll to your boot.ini entry.

PPS: Do not forget to backup your virtual machine before doing this stuff.

Gone

Illustration

Every restart I get familiar UAC prompt. And it is not a Microsoft’s fault for once. No, this is torture by Oracle ™.

Java updater is a perfect example of how things SHOULD NOT be done. For start we have uploader that requires account elevation for simple task of downloading newest update. All other programs can do the same with lowly user credentials.

Things get even worse if you are actually using Java while update is being done. As it is usual with installers, this one will require restart. But only to start whole process from scratch instead of completing it. If you have Java program starting with system, whole thing turns into exercise of futility.

Just to remind you that morons are all around, this thing will also pop up after restart even if there is no update pending. It would be shame to skip annoying user. Solution is simple.

Just disable this idiotic thing.

Not Java mind you. Java is nice programming language that is still not completely ruined by Oracle. Just kill updater. Security wise this is not smartest thing you can do. But you know what? I don’t care. It is only decision that sane person can make after being subjected to this.

PS: And don’t let me get started about Oracle’s practice of installing junk (yes, Ask toolbar, you are junk) with its runtime.

Changing Network Name (Etc.)

Illustration

As I was playing with my wireless router, I noticed that Windows started referring to my text network with number two (2) in suffix. Each visit to Network and Sharing center resulted in annoyance since my good old MedvedAlt network was now named MedvedAlt 2 without any obvious way to change it.

We start adventure by entering gpedit.msc to Windows start menu. This will open Local Group Policy Editor in which we have to navigate to Computer Configuration, Windows Settings, Security Settings, Network List Manager Policies. There we can see our network in all its glory. All that is left at this point is to go into Properties and change Name setting from Not configured to whatever name we prefer.

Do I Have This Certificate?

For one build script I had to know whether certain certificate is present. It took me a while until I found Certutil. Assuming that you know a hash of desired key (and you should) command is simple:

CERTUTIL -silent -verifystore -user My e2d7b02c55d5fe76540bab384d85833376f94c13

In order to automate things you just need to extend it a bit to check exit code:

CERTUTIL -silent -verifystore -user My e2d7b02c55d5fe76540bab384d85833376f94c13
IF ERRORLEVEL 1 ECHO No certificate found.

All nice-and-dandy except that it does not work. For some reason Certutil always returns exit code 0 regardless of success. But not all is lost, command does set ERRORLEVEL environment variable (not the same thing as exit code):

CERTUTIL -silent -verifystore -user My e2d7b02c55d5fe76540bab384d85833376f94c13
IF NOT %ERRORLEVEL%==0 ECHO No certificate found.

Something Happened

Illustration

Going around Windows Store I managed to trigger an error “Something happened and your purchase can’t be completed.”

Maybe I am too much of an power user but this message bothers me.

Did problem happen on my computer or remote server? Is author of application at fault? Do I even have connection to server? Am I in wrong region? If I try again will it help? Should I try again now or at some later time? Is error already reported to someone or should I report it?

So many questions and just a short unhelpful message to answer them all…

Don't Shit in My Flower Pot

Sometime open source drives me crazy.

This time I went about rebuilding TortoiseHg on my machine. I mean, it is a Python program - how hard could it be?

Well, it proved to be more annoying than anything I have done lately. And problems were not in getting code to compile but in getting various dependencies to work properly (py2exe, setuptools, PyQt, pywin32…). While build instructions were better than average open source I was jumping from one problem to another. And most problems were in dependencies incapable of recognizing any folder other than C:\Python27 as python location. Maybe I am misleading a bit here. They would recognize it just fine during install. Everything would fall apart at later time.

Solution was to either rebuild all dependencies causing issues (they were open source them-self) or just to move Python to C:\Python27. As soon I as did latter, everything started magically to work.

For this I only partly blame guys incapable of properly discovering Python location. They suck and they know it. I blame first guy who made Windows port and thought that root folder is a good location as any. Would you install your stuff under root (/) on Linux? How is it that same group of people that behaves properly under Linux has no idea that it should follow same principles under Windows?

P.S. Please don’t tell me that I gave up too easily and that I should have and fixed each issue I encountered. I was attempting to compile one piece of code not solve universes problems.

Avoiding Windows Update

Illustration

Work day is over. You pack your things and you shut down your laptop. And then Windows update kicks in and tells you not to turn off your computer until it is done. Congratulations, you have just wasted a ten minutes waiting for computer.

This annoyance is usually avoided by putting your computer to sleep instead of shutting it down. But that option is not a valid one for those with dual boot. At one point or another you will have to go through shut down procedure.

If you have a laptop (or UPS) there is a trick that you can pull. Just unplug your laptop from power. Windows will detect that it is running on battery power and it will not apply updates during that shut down. You’ve got quick shut down and update will wait for whenever you actually want it.

Windows 8 Media Center Pack for Free

Illustration

Windows 8 came with some multimedia features missing. Mind you, it was by design. Missing features were made available as separate product named Windows 8 Media Center Pack. For a small cost ($10) you can make your Windows 8 work as good as Windows 7. Nice touch.

Good news is that you can get it for free. There are two conditions: you must have Windows 8 Professional (MSDN works also) and you must activate it before January 31st 2013. If that is true, just go to Microsoft feature pack pages and give your e-mail address. In few minutes you should get a key.

With that key just search for Add Features in Settings and enter key when asked to. Feature will be downloaded in background. Just take care not to do anything else on system since installation will restart your computer without any warning (!). After restart you will have one more restart (?) and then Windows Media Center will magically appear.

84% of Bullshit

There is an article in Washington Post saying that Windows 8 is 84% less frustrating than Windows 7. It probably comes from same world where 98% of all statistics are manufactured or “adjusted”.

I will admit outright that I have small sample size of 2+. One is me (yes, I am running Windows 8 again) and my wife is second (running Windows 8 on her netbook). Plus signifies anecdotal frustration evidence from friends. For purpose of this article I will disregard all troubles I already menioned and stick to single one: Fitts’s law.

When working at desktop people are used to having significant things in corner. We have close button in upper-right, application icon in upper-left (double-click functions as close here), we had start button in lower-right and show desktop in lower-left. With Windows 8 left side of deal got broken.

When I try to close application by double-clicking its icon, I never manage to do it. Stupid task switcher pops out and brings me in another application. Starting first application in taskbar has same issue. It is just too easy to switch with mouse (and especially with trackpad) to start screen.

Even if you try to stick to new Windows UI you will get into trouble. Regardless of how significant new UI was to Microsoft, they haven’t bothered to transfer all internal applications to it. You cannot work more than 5 minutes on anything without being thrown back into a desktop. And all those context switches are exhausting.

Best thing that Vista brought was search from within Start menu. We have same thing in Windows 8 but segregated into Apps, Settings and Files. Yes, now you need to know where thing you are searching is. And start screen soon becomes unwieldy mess because every single application gets it icons there. Yes, applications did the same to Start Menu in Windows 7 but I didn’t need to look at it the whole time.

I will not even get into picture viewer that makes it impossible to view next image or mail application that shows first mail and selected one upon clicking. Most of applications in the new UI are probably designed by bunch of non-supervised interns since their basic functionality is usually not working. And good luck finding alternative in Store that is as deserted as church on Friday night.

I agree that on tablets this all works and Windows 8 will probably be 84.07692307692308% better on them. I will also agree that insides of Windows 8 make it most powerful system out there. However, I don’t recall one person saying that something in Windows 8 does not frustrate them. And, mind you, these are users that had Windows 8 for couple of months now.

It just tell that as soon as you assign percents to satisfaction, you are just being a jackass.