Much ado about scripting, Linux & Eclipse: card subject to change

2008-09-29

From DVD to online Flash video with dvd::rip, FFmpeg, and JW FLV player

Last week I set myself the task of finally figuring out how to convert a DVD to Flash video, then to post it online. Turns out with the latest xubuntu 8.04, dvd::rip, FFmpeg, and the JW FLV player, it's quite straightforward.

Step 1: Convert a DVD to AVI file (.avi)

After a number of tests with dvd:rip 0.98.6 (installed .deb version: 1:0.98.6-0.0ubuntu1) and transcode 1.0.2 (installed .deb version: 2:1.0.2-0.8ubuntu7), I've settled on this configuration:

Storage
  • On the fly
Clip & Zoom
  • Autoadjust or No modifications (original size)
Subtitles
  • Activated for rendering
Transcode - Video
  • AVI/Xvid, 50 keyframes,29.97 video framerate
  • Single pass encoding, no deinterlacing
  • 1 x 850M (for 2hr DVD track)
Transcode - Audio
  • MP3 audio @ 128 kbit/s x 44100 Hz (required for .flv conversion)
  • Quality 2
  • Nice 0 or 19
  • No PSU core

I managed to rip a 2hr DVD track in about 4 hrs, resulting in an 850M AVI file. This was using my new Samsung 20X USB DVD-RW drive (TSSTcorp CDDVDW SE-S204N), writing to my Western Digital 160G USB bus-powered hard drive. Considering USB to USB read-and-write tends to be slow, I'd consider this pretty good performance, especially for a 1.6GHz machine with only 1.2Gb of RAM.

Here's the resulting .dvdrip-info file:

Step 2: Convert an AVI file (.avi) to Flash Video (.flv)

The next step is to convert your .avi to .flv using FFmpeg (installed .deb version: 3:0.cvs20070307-5ubuntu7.1+medibuntu1). There are lots of config options for this, but the simplest is this, where file types is determined from the input and output filenames. If your input file includes MP3 audio @ 128 kbit/s x 44100 Hz, you'll be able to convert to Flash Video (.flv):

ffmpeg -i input.avi output.flv

Step 3: Streaming Online

Finally, to post the video online, you can upload host it on your own site using the JW FLV Player. The site includes tons of examples including this one for creating a player with chapter, thumbnails, and decriptions. In addition to video, the player also works with audio files and still images, and can be skinned a number of different ways.

2008-09-25

And the plan said...

With everyone's standardized project plans due next week, I've been tasked to draft a consistent workflow for the Modeling projects. And because we're such Model Citizens, I'd like to share it with others, in case this approach works for your project too. See details here.

On that note...

And the plan said usability, motherhood, apple pie
So I shined up my Chrome
Logged into the Bugz and I went in to run a query
It came back with a list of items, too many to possibly do
So I flagged a few, set milestones, and voom!
A plan came into view

woah!

(Chorus)
Plan, plan everywhere a plan
Charting out development, done for The Man
Do this, can't do that, did you read the plan?

And the plan said a lot of these
Have been deferred outta sight
So I looked at those bugs and thought to myself,
Hey! I'll submit a patch tonight
To contribute to this project or to get some new feature in
If God was here, he'd tell you to your face,
Thanks, man you're some kinda winner

Chorus

Now, hey you Mister! Can't you read?
You ain't got to be a committer to get a seat
You can write a patch, or build a new feature,
Ain't supposed to be hard
Plan says anyone can contribute,
Just look for the 'helpwanted' keyword!

And the plan said everybody welcome
Come in, site down and code
But when they passed around the hat
At the end of it all,
I didn't have a buck to unload
So I got me an account with Blogger
And I made up my own little site
I said thank you Eclipse for thinking about me,
I'm alive and you're alright

Chorus x 2

Five Man Electrical Band - Signs

Incidentally, there are over 2500 open 'helpwanted' bugs, with over 1100 closed. Thanks to everyone who's contributed over the years!

2008-09-24

RIP twitter@twitter.com

Last month I complained that Twitter's XMPP service for tweeting by IM has been down for a while.

Tonight, I noticed that the "we're working to restore service" blurb is gone from their site (but as Opal suggested, there's no mention of it ever having existed in their list of changes). Way to rewrite history!

I also noticed it's been a lot longer than I thought since the daemon was online:

RIP, twitter@twitter.com. You will be missed.

2008-09-23

Kiva: Turning a little change into a lot

Back in June, during the Ganymede Poster Contest, Benjamin Cabé introduced me to Kiva Microfunds, a company that connects lenders w/ entrepreneurs in the third world, so that they can start or grow their business, and improve their quality of life.

Kiva - loans that change lives

Now, Kiva stands a chance to win $1.5 million dollars from American Express, which they can parlay into $30 million dollars to support 60,000 entrepreneurs around the world. If you're an AMEX cardholder, you can help by voting for this project. You can of course also help by using Kiva to lend some money to one or more entrepreneurs listed on their site.

2008-09-22

Savimize? Er, no.

Nearly every I get spam from Rogers or Bell, trying in vain to make me switch to their service. It's in vain because a) I'm already with Rogers, so they're wasting their time trying to get me to sign up for services I already have, and b) I won't go back to Bell because the phone lines (and thus DSL rates) in this neighbourhood are teh suck.

But wast of paper and postage aside, let's contrast the two current promotions they're running, both trying to be clever with language... and failing.

Bell recently unveiled what I like to call its "sucki-er" campaign, with numerous print and billboard ads all including the suffix "-er" in the copy. Better, faster, beaver... you name it, they've gone superlative on it. Why does it suck? Because let's be real. Better is entirely subjective. Faster can be measured, and at least in my part of Toronto, it's not. This campaign makes me long for their now famous beaver campaign, because at least it was creative.

Meanwhile, in response, Rogers has unveiled its "invent a new word" campaign, which I find frankly insulting. If there was another cable provider I could turn to, I'd consider switching just because of this bit of lameness.

Recently Rogers has started telling everyone they're faster (but refuses to release details). Lame. This new campaign? Lamer.

2008-09-19

915resolution + xorg.conf = Intel 82852/855GM @ 1600x1200x60Hz

Last week I ordered a new Sceptre 24" monitor from Tigerdirect.ca, and this week it arrived, only a few days later. Zero dead pixels, works perfectly -- and the current website price is 22% more! Timing is everything, apparently.

Of course setting up my laptops to play nice with it was another story, but for my Thinkpad T60p, I've managed to get a single display using aticonfig:

aticonfig --initial=dual-head -f
aticonfig --dtop=horizontal --overlay-on=1 --mode2=1920x1200 \
 --resolution=0,1920x1200,1600x1200,1400x1050,1280x1024,1024x768 \
 --resolution=1,1920x1200,1600x1200,1400x1050,1280x1024,1024x768

Granted, I don't have both the laptop and monitor enabled at the moment, but that's probably because I'm trying to push the laptop screen to a res it can't support (1600x1200). I could probably get them to both go to 1400x1050, but so far I'm happy w/ the single screen.

Anyway, the harder project was getting my wife's old R51 to connect to the Sceptre X24, for two reasons: one, its screen is all but dead (still works, but it's as if it's set to a brightness level of 2%); and two, the automatic configuration in Xubuntu kinda sucks for xorg.conf creation.

After a number of searches, attempts, and failures, I finally found a way to push the Intel 82852/855GM (rev 02) card to 1600x1200 at 60Hz. Here's how:

First, install 915resolution 0.5.3-1ubuntu1 from the ubuntu universe repositories. I tried downloading drivers from Intel, but I couldn't compile anything -- xf86-video-intel-2.4.2.tar.bz2, i915Graphics.tar.gz, drm.tar.gz or mesa.tar.gz -- missing dependencies, apparently.

Next, read the README that comes with 915resolution, /usr/share/doc/915resolution/README.Debian. It explains exactly how to use this tool. Here's what I put in my /etc/default/915resolution file:

MODE=3c
XRESO=1920
YRESO=1440
BIT=8

Next, in your xorg.conf, set the Driver to "i810", set the BusID to the value shown by lspci | grep VGA, set HorizSync & VertRefresh to values that will work for your monitor, and then add Display subsections for all the resolutions you want to try to use.

Section "Device"
       Identifier      "Intel Corporation Mobile Integrated Graphics Controller"
       Driver          "i810"
       BusID           "PCI:0:2:0"
       Option "DevicePresence" "true"
       Option "DRI"      "true"
EndSection

Section "Monitor"
 Identifier "Configured Monitor"
 ModelName    "Sceptre X24"
        HorizSync    31 - 80
        VertRefresh  55 - 76
        Option      "DPMS" "true"
EndSection

Section "Screen"
       Identifier      "Default Screen"
       Device          "Intel Corporation Mobile Integrated Graphics Controller"
       Monitor         "Configured Monitor"
       DefaultDepth    16
       SubSection "Display"
               Depth           16
               Modes           "1920x1440_60" "1920x1200_60" "1920x1080_60" "1680x1050_59.883" "1360x768_59.8" "1600x1200_60" 
       EndSubSection
       SubSection "Display"
               Depth           24
               Modes           "1920x1440_60" "1920x1200_60" "1920x1080_60" "1680x1050_59.883" "1360x768_59.8" "1600x1200_60" 
       EndSubSection
EndSection

Note that the most useful thing I managed to find was how to explicitly set display frequencies: for 1600x1200 at 60Hz, use "1600x1200_60". (This was required because xubuntu by default was trying to run at 59Hz and was creating terrible ghosting effects.)

To test out the above configuration, I wrote this little script (based on ideas here):

#!/bin/bash
# start a new X session on head :5, fire an xterm, and 
# launch kruler to measure screen res
# switch between vt sessions with CTRL-ALT-Fx, 
# eg., for vt2, CTRL-ALT-F2.
# I found this new vt with CTRL-ALT-F9
X -novtswitch :5 & xterm -display :5 & kruler -display :5 &

Now, granted, I still can't get 1920x1200x60Hz (the monitor's native resolution), but I may have found a solution: Tritton TRIUV200 See2 Xtreme USB 2.0 to DVI/VGA adapter.

Anyway, using a Kinamax KVM-USB4 USB 4 Port KVM Switch, I've got two laptops sharing the 24" 1600x1200 screen, with room to add up to two more systems. Minimal desktop clutter, maximum productivity.

Now, if I can just figure out a solution to my wife's workspace clutter...

2008-09-18

Do want... a better copywriter!

I want?
Bad lol.
lolcats funny cat pictures
Good lol.

2008-09-14

Windows XP in Xubuntu with VirtualBox: Aw, snap!

This weekend, on a tip from CDT Doug, I decided to play around with VirtualBox, because there's still a few things I can't do in Linux. I've tried VMware in the past, but the last time I found NAT networking to be a pain to set up. By contrast, VirtualBox is great for drivers and hardware, but getting file sharing to work took some effort. Just make sure you install the VirtualBox Guest Additions into your guest OS, and you'll have video, sound, usb, networking, and sharing.

So, what prompted this? Well...

  1. I can load pages in IE6 or IE7, thanks to WINE and great work of the IESs 4 Linux project... but support for IE7 is still beta, and it's a little slow.
  2. I can run Picasa, also thanks to WINE. The latest version even works properly with Picasa Web Albums and Blogger.
  3. I can open and edit MS Office docs, thanks to OpenOffice (or Google Docs).

But...

  1. I can't run Quicken or QuickTax (ranked bronze or garbage by WineHQ's AppDB).
  2. I can't run iTunes.
  3. I can't run Google Chrome.
  4. I can't run SBCG4AP, or any Windows-only games from Popcap or Gamehouse.

So, it was time to get virtual. I created an 8Gb Win XP Home image, with 192Mb of RAM, running inside my 1.6Ghz, 1.25Gb RAM Thinkpad R51 Xubuntu laptop, and it works great. I can run Chrome, iTunes, Quicken, and at least one GameHouse game. Note that in this screenshot (top right corner), the CPU has clocked itself down to a whopping 600MHz using kpowersave's Powersave scheme and Dynamic CPU policy. You'll also notice I changed the default 'Right Control Key' mouse/keyboard grab toggle to 'Left Windows Key' because that way I don't have to use my right hand to switch from the main desktop to the virtual one.

Unfortunately, SBCG4AP won't start due to this error:

When trying to get a copy of the Win XP Power Toys Tweak UI control panel applet, I managed to kill Chrome, and got this for my collection.

Finally, let me show one last feature of VirtualBox: "seamless mode". With this enabled, you can blend XP apps right into your linux desktop. They're still managed by the Windows Start menu (which I've set to auto-hide in the shot below), and tend to force themselves to be above other linux-managed windows, but it provides an uncluttered way to work, if you prefer it.

2008-09-13

Where in the world is Modeling Sandiego?

A couple days ago, I pointed out some stats about Popular Eclipse Projects.

Today, let's look at some more detailed stats about the Modeling Project itself, thanks to Google Analytics, which has been installed at on www.eclipse.org since July 19, 2008.

In just under two months since we turned on stat tracking, we've gotten over 90,000 Visits & 300,000 Pageviews from over 40,000 Visitors hailing from over 150 Countries!

View larger images

Not included in the screenshots above are some interesting stats about user agents -- what people are using to visit the Modeling Project's site. As you'd probably expect, it's mostly Firefox, IE, and Opera. But would you believe five Playstation hits? Would you believe a Nokia N80, two SonyEricsson phones, but no shoe phones? How about over 1000 hits from Google Chrome users? (I'm so jealous there's no Chrome for Linux yet!) Here's the complete list:

Rank   User-Agent   Hits   (%)
1.  Firefox  56,037  (59.17%)
2.  Internet Explr 30,649  (32.36%)
3.  Opera  2,745  (2.90%)  
4.  Safari  2,297  (2.43%)  
5.  Mozilla  1,373  (1.45%)  
6.  Chrome  1,174 (1.24%)  Already in the #6 spot!
7.  Konqueror 319  (0.34%)  
8.  SeaMonkey 29  (0.03%)  
9.  (not set) 18  (0.02%)  
10.  Mozilla Compatible Agent 12  (0.01%)  
11.  Netscape 12  (0.01%)
12.  Camino  8  (0.01%)
13.  Galeon  8  (0.01%)
14.  Playstation 3 4
15.  Googlebot 2
16.  MyBrowser; MyWindows 2
17.  NetFront 2
18.  SmallProxy 3.4.1 Free 2
19.  Axis2 1
20.  DoCoMo 1
21.  Jakarta Commons-HttpClient 1
22.  MSIE 7.0 1
23.  NETSCAPE FOREVER 1
24.  NokiaN80 1
25.  OpenWave 1
26.  Playstation Portable 1
27.  SonyEricssonW910i 1
28.  X-Browser 1
29.  aaa 1
30.  iexplorer 7.0 WebWasher 3.4 1
31.  openwave 1
32.  preview 1
33.  sonyericssonk750i 1


Wondering how you can track your eclipse.org site's stats using your own Google Analytics account? Here's how:

  # see http://wiki.eclipse.org/Using_Phoenix#Google_Analytics
  $App->SetGoogleAnalyticsTrackingCode("UA-2345678-9"); # use your UA account

2008-09-11

Popular Eclipse Projects

Here's what the Popular Projects box looked like on April 1, 2008. No, this isn't a very belated joke. Note that EMF is in the top slot, with MDT in 4th and 4 other projects who use or depend on at leat one Modeling project. Yay, Team Modeling.

A few months later, Modeling has captured 4th, 6th, and 7th, with 3 projects depending on them -- still 60% of the board using some Modeling! With UML2 3.0 starting up, will MDT move back up?

WTP and PDT continue to dominate in the top 3, just ahead of CDT (whose downloads get shared with Sourceforge due to the success of the Windows-only spin-off project, Wascana). By the way, PDT released a new 2.0 Integration build this week, fixing 48 bugs.

Curiously, the Visual Editor (VE) continues to live on the leaderboard, even though its last official build at Eclipse.org was over a year and a half ago. To me that says there's still a lot of community interest in this project. One of these days it'll be up and running again, under Dash's new Common Builder, and maybe get some new committers or contributors to help develop its 1.4 release. Stay tuned.

A wise man once said statistics seldom make you feel better. But they can be fun.

HOWTO: timestamp your Bash prompt

This has always been a pain for me -- waiting for crontab events to kick, you have to keep typing date or date;ls -la|tail waiting for files to show up.

Recently, I got annoyed enough to take matters into my own hands, and I found this. Most of the advice in there doesn't seem to work for the system I was working on, but I worked out another solution, using the PROMPT_COMMAND variable. The following code should go in your ~/.bashrc, /etc/bashrc, or equivalent.

red="\033[1;31m";
norm="\033[0;39m";
cyan="\033[1;36m";
if [ "$PS1" ]; then
    if [[ $UID -eq 0 ]]; then
      PS1="\[$red\]\u@\h:\w\\[\033[0;39m\]\n# "
    else
      PS1="\[$cyan\]\u@\h:\w\\[\033[0;39m\]\n\$ "
    fi
    export PROMPT_COMMAND="echo -n \[\$(date +%H:%M:%S)\]"
    export PS1=" "$PS1"\[\e]30;\u@\h\a\]"
fi
The result?
[15:17:16] nickb@emft:/opt
$ 
- or, when logged in as root -
[15:18:06] root@emft:/home/nickb
# 

2008-09-09

$100,000 phone, $6 shipping


Sure, it's a $100,000 phone, but shipping is a steal!