contact
----------------------------

Blog <-

Archive for the ‘graphics’ Category

RSS   RSS feed for this category

Recording Linux desktop with PulseAudio

For a while now I've been trying to record my Ubuntu desktop with various levels of success. I've been using recordmydesktop to do my recording. Recordmydesktop is a simple commandline tool that outputs an .ogv (Ogg Video) file which is a container format that uses the Theora video codec and the Vorbis audio codec. Most modern video/audio applications on closed-source desktops such as Windows and MacOS-X won't be able to read those, but we convert them to other formats using a range of open tools. We'll get to that later.

Recording the desktop

Recording the desktop is fairly easy. We can either record the entire desktop:

recordmydesktop -o /home/todsah/out.ogv

or we can record a single window. For this we need the window id, which you can get with a commandline tool called xwininfo:

$ xwininfo
xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

Now we click on the window, and xwininfo will give us the window ID:

xwininfo: Window id: 0x9c00003 "[root@eek]/home/fboender$"

Now we can tell recordmydesktop that we want to record just that window by giving it the window ID:

recordmydesktop --windowid 0x9c00003 -o /home/todsah/out.ogv

Once you're done recording, simply press ctrl-c in the recordmydesktop terminal, and it will start encoding your recording to out.ogv.

Sound issues with PulseAudio

Okay, so far so good, except for the sound, which is simply missing. We can see that recordmydesktop did record some kind of sound by looking at the output of the encoding:

Done.
Written 1967932 bytes
(1845110 of which were video data and 122822 audio data)

So why isn't there any sound in the video? The problem is PulseAudio (again and again and again). PulseAudio acts as a layer between all the applications, all the different sound architectures (ALSA, OSS, etc) and between the hardware. In my case, the problem was that recordmydesktop was recording from the incorrect device. Of course the default Sound Preference of Ubuntu 10.04 didn't list any Recording devices, which is why it took me so long to find out what the problem was. To fix this, install the PulseAudio Volume Controller:

# aptitude install pavucontrol

You will now get a PulseAudio Volume Controller in the menu:

Start it up, and select the 'Recording' tab:

Now, make sure you've already started recording your desktop, or the application that's trying to record sound will NOT show up in this list! You should also start playing a song or generate some other audio so it's easier to spot when things are working. As you can see, it shows per application where that application is recording sound from. Select the source it will record from by clicking on the button that says 'Monitor of Internal Audio Analog Stereo'. A list will appear with options. Try each option until the volume bar below the application comes to life. I have not yet experimented with microphones, but I wouldn't be surprised if this was also the place to select that as a recording source.

recordmydesktop will now probably record sound also. You may have to tell it which channel to record sound from. This command at least worked for me:

recordmydesktop -o /home/todsah/out.ogv --fps 15 --channels 1 --freq 22050 --device pulse --v_quality 63 --s_quality 10 --workdir /tmp

You can also configure 'pulse' in the GTK front-end for recordmydesktop by going to AdvancedSoundDevice. Enter 'pulse' there.

Converting to other formats

Converting to other formats is, frankly, a real pain in the ass. There are basically three applications which you can use:

  • mencoder
  • ffmpeg
  • vlc

The main problem with encoding is codecs. A movie contains video and audio, and both of those are basically stuffed into a single file. Such a file is called a container. Examples of containers are Ogg, AVI and mp4. The video and audio files in these containers are called streams. The streams are almost always encoded in order to compress them or to allow for additional information to be embedded in the streams. Encoding these streams is done with codecs. And this is where we get in trouble. You see, most codecs are patented, trademarked, copyright and generally completely unsuitable for Free Software usages. This is why mencoder, ffmpeg and vlc usually have trouble with them.

Any of the above programs may not support the input container/codecs (Ogg container, Theora video, Vorbis audio) or may not support the output container/codecs such as the TS/Avi/Ogg/MP4/ASF containers which contain the Theora, Mpeg-4, Mpeg-2, WMV, etc video codecs and the AAC, MP3, etc audio codecs. VLC can usually play just about everything (because it provides many illegal decoding codecs), but it has trouble encoding in many format.

To my great regret, it's up to you to find out which combinatation of containers and codecs works for you. You can check the Medibuntu website for instructions on how to add illegal codecs to your Ubuntu installation.

For me, it seems mencoder works the best. For instance, to convert the out.ogv file to an AVI file:

mencoder -idx out.ogv  -ovc lavc -oac mp3lame -o output.avi

Gimp Animation frame speed

The Gimp can do animations by simply using stacked layers as animations. You can preview the animation in the Filters → Animation → Playback. It's rather to figure out how to change the time each frame is displayed though.

It turns out you have to change the layer name in order to change the time each frame is being displayed. To do this, open the Layers dialog, double click on a layer's name, and add: (500ms) at the end of the layer name to make the current layer be displayed for 500 Miliseconds.

frames

Change blindness

This is pretty cool. Try to see if you can spot the change that occurs during the flicker (after about 1.5 seconds) in this image:

Kayak

Now try it in the same image without the flicker:

Kayak

More information in this paper

Some (Debian) backgrounds

I found some Debian (and one Linux) backgrounds I had created some time ago on my computer. Decided to put them online.

Vexel artsy thingy

Yesterday evening, being the lazy slacker that I am, instead of working on my project, I was surfing around. I went to freshmeat, saw some interesting project, visited the author's homepage, saw a link, got to some other guys website where I read that he was the inventor of the word Vexel.

There was a link on his site to the Vexel site and I spent some time surfing that, viewing different Vexels. Then I came across this artist's profile. First check out this thumbnail. Looks like a photographs, doesn't it? But then check out the full version! It's actually a hand-made vector-oriented image! It was even just her fourth Vexel. Took 900 layers to create. That might not mean much to you if you're not into computer graphics, but it's a lot. The most layers I ever used in a computer generated image was about 200. And about a fifth of those were automatically generated and another fifth were just throw-away layers.

Now that's talent. Her online portfolio contains more great art, btw.

Reminds me of that demo-scene pixel-artist guy's work I saw a couple of years ago. The guy used some age-old DOS port of an Amiga image editing program to draw, completely by hand, an almost picture-perfect image of a woman. There were even individual little blond hairs on her arms. Amazing what some people can do with some free time and some artsy skills. Wish I could do it.

Smoke looks cool

Smoke looks cool.

Via J-walk blog

Optical illusion

I'm normally not too impressed with optical illusions, but this one's pretty cool.

The cool thing here is how the magenta spots disappear when you stare focus on the cross in the center and all you see is a moving green spot. I'm not sure how it works, but it seems to me the brain is filtering out the magenta spots because it believes they are nothing more than overexposed spots on the retina. Fascinating. Who knows what kind of things our brains filter out without us knowing it?

Via J-walk blog

The Gimp 2.0

Apparentely, The Gimp 2.0 had been available in Debian Sid for some time already before I found out. When I did (thanks to Michiel) I apt-getted it at once and started to play with it. I already tried to find a good article somewhere on the internet which discussed the new features in The Gimp 2.0 in depth, but couldn't find one. Better write one myself then, no?


Foreword
(Better cover myself). I'm no Gimp expert, though I've used it for quite a while. In this little article I'll discuss some of the things I found in the new Gimp, but that doesn't mean that I'm right about any of my assumptions. Some features, for instance, might already have been present in the old Gimp 1.2. Don't bust my balls if I'm wrong about something okay? Feedback is always welcome of course.

New stuff
To my disappointment, there isn't really a lot of new stuff in the Gimp 2.0. There are, however, a lot of subtle changes and improvements:

  • User interface
    One of the most noteworthy new things in the Gimp 2.0 is the interface. It's changed a lot since the old version but it's still recognisable. Gimp veterans will have no trouble finding the old stuff, and can be thrilled about the new user interface. Everything feels much more polished and easier. Frequently used options are moved to better reachable places and everything is just less obscure.

  • Docks
    Where in the old gimp you had to wrestle six or more dialogs with all kinds of options, in the new Gimp everything is dockable. Just drag and drop a dialog to a docking handler in one of the docks, and it will automatically dock there. Clicking the dashed undock handlebar will undock the window (surprise suprise!). It works great, although the number of docking handlers could have been more. Now they are only present at the top and bottom of the dock and sometimes you'll have to fiddle around a bit with the various docked dialogs in order to get them just the way you want.

  • More dialogs
    There are some new dialogs like a seperate color dialog (yes, I know you could already do this in the Gimp 1.2, but this still feels new somehow. At least now it's really useable). A font dialog shows all the fonts that can be picked easily. There's also a selection editor in which you can quite easily modify selections so you won't have to use the Rightclick->selection menu anymore. The navigation dialog is also quite nice, but I believe this was already present in some form or another in the old Gimp.

    Remember that all these dialogs can be docked so they won't ever get in your way.

  • Dialog improvements
    Some dialogs had big improvements. For one, most dialogs now remember their size when you resize them and reappear at that size next time you open them.

    Next to that it's now possible to save your tool option preferences so you can reload them later on.

    Color dialogs now show colored previews in the slider so you'll now to what color you'll be changing if you move the sliders. It also remembers the last 20-something colors you've picked so you'll won't be needing that color droplet that much anymore.

  • QuickMask
    Something I've been wanting for a long time is more preferences for the QuickMask. The QuickMask is that small little rectangle in the lower left corner of an open image which, if you press it, will show you the current selection you've made as a mask. You can then proceed to use normal drawing tools on the mask to change the selection. Really neat, except for one thing: it wasn't possible to change the mask color. It would always be red. This fact rendered it useless (for me at least). It would get impossible to see the difference between mask and non-mask. (perhaps I'm a bit colorblind or something?). This however has been fixed. You can now select the color for the mask, and even set it's opacity. yay!

  • Templates
    A completely new feature in the Gimp are templates. You can save an image as a template and then base other images on that template. Quite a nice feature if it only saved the image and not just the dimensions of the image. All it seems to do is remember the height and width, nothing more. Perhaps I'm not using it correctly 'cause it seems like a pretty useless feature like it is now.

  • Text
    Text is always dynamic now. Not much else has changed. Oh yeah, the text properties are now easier settable from the tool options.

  • Faster
    Loading and Saving images seems somehow faster. Taking a screenshot of a 1600×1200 screen also seems faster. But that might have something to do with me upgrading the RAM in my system. (Sidenote: after about 20 minutes, things went pretty sour.. check below)

Not everthing's great.
Even though the new features are excellent, I've still got some gripes with the new Gimp. Some of these are old issues which I had hoped they would have fixed. Others are just missing in the new version while they were present in the old..

  • Docking anchors
    As I already mentions somewhere else in this article, there aren't enough docking anchors. Check out the image and notice the dock at the left side? There are only dock anchors just below the toolbox and at the bottom of the window. Why are there none in the middle?

  • Transform constraints
    While most of the things in this list I can live with, there is one thing I with which I can't: Transformations on selections, like scaling and shearing, don't have the proper Ctrl/Shift/Alt constraints! This means I can't maintain the aspect ratio of the oroginal section, and that bites. Am i doing something wrong here? I just can't imagine that they would leave out something that important.

  • Still no advanced text transformations
    Advanced text transformations like laying out a text according to a path is still missing. I really hoped they would add some options to make this easier to do. Right now it's also possible, but involves the use of quite a lot of different effects and/or scripts. I want it in the text tool itself. How's Joe NonGeek going to find out hwo to do text transformation?

  • Bugzz
    While I only used the new gimp to create the image accompanying this article, I already found a couple of bugs. Most where harmless and can be avoided quite easily. But one is quite annoying: When I wanted to fill a selection with a gradient I couldn't find the foreground to background option. Turns out it's now positioned in the gradient-pick-button at the top. It's colored black to white, while my foreground and background color where neither. But that's not the bug.. that's just ugly. The bug is: The second time I wanted to perform a gradient fill, the FG to BG and BG to FG options where gone in the dropdown menu. *slap* Bad gimp programmers! (good job on the rest though).

  • Hotkeys
    Another thing I noticed is that it isn't possible anymore to change the hotkey for an option by typing in the hotkey while hovering over the menu option anymore. This is annoying, since they made the '+' char the new hotkey for zooming instead of '='. This means that whenever you want to zoom using the keyboard, you'll have to press shift. Blegh. And I can't find any other way to change the hotkeys. Anybody out there that does: Please mail me :)

    Update: I found out how to enable them again. In the new Gimp, you'll first have to turn on the 'Dynamic Keyboard Shortcuts' in the preferences dialog before you will be able to change the keybindings like before. Thanks to the Gimp Tips (be sure to read them all)

  • Rounding selections
    Rounding selections is still obscurely put away in some script-fu->pluging->selections->Bla bla bla->round selection menu. Move it to the main interface instead, it's a commonly used feature (by me at least)

  • And the worst thing yet!
    The absolutely most horrible, bad, wicked, terrible worst thing about the new gimp is …. slowness. While I just upgraded my machine from 128 mb to 1.5 GIGABYTE.. the new Gimp is about 4 times slower in painting on the screen than the old one. Okay, okay, I am using a AMD K6-2 3D @ 500 mHz, but still is no reason for the new Gimp to be so slow. The weird thing is.. it only became slow after I was using it for about 20 minutes. Before that it had even felt faster than the old Gimp. After 20 minutes, when things started to become slow, it would take my system a WHOLE MINUTE to paint the QuickMask over a 1600×1200 image. That's just not do-able. Really.

Conclusion
So.. in conclusion.. The new interface simply rocks. It can be improved here or there, but overall it's simply supurb. I expected some more new features and was a bit disappointed when there weren't many. There's still some bugs in the new gimp, but that's to be expected.

I've also got the feeling that I missed a lot of the new features. I do know that everything I used to do in the gimp proved to be no problem in the new Gimp. This fact shows that they did a really great job in improving the interface without having to alienate the old users. A job well done, Gimp programmers. Kudo's to you!

/me is a happy little gimper.