Yearly Archives: 2009

Getting scripts and shortcuts to show in KDE4 Runner

December 8, 2009 » Geek

I tend to write little tidbits that I like to use in KDE fairly often, or custom shortcuts for launching applications. Every time I do this though, I forget how I got the last one to show up in krunner. This is just a quick guide to what I do, to remind myself and to show you.

1. Move script to somewhere in my path (I use ~/System/bin for no apparent reason)
2. Create a .desktop file
3. Move .desktop file to ~/.kde/share/applnk/
4. Run kbuildsycoca4 to rebuild the KDE4 cache
5. Restart krunner.

I also came across kappfinder, pictured below, that finds applications that aren’t in the menu system for some reason (only added to Gnome or something). Not useful for this application, but handy to know, and related.


Tags: ,

CSS Heart

December 7, 2009 » Geek

(Update 2009-12-07)
I fixed it to work in webkit too.

I was playing with clip and border-radius and put this little guy together.

<3 CSS

I haven’t tested it in anything but Iceweasel 3.5.5, so your mileage may vary. You can check it out here: CSS Heart.

This is only two divs to make the heart. Much less impressive than the Homer Simpson in CSS.

I suppose I could have just used &hearts; huh?

Thursday Quote: Showbread

December 3, 2009 » Uncategorized

“And so I am the prince of sounds that make ears ring.
My princess, kiss me with your sweet lips and lo, my heart will sing.

If art is in yourself, or in a class at school, if art is ego and selfishness, and at the mercy of primitive tools, we sing sweet good-byes in screams and screeches and bury these knives in your heart, no paintings or poems to let you live on, we’ve seen the last of art.

As servants, and lovers, we wash your feet and cry out into the dark: ‘The noise, the beauty, the love you bring me stabs these knives right into art!’

Art is not the world, art is in our hearts.
Stab art to death.”

– Showbread, Stab Art To Death on No Sir, Nihilism Is Not Practical


Hard subs with mencoder, or, annotating screencasts for free.

December 2, 2009 » Geek

I was working on a screen cast for a project and I could not get anything to work the way I wanted to. I didn’t have the desire to purchase software, so I sought a way to annotate it for free. I tried a half dozen free and open source video editors, with no real luck. Either they choked on the format I captured (from CamStudio) or they didn’t have a readily available inline text tool.

What I ended up using was plain old subtitles, plus the handyman’s secret weapon, mplayer/mencoder.

Here’s what I did. I fired up the video in VLC and found the points where I wanted to put my subtitle help text. Subtitle files are usually pretty straight forward. I chose the .srt format, which is plain text. You can edit by hand, or you can use a tool, I used the aptly named subtitleeditor. Which, by the way, barfed on my video file.

Here’s a snippet of the resulting .srt file:

00:00:00,000 --> 00:00:13,000
Welcome to the product gallery walk through.

00:00:13,000 --> 00:00:23,000
Adding a product: Select image.

00:00:23,000 --> 00:00:32,000
Insert title and description.

Next I needed to turn those “soft” subs into “hard” ones. This is where mplayer/mencoder come in. To add soft subs to a video in mplayer, you use the -sub option. Running this in mplayer first is a good way to see how it will look at tweak it according to the many options you have. I went with the defaults, it looks pretty good that way.

Lastly, I needed a good mencoder recipe to pull it all together. After lots of searching I found a great MPEG4 one here.

It’s a two pass system, and the crucial piece is in calculating the bitrate:

bitrate = 50 * 25 * width_of_video * height_of_video / 256

My bitrate was 2540600. After you get that, you just plug it into the two passes below. This includes my subtitle options.

mencoder -o /dev/null -ovc lavc -lavcopts vcodec=msmpeg4v2:vpass=1:vbitrate=2540600:mbd=2:keyint=132:vqblur=1.0:cmp=2:subcmp=2:dia=2:mv0:last_pred=3 -nosound -sub -subfont-text-scale 3 RawScreenCast.avi
mencoder -o FinishedScreenCast.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vpass=2:vbitrate=2540600:mbd=2:keyint=132:vqblur=1.0:cmp=2:subcmp=2:dia=2:mv0:last_pred=3 -nosound -sub -subfont-text-scale 3 RawScreenCast.avi

It takes a while but not too long. When all was said and done I had a perfect hard-subbed version and it shrank my file size from ~550MB to 7.6MB. That is a great encoding recipe.

Average video still.
An average frame, with hard subs.

Thursday Quote: Charlotte Brontë

November 26, 2009 » Uncategorized

“Conventionality is not morality. Self-righteousness is not religion. To attack the first is not to assail the last. … Men too often confound them: they should not be confounded: appearance should not be mistaken for truth; narrow human doctrines, pharmacy that only tend to elate and magnify a few, viagra sale should not be substituted for the world-redeeming creed of Christ. There is — I repeat it — a difference; and it is a good, store and not a bad action to mark broadly and clearly the line of separation between them. “

– Charlotte Brontë, Preface to Jane Eyre