Getting the most out of your webcam: tinychat, screen capture, and picture-in-picture.

4. March 2010

04-16-10 Read a valuable addition in the comments.

tinychat, broadcasting a screen capture with picture-in-picture portrait, hand aflame

You want to show off your craptastic code while you sling fireballs at the camera BioShock style don't you? Of course you do. Let's get started.

Download and install the following:

Let's walk through a setup using the phenomenal tinychat.

Tinychat is a 100% free, no downloads or signup required website that lets you easily video chat with others. You can create a video chat room and invite up to 10 thousand people to join in with you. Even though tinychat is simple, it's still powerful and you can easily customize and moderate your rooms with skill.

Only the room creator need login (with TinyChat, Facebook, MySpace, Twitter, etc.). Jump into a room, like tinychat.com/anything_goes_here_whee. When you click Start Broadcasting always choose VHMultiCam. This is the selection you will always make in every application. Proceed.

Save yourself some future work and right click your video and select Settings. Specify that you want your browser to remember to always give tinychat permission to access your mic and camera.

Adobe Flash Player mic & camera settings

So VH Multi Camera Studio launched automatically, this is good. This is the one being utilized (by tinychat). Opening it manually wouldn't have the desired effect. This is where we can create fun and magical combinations and presets.

VH Multi Camera Studio

In the View menu set the resolution to 320 x 240, this is what tinychat and such want to see. Add sources with the menu, position them and resize them, drag and drop them in the list to adjust z-ordering.

The only obnoxiously technical part here is adjusting the settings for each source you add. Right click them and enter Video Capture and/or Video Capture Format under Setup. Unfortunately the Output Size of my camera always defaults to 160 x 120, which is a horrible image. I can get 30 FPS up to 640 x 480, so I have to adjust this each time it's added. Switching to presets that use the camera keep the settings though, so a secret is to add my camera even to presets that don't use it, just hidden behind.

Webcam Video Capture Format Properties

So now let's get VH Screen Capture Driver configured ideally for mouse tracking screen capture. (It can capture and resize windows and other neat things too.) Add VHScrCap to a preset somewhere and enter its settings dialog. Here is what I use:

VH Screen Capture Driver Settings

Check the box Track screen under the Capture tab as well. The notable setting here is output size at 400 x 300. For other 4:3 settings I found 320 x 240 to be too zoomed in, and 640 x 480 too zoomed out. This setting requires you re-initialize VHScrCap to take effect, so jump to another preset and back.

You may have noticed the Show frame option too. This paints a nice red box to illustrate what part of your screen you're capturing. Unfortunately the borders are quite thick, and the box can glitch and freeze. My friend and I (mostly him) wrote our own: RedBox.zip (16.11 kb). That's the code and .exe. No command line just GUI, add one yourself.

Finally, ManyCam. ManyCam is a free program with lots of fun features and effects. It's awesome really. You can pick from any source in ManyCam to represent it in Multi Camera Studio (and thus tinychat). Often you'll want ManyCam set to your camera itself. When doing so you'll get a better image if you force the size to something higher your camera supports.

ManyCam source selectionManyCam output sizeManyCam flame effectManyCam fire setting

You're probably thinking, "Ooh! So I don't really need presets in Multi Camera Studio for my camera itself, just ManyCam!" That's true, except in my case the quality is a bit worse through ManyCam, observe. (ManyCam is on the right.)

Quality comparison between camera direct in Multi Camera Studio and camera through ManyCam in Multi Camera Studio.

So I have extra presets instead. That's about it! There's definitely a ton to figure out yourself. For instance when it comes to FPS I've let everything hover around 30, often sticking to defaults. I've tried to be brief here, feel free to ask me questions in the comments.

Recovering contacts in Windows Live Mail via harvesting your inbox.

12. February 2010

So you upgraded a machine from Vista or some such to Windows 7, and lost the email program as informed. You were wise and exported all of the emails and contacts beforehand. So you install Windows Live Mail and hurry through the import procedure. It looks good! Oh maybe you delete the backup, but just into the Recycle Bin.

Later you're tinkering around, deleting and moving files. It's not your machine and there's already so much trash in the bin, you wouldn't want your trash mixed with their trash, so you empty yours. Whoops there went the backup, but all was imported perfectly so no worry.

Or was it! Actually the emails survived all right, only missing some images attached to a letter in the Drafts folder. Probably saved in a temporary location that wasn't preserved in the Windows 7 upgrade. The contacts though, are all horribly terribly wrong. Important people are missing! You were fooled before when you saw their first and last name on your emails into assuming this implied an association with their address in your contacts. Alas it is not so!

Ah, but you are a programmer. Bahahaha!

So with time of the essence I coded up some quick and awful Python.

Somewhat dumbed down harvest instructions:

  1. First create a folder on C: named Mail.
  2. In Windows Live Mail, press Alt+F for the File menu, then Export -> Messages... -> Microsoft Windows Live Mail
  3. Browse to C:\Mail, and complete the export, yes to All folders. Afterward you've a directory full of emails in .eml format.
  4. Download and install Python 2.6.4. Choose Windows x86 MSI Installer if you're not sure which. Install it to the default directory, C:\Python26
  5. Download this Python script (displayed above). Right click that download link and Save link as... C:\Mail\eml_to_csv.py
  6. Open a command prompt (Windows Key + R -> cmd enter).
  7. In the console type: C:\Python26\python.exe C:\Mail\eml_to_csv.py C:\Mail C:\Mail\contacts.csv After completion you now have a contacts file which can be imported.
  8. Back in Windows Live Mail in Contacts go Alt+F -> Import -> Comma Separated Values and select C:\Mail\contacts.csv
  9. You should see over a dozen separate mappings, First Name to First Name, Last Name to Last Name and so on, if you don't then stop here. If you do, click Finish! :)
  10. Purge any unwanted junk contacts! Use the information I put under Notes to determine the most recent email the contact was harvested from. Use these dates to your advantage to distinguish old/new addresses and so forth.

For troubleshooting/badasses:

  1. After step 7 open the .csv file in Microsoft Excel.
  2. Choose Delimited, on the next page uncheck Tab and check Comma, then Finish.
  3. Use your awesome spreadsheet knowledge to sort (not the first line though!) fix and purge your contacts. (Just FYI if you've no name with a contact I recommend clearing the Name field rather than placing the e-mail address here. Windows Live Mail will nicely distinguish these contacts as nameless then.)
  4. Upon completion use Save As... CSV (Comma delimited) and if asked if you want to keep this format, choose Yes. It won't be enough to use just plain Save.
  5. Continue at step 8 and import your new and improved .csv file into Windows Live Mail instead.

If you want to be really cool, after Excel open the file in a text editor and replace tabs with newlines for a prettier display of Notes in Windows Live Mail. Don't do this before Excel or try to open this new file in Excel afterward, as the newlines will confuse its CSV parser. (They are however valid, and Windows Live Mail will take the file just fine.)

On top of that, if you know how, you can search within the .eml files yourself for lines containing: Reply-to and correcting any contact name/addresses with these lines. Unfortunately the Python script doesn't yet handle these automatically.

Finally

Hooray! Contacts recovered! :) At least as many as in your emails. Better than nothing! I showed that machine who's boss. *flexes programming prowess* Next time no backup deleting idiocy. ;) Also, have a backup to begin with, but you already knew that.

Hulu.com, I love you, and I'm blocking your ads.

1. February 2010

An advertisement has never persuaded me in my life. Okay, I'm lying. When I was a wee little boy I distinctly remember seeing Batman and TMNT toys, and LEGO bricks, and other fantastic things on television and begging my mom to buy them for me, and she did. Even then they were never as fun I was manipulated into believing. So, they got me there, and then I grew up.

Beyond that, I'm being honest and forthright. I have never bought something from a commercial, and I wouldn't even say I've been persuaded by a commercial. Influenced? Yes. I've been pissed off (no not at something they intended), and I've had my train of thought and viewing experience interrupted.

Let me tell you how much I love to see televised material that is strictly relevant to my interests, and yes, let us phrase it this way. I will speak of that which I love, staying constructive. Attention is creation. I didn't name this blog Code Optimism for nothing. ;)

Everything I watch on my television is through the DVR system. Yes, that's right, everything. If I bump into a show airing I enjoy, I schedule it to record and I watch it an hour later, where I can hit that wondrous fast-forward button. I'm so good at it I count and automatically average the number of large forward skips between my material on a per-show basis for rapid precision. How I love being constructive with my entertainment time! :) If it's a live show? Same thing. Important news relevant to me? Same.

Now Hulu, I love your service, and I understand the advertisement based model. I'm glad there's such a model (though I contest most is utterly broken in their interest-based irrelevance) and that it can support you (I hope it's enough for you, perhaps not!). Additionally many of the things I love rely on advertising. Favorite websites, and consumer goods too.

That said, I have never clicked an ad seriously. ;) Never. This is a pull society, not a push one. Sorry, welcome to the future. I don't watch the news. I don't read the newspaper. When I wish to know something, or what's happening in a particular field, I perform a search, just when I want to. I use Google Voice for my cell phone. I sign things with disposable email addresses, I don't get coupons in the mail. I even do my cleaning this way. Why would I want all of this garbage when I can seek it out precisely when I need it?

So I use Adblock software. So I screen my calls. So I only fake sign-up for subscriptions. I don't mean to be rude by blocking your ads, advertisers. I'm saving you bandwidth! I'm not ever going to click one of your ads. I'm never going to watch one of your commercials. I don't even second-hand listen or watch your commercials when someone else is. I wear headphones and listen to Sirius BPM, pop dance station. You know what's so wonderful about it? Loud, fast, energetic music, with seamless track changes. The music consistently peaks, no low acoustic style pauses where background noise bleeds through, these are dance mixes! Constant changing wonderful music that makes me smile.

I imagine those remarks about the headphones might seem facetious, but no, I'm quite serious. :) Not only do I avoid something that makes me unhappy, its replacement actually makes me happy! It's fantastic, and I really recommend everyone try it. SiriusWM6 for Windows Mobile, right on my cell phone.

So, I'm passionate about this. I'm so passionate I spend hours, even weeks programming around these sorts of things. :) The payoff is immensely worthwhile to me when I can watch entertainment without my mood ruined with advertising drivel, and emotions are highly important! Good feelings get to keep flowing. :)

So, Hulu, I blocked your ads. I blocked them in the most reliable "you can't do anything about it and you never will be able to" sort of way. I screen scraped your advertisement notice and you'd do far more inconvenience to your users by discarding it, which I'm sure is quite obvious. That simple fact means I will always be able to detect ads. If you let the user know, you let me know. If it's on the screen, I can see it. It's like trying to prevent someone from copy-pasting your text or saving an image from a website. It can't be done. Once it's on my screen my computer has it, and everything else is a completely pointless waste of resources in an unending war of escalation. This is all easily grasped for those in the know.

I don't think you'll mind though, that I'm opting out. I'm not the issue though am I? Someone may package my code in a tidy little consumable and disappear your ads with nary a consideration. The occasional or rare advertisement sucker may cease being suckered altogether, or miss something they'd enjoy. There must be enough of these characters to make a difference, maybe even the ones that knowingly use an Adblocker! I can safely say I'm not one though, no not even the rarest of clicks or purchases that would still soundly register from me. Zero.

So here I offer my crude and personal, barely working code for those like me. I'd love to refine it, to present it neatly with simple instructions and ironclad reliability, but this is my blog, you get the crap I'm working on in its crappy probably can't make it work unless you're a developer anyway state or you get nothing, and it's better the internet get something. ;)

If you're not like me, if you'd rather watch an ad than black nothingness (later I'll add fun replacement things), or if you occasionally are persuaded by an advertisement, or they simply get into your awareness and on your tongue and you do not mind, then enjoy your advertisements and support Hulu, because they deserve it.

Crappy code available here. ;)
Install AutoHotkey... double click main .ahk file

Blanked out Hulu.com advertisement.

Coders: better gamers than you. Take FreeSpace 2.

18. January 2010

(Because we cheat!) Well that's the theory anyway. Except then we stop gaming because we're bored and we go back to coding our cheats.

So I recently dusted off the game FreeSpace 2. Still fantastic, and thanks to the FreeSpace 2 Source Code Project it has new and pretty graphics and mods. Metacritic thinks it's awesome too... if that means anything.

MediaVP updated graphics screenshot, enemy ship targeted at 367 meters.

In a space combat sim, deftness and accuracy are your best friends. Unfortunately in FreeSpace it didn't seem that you could have both. With the sensitivity maxed you could pivot, bank, and pitch with maximum speed, but your target would bounce around your reticle, and you'd miss most of your shots.

Perhaps a very nice gamepad joystick would register a wider range of the slower, gentler movements. Mine certainly didn't, and that may be the most likely scenario. A standard computer mouse absolutely doesn't work, as there's no "center" to return to, you're constantly turning.

I of course thought, "Ha ha! I can fix this" and turned toward AutoHotkey. I was going to code an ugly hack, and have a button or joystick open the key configuration and adjust the sensitivity in a lightning quick second, preserving the state of my other buttons and ship movement.

That is until I spotted an example script in the (very awesome) help file for using a joystick as a mouse. Programmatically controlled sensitivity, some significant rewriting, and yeah. Dominating.

I have one joystick for movement, the other to adjust the sensitivity/speed of that movement for excellent ship tracking, and a button which brings it to the absolute maximum for rapid orientation changes. Also many other intuitive combinations for interacting with enemy/friendly/escort ships, such as targeting, targeting attacker, and so on.

Have at the AutoHotkey script here. Code skillz required, sorry.