Category Archives: Media

Flipping Video with DirectShow

7
Filed under .NET, Media, Troubleshooting, VB Feng Shui

If you haven’t checked it out already, DirectShowLib.net is pretty much THE way to get at direct show functionallity in VB.net (that is unless you want to spend $$$). Thing is, it’s only a paper thin wrapper over the DirectShow COM api stuff, so there ain’t no hand holding here.

I’d mucked with it for a while and with the help of some of the sample code, got video playing in a form in VB.net fairly easily, but, I needed to flip and/or rotate that video under some circumstances.

After many googles, I finally came across the IVMRMixingControl9 interface that the VideoMixingRenderer9 exposes, but, no matter what I did, I could not cast from a VMR9 to the MixingControl, like so:

Dim Mixer = DirectCast(VMR9, IVMRMixerControl9)

I kept getting an “Interface not implemented”. Then I happened across a post about a wholly different problem, but buried within it was a comment about needing to set the VMR into “mixing mode” in order for it to implement that IVMRMixingControl9 interface. Ugh! DirectShow is nothing if not interfaces. And odd dynamically implemented interfaces at that. Oh well.

A little more digging, and it turns out to be quite easy. Just obtain the IVMRFilterConfig9 interface from your VMR9 object, and call SetNumberOfStreams on it (with and argument 1 or more).

The end result is code that looks like this (remember, this is with a reference to DirectShowLib.net):

DIM FGM = New FilterGraph
Dim VMR9 As IBaseFilter = New VideoMixingRenderer9

FGM.AddFilter(VMR9, "Video Mixing Renderer 9")
Dim FC As IVMRFilterConfig9 = VMR9
FC.SetRenderingMode(VMR9Mode.Windowed)
FC.SetNumberOfStreams(1)

Dim Mixer = DirectCast(VMR9, IVMRMixerControl9)
Mixer.SetOutputRect(0, New NormalizedRect(1, 1, 0, 0))
Mixer.SetAlpha(0, 0.2)

Note that in this case, the SetOutputRect is reversing the output rectangle, so the video is going to end up flipped and upsidedown, exactly what I was needing. I’ve also set the alphachannel to .2, meaning the video is somewhat transparent.

Unfortunately, there doesn’t appear to be any way to rotate the video using the MixingControl, so that is my next topic of research.

Preventing Mic Feedback in Vista

0
Filed under Media, Troubleshooting, Vista

image (No not that kind of volume!)

Seems like such a simple thing. If I’m on Skype or in general trying to use a mic in Vista, the sounds from the mic end up projecting out the speakers.

No big deal until the volumes get loud enough that you get a feedback loop. Then, look out! Dogs and cats (and wife and children) will run screaming from the house!

I’d dealt with this problem for far too long (Skype was almost unusable) but couldn’t find anything on the web addressing the issue, at least not for Vista.

So I started poking around.

After far too much searching, I finally came across the secret room in Vista where the souls at Microsoft have stashed the hidden switch.

First, right click the speaker icon in the system tray (at the bottom right of the screen), and select Playback Devices:

image

On the next dialog, select Speakers and click properties:

image

On the next dialog, select the Levels tab

image

And make sure that little speaker icon under Input Monitor is DISABLED (like it is in the above screenshot).

If not, just click it to disable it.

This will prevent the mic input from being echoed out through the speakers, and thus prevent any kind of feedback.

Sure, it’s simple now. <g>

When Videos Only Play Audio

0
Filed under Arcade, Media, Troubleshooting

image I recently was doing some work with some videos. Things were working just fine at one point, but then I installed the latest version of JRiver Media Center (version 13).

Whammo. My videos wouldn’t play anymore. Well, actually, they’d play audio, but the video was just black.

I thought it was the particular app I was using, so I tried Media Center, and Microsoft’s Media Player. Same result.

From past experiences, I figured something had hosed a codec (codecs are utility libraries installed on your machine that code and decode video and audio files, each format has it’s own codec).

But, where to start looking?

So, I did some googling and found a great page that lists all the various FOURCC codes for codecs:

http://www.fourcc.org/fcccodec.htm

From that, I found a little app you run against a specific AVI to determine what codec it uses, called GSPOT:

http://www.headbands.com/gspot/v26x/index.htm

Running that against the AVI in question yielded the XVID codec.

Alternatively, just view the AVI in a hex editor and look at the header in the file:

image

You should be able to pick out the four character CC code fairly readily.

Then, from the table at FOURCC, I went to the xvid codec page:
http://www.xvidmovies.com/codec/
Downloaded and installed. Presto! Videos with audio and video again!

It’s just that simple 🙂

Converting a 4:3 screen into a 16:9 widescreen

3
Filed under Hack of the Day, Media

Some time ago, I picked up a Draper motorized projection screen off CraigsList. The price was right, the size was good (70″ width, 80″ diagonal 16:9 ratio), the screen was in decent shape (the very bottom was a bit warped, probably from being stored on its side, grrr), and it was motorized, so I could retract it when I wanted the living room to look like a living room.

Several months later, I found a projector and finally mounted the screen. We’ve been really enjoying it ever since.

But one thing kept bugging me. The screen was originally used for presentations in a lecture hall at Texas A&M, so it was a 4:3 ratio screen. Actually, the reflective screen material wasn’t masked at all on the top and bottom, and the screen itself is so long, I’m not exactly sure how tall it is!

Since the very bottom 6″ or so was warped, I’d just set the projector image to just above the bottom of the screen, and, for a 16:9 picture, it ended up about 39″ tall, leaving lots of white screen above the picture as well.

A relative, who’s a tad more into home theater than me, had once commented that having the screen black-masked on all 4 sides can dramatically improve the perceived picture quality, because of the increased contrast between the background and the image itself. I’d kind of doubted that until I saw his setup. Big difference!

But, I had a problem. How to black-mask the top and bottom of a vinyl projection screen that’s a good 8′ across and weighs a ton, without completely ruining it?

I toyed with several ideas, including constructing a black-velvet drape set (to mask the screen without doing anything at all to it), and rolling a second, black, layer of vinyl, up onto the drum, among others.

I ended up deciding that the best approach was likely just to spray paint the screen black.

But how, and with what?

I called Draper and talked with a very cooperative sales rep that knew exactly what I was wanting to do and understood why. Unfortunately, he said, they don’t sell the paint they use to mask the screen, and even if they did, he said, they apply it when the material is off the drum, via something akin to printing press rollers.

imageLong story short, I found Dupli-Color Vinyl and Fabric Coating (it’s not paint, apparently), at the local Pep-Boys auto parts shop for $6.49. A test spray on the back of the screen proved it wouldn’t melt the thin vinyl (a really BIG concern for me!). Plus, since it’s designed for vinyl, it remains flexible and won’t crack up when I roll the screen up and down like a normal paint would. But now the problem was how to mask it off.

I tried masking tape but it was so sticky, when I pulled it off, it puckered the screen material where it was stuck. You can still see the effect even now. That wasn’t going to work.

A trip to Home Depot and I had several varieties of low tack painter’s tape, but, alas, all were far too sticky as well.

imageSeveral months passed and I was in a FedEx Kinko’s when I came across this.  That’s right, PostIt notes as a tape! Who knew? I picked up a roll and sure enough, it had just enough tack to stick, but not enough to mess up the screen when I pulled it off.

A few hours of masking and spraying later, and I ended up here (the screen is set far lower than normal so I could mask out the very top portion, normally it’s raised about a foot and a half):

IMG_0237

Be sure to mask everything and open windows because the spray goes everywhere and the fumes are terrible.

Also, at least for this particular screen, once I’d sprayed the top portion, it started to wrinkle, bad. I thought I may have actually damaged the screen, but there wasn’t much else to do so I just waited. It took about an hour, but eventually, the wrinkles stretched taut again and screen looks great.

Because of the popularity of the widescreen 16:9 format now, it’s pretty easy to come across older, 4:3 ratio screens with very attractive prices. Using a few cans of paint, and some careful masking, it’s pretty easy to end up with a nice 16:9 screen for a fraction of the cost of a new one.

And the picture?

The improvement was definitely worth the effort!

Home Theater

0
Filed under Media

image I’m a big Home Theater fan. Ok, maybe not in the sense of being fond of having one, but I certainly do admire some of the installations and techniques that are being used out there. Installations like the one here just blow my mind.

Funny how just about anyone I’ve ever talked to, though, that actually has a setup like this (ok, maybe not quite this nice), ends up rarely using it.

While it’s a nice thought, and, for a hobbyist, could definitely chew up some free weekends, plus a pile of cash, dedicating an entire room to a home theater has always seemed like a bit of a waste to me.

Take this setup here. What else could you possibly do in this room? Play video games? Ok. Anything else? When the extended family comes in for the holidays, are they going to gather in there? Is the family going to gather in there to watch Dr Who before going to bed?

It just doesn’t seem like someplace that would foster a good family experience. Maybe I’m wrong. I also am of a school of thought that says there’s no need for more than one TV in a house. 3 PC’s per person, sure, but just the one TV. I know, I know. How quaint<g>.

But I do admit, for that one TV, I like it to be a good one. I picked up a 36″ Mitsubishi tube TV back in ’94, when such behemoths weren’t all too commonplace. Now, a 36″ TV is, um, quaint.

When our family watches TV, we want to do it on a big screen, so the only decent alternative I saw was a projector/screen combo. And since I didn’t want to dedicate an entire room to a home theater, the equipment needed to be unobtrusive and disappear if we weren’t using it, as only a projector/screen can.

imageIn the end, I went with a Draper motorized tab-tensioned screen (craigslist) and a Panasonic AE900U projector (ebay). I was really looking for an AX200U (the next up model number), but when a 900U came up at a really good price, I couldn’t walk away from the deal.

Besides, from reading the specs (www.ProjectorCentral.com is an excellent resource for those), the two units are virtually identical, with the 200 supporting 1080P being the major difference.

This projector has turned out to be utterly fantastic. Contrast is great and the picture is terrifically bright, even with all the lights on and the windows open (though, admittedly, the windows are shaded by trees outside).

And if I turn down the lights, even a bit, the picture really pops.

What’s better, the Panasonic units (both the 900 and 200) have one of the best picture positioning systems around. Not only can you move the image without moving the projector (so you can tweak things once the projector is mounted), the zoom lens allows for a very wide range of positioning the projector from the screen. It’s one of the few reasonably priced projectors that can do an 80″ image from over 17′ away.

Now then, my audio gear pales. Ah, next project…

Arcade Ambience

0
Filed under Arcade, Media, MP3s

If you’re putting together an Arcade cabinet or if you just like the ambience of an old arcade parlor while hacking away at some code, you might get a kick from Andy Hofle’s Arcade Ambience project.

image

Basically, Andy took recordings of playing dozens of arcade machines, remixed them, adjusting volumes, pans, etc, and ended up with several, very large, mp3 tracks of background ambience that sounds very much like stepping into an old arcade. What’s even better, the tracks are so large (at 70+mb each), they effectively don’t loop, so you don’t get that been there, heard that feeling that’s typical of ambient tracks.

Couple that with an arcade front end that can play an arbitrary mp3 looped as background sounds, and couple that with a recent audio card that supports multiple simultaneous channels, and you get all the ambience of walking into an arcade while playing any emulator, Visual Pinball table, etc.

The Running instance of Windows Media Player

13
Filed under Media, MP3s, Office, Utilities

I’m finishing up my little Signature Enhancement Utility for Outlook and had finally gotten the Media Center 12 “Currently listening to” functions operational (This is just a minor feature I’ve seen popular on website blogs and forums, where the tag line contains not only the author’s name but what they are currently listening to, if anything, nifty and fun, but not in the least practical).

I figured I’d go ahead and try to support Windows Media Player 11 (and hopefully earlier versions) as well.

Basically, the idea is to grab a reference to the running instance, interrogate it as to the “playing” state and, if it’s playing or paused, retrieve the name, album, artist, etc info on the playing track and make it available as replaceable fields in the signature.

With Media Center, it was almost trivial:

Set omc = GetObject(, "MediaJukebox Application")
If not omc is nothing Then
   '---- it's running
   ' if it's not running, they can't be playing any music
   With omc
   Select Case .GetPlayback.State
      Case PLAYSTATE_PAUSED, PLAYSTATE_PLAYING
      '---- Media center info is available
      ps = .GetCurPlaylist.Position
      CurTrackTitle$ = .GetCurPlaylist.GetFile(ps).Name
      etc...

Obviously, if the GETOBJECT fails to return anything, Media Center isn’t currently running so the user can’t be listening to anything.

Three hours of Googling later, plus tons of experimentation and I’m not even an inch closer to getting this working for Media Player.

Using ROTView(the Running Object Table viewer, comes with various installations of Visual Studio), it does appear that WMP registers “something” with the ROT, which I’d think would be accessible by VB’s GetObject().

Alas, “Windows Media Player”, “WindowsMediaPlayer”, “MediaPlayer.MediaPlayer”, and on and on, all came up empty.

I scoured the registry for anything that even remotely looked like the moniker of a WMP registration with the ROT and everything I tried also came up empty. I’m sure it’s another case of knowing the magic password, but so far, it appears to be a tad more involved than Speak, friend, and enter.

So, for now, looks like I’ll have to rely on the FunPack for support of a limited set of attributes of the currently playing song in WMP. Apparently, for ITunes, you can use this plugin to accomplish the same thing, though I don’t use ITunes and probably won’t bother with testing that.

If anyone’s ever had any success with accessing the running instance of Media Player, I’d love to hear about it!

Apophysis and Fractal Art

0
Filed under Apophysis, Fractals, Media

Apophysis is a “fractal flame generator”, and quite simply one of the most fascinating applications I’ve played with in quite some time.

I’m probably a bit late to the scene with fractals, and doing a google search for “apophysis fractals” will yield a literally dizzying array of different images, some absolutely fantastic and some, well, not quite so much.

Still, Apophysis is one of those programs you can sit down with and literally not look up for, say, 3 hours.

I’ve just started to play with some of the concepts and I’m nowhere near the whole post production effects that many are getting into, but I’ve managed to create a few unique and interesting images, none-the-less.

For instance, here’s a thumbnail of one I call Solar Flare:

Solar Flare

 

Check out the rest of them here.

And hopefully, I’ll be posting more as time goes on.

Media Center and the command line

0
Filed under Media, MP3s

I’ve used several different media players over time, but since stumbling across J River’s Media Center, I haven’t seen the need to use anything else.

It has an fast and flexible database, and it can tag multiple tracks very efficiently. Plus it looks great!

MediaCenter

I really only have two negatives about it.

  • I still can’t get it to work right with my Tivo. When it DID work, it was great. But it quit at one point about a year ago, and I’ve never been able to get it to work since. Galleon, on the other hand, works great with Tivo, and has since I first installed it.
  • The Next and Previous track keys on my MS Comfort Curve keyboard don’t actually go to the next and previous tracks like they should when MC is minimized. The volume and pause keys work perfect though.

Ok, scratch that last negative. I posted a question to the MC forums and got some very helpful responses, which led me to the Media Center Wiki with this post about the command line options. Just use:

MC12.EXE /COMMAND /NEXT

or

MC12.EXE /COMMAND /PREVIOUS

and Viola! Next and previous work just fine, no matter whether MC is minimized to the systray or not.

Now, maybe someone has an idea about getting it to work with Tivo again. Anyone?