How to fix blue tint in Flash videos on Linux without disabling hardware acceleration

So, I’ve been having this problem for a while now, where Youtube videos and some other videos will mess up the color channels for a video, and you get a blue tint on all videos, also known as the smurf effect. An example can be seen below:

Most of the solutions posted online for this problem involves disabling hardware acceleration, which is wildly undesirable, since, you know, this makes videos slow and sluggish, especially in fullscreen. Removing the faulty library, libvdpau, is also undesirable, since it is used in other video players than Flash.

But there is one solution, posted here, that lets you keep your hardware acceleration enabled, and fixes the smurfy colors. I keep forgetting the solution, though, hence this blog post. Hopefully, some other poor bugger (you?) is able to find it as well. Here’s the solution for Fedora 17 64-bit:

cd /usr/lib64/flash-plugin/
sudo perl -pi.bak -e 's/libvdpau/lixvdpau/g'

The directory where is stored may vary, you can find out where it is by doing something like this:

cd /usr
find . -name

What the command does is to change the string «libvdpau» to «lixvdpau» in, making it impossible to load that library. The performance will take a little hit, but not as much as disabling acceleration altogether.

Note: after each flash-update, you need to apply this fix again, as the file gets overwritten by the update. Hopefully libvdpau (or preferably flash itself, but don’t count on it) will get patched with a workaround for this annoying bug soon.

Nettfri dag

På årets siste dag så skal jeg prøve å holde meg helt unna nettet, om ikke annet fordi nettet går så sørgelig tregt her på Åsta ( mobilt «bredbånd»). Derfor (jeg tar ikke ansvar for et knukket system):

Godt nyttår!

Adding time stamp overlay to video stream using ffmpeg

I’ve been playing around with live streaming from ffmpeg recently, and my latest adventure was to try adding a time stamp to the feed. I searched Google for a solution, but couldn’t find a complete howto, so this is pieced together from information I found found all over the net.

Turns out, all the information you really need to get this working is already in the libavfilter documentation, I just didn’t read it carefully enough.

First of all you need to have a recent build of ffmpeg, with the --enable-libfreetype flag enabled. Just use this excellent howto, and add the flag yourself in the configure-step. You must also make sure to have the libfreetype-dev package installed. This is all provided you use a Debian or Ubuntu based distro, of course.

Once you have built ffmpeg you can check if you have the necessary filter installed with this command:

That should print out the following line:

Now you should be able to do something like this:

In short, this sets up capture from v4l2-device /dev/video0 with a framesize of 640×480 in 30 fps (pretty common for older webcams). The -vf is where the filter gets applied. fontfile gives the path to a TTF font, text contains the text we want, in this case we want to expand a strftime() sequence (see man strftime for a full list of parameters). Note the escaping slash in front of the %. Then we set the font color to white, with a 80% opacity. There are many other options, such as fontsize, but I haven’t tried them.

Hope this is useful for someone out there.

Addendum, February 21, 2016

Turns out, this blog post has been dug up by people from time to time, judging from the number of pingbacks it has accumulated over the years. So in case you’re here now: ffmpeg made some changes to how they do text expansion (go figure), and the link to the documentation changed too. Here’s a revised example, using a more modern camera with mjpeg for good measure:

How to get Spotify URLs working again in Ubuntu 11.04

I’m using the native Spotify client for Linux (available here), which is only available to paying subscribers at the moment, apparently due to some problems in getting commercials to work reliably or something like that, but that’s not the topic of this post.

Ever since I upgraded to Natty I haven’t been able to get Spotify-URIs to work. That is, links that look like this:
spotify:user:einarjh:playlist:7iWZ9zuOOILXU5hbzruuxE. Today I found the corresponding bug: Bug #788673 in xdg-utils.

This is how you fix it:

Create the file /usr/share/applications/spotify-url.desktop and add the following content:

That’s it! Enjoy your working Spotify URIs!