Thursday, November 18, 2010

No webcam in Meebo with Flash on Squeeze

Meebo is an IM client accessed via a web page. As it's web-based, in theory it's platform-independent- useful for Linux users who want to chat to Windows users over the MSN network, as I described here.
Now I don't do video chat that often, in fact the last time was six months ago when I wrote that post. At that time I got Meebo working with video, but not sound (although I later fixed the sound issue).
Today I was trying to set up a video chat with the same person, and was looking forward to a straight-forward connection over Meebo with sound. But this time sound was working but my webcam just wasn't visible.
To cut a long story short, after a lot of Googling, I found a solution, and later on a reason for the problem.

[Update: the rest of this post is me working out what was going on over a couple of days, and although the solution is there, the post is somewhat confusing, so I'm going to add an update explaining the problem more clearly. This was prompted by seeing the same problem in Skype, finding a solution, and getting a clearer understanding of what's going on.

The solution to the problem is to start Firefox from a command line with the following command:
LD_PRELOAD=/usr/lib/libv4l/ firefox &
The reason for the problem is that Flash doesn't (yet) support the latest webcam interface libraries (V4L2) used by recent versions of Linux (such as Squeeze).

The command above tells Firefox to use the older video libraries (V4L1) when it starts, hence Flash is able to work with those libraries.

At some point an update to Flash will get it working with V4L2- so if your distro gets a Flash update, or you install updates yourself, and you have used this fix, check to see if Flash works without it after the update.

The rest of the post below is retained for reference.]

I'll give the reason first, found on the Ubuntu documentation site:
Old webcam which doesn't work well with V4L2
There seems to be a known problem in Ubuntu Intrepid and Jaunty (at least), due to switching from the video system V4L to the more recent V4L2. Many applications, like webcams, doesn't seem to work well (or at all) with V4L2. But luckily there is a simple workaround to avoid the problem, through installing and loading some libraries with backward-compatibility with V4L, so that Flash sees again your Webcam, as it used to do until Ubuntu Hardy.
[Update: Further research proved that this wasn't the reason my webcam wasn't working- see below for the real reason.]

Hmm, so Debian Squeeze must have switched to V4L2 as well.

I didn't use the fix described on the Ubuntu site, because I'd already found a simpler fix on the Ubuntu forum:
LD_PRELOAD=/usr/lib/libv4l/ firefox &
(In a terminal, substituting 'iceweasel' for 'firefox' in my case.)

Oh well. I guess I'll have to buy a decent webcam- this one came from the sale bin at Asda and cost £3, so no wonder it's crap.

Afterthought: my webcam works fine in Cheese, so this may be a Flash bug too. I came across this today.
Basically, Flash 9 had great webcam support – but lousy sound support. And in Flash 10 they fixed sound support, but broke older webcam support (by adding V4L2, I believe they removed V4L1 support. Or vise versa).
Update: Curiously, in gstreamer-properties, my webcam is set to use V4L2, and the test button shows the webcam produces an image, but V4L1 doesn't work.

Maybe the fault doesn't lie with my webcam but with Flash, as suggested above?

Update 2: Yep, it seems V4L2 support in Flash is poor. The Flashcam Project is dedicated to getting webcams working with Flash in Linux.
Flash 10 and updates have been in the wild for a long time now. Frankly the V4L2 support is still poor and there is still some job to do on this project to make webcams work with it.
But Adobe are working on it:
Flash 10 (aka Astro) Beta 2 is out and is supposed to support V4L2. At last! I guess Flashcam won't be useful for long on the desktop.
In the meantime, try the solution above that worked for me, or give the flashcam utility from the Flashcam Project a try.

No comments:

Post a Comment