Skip to content

Month: November 2009

Converting videos to n800

southpark running on Nokia n800

I found this useful tip about how to convert videos to watch on Nokia n800 using Mencoder.

mencoder input.ogg -vf scale=400:240 -oac mp3lame -ovc lavc -o output.avi

It’s converts a filed called input.ogg to a avi file output.avi with height 240 and width 400 (the device resolution is 800×480) , mp3lame audio codec and libavcodec video.

As this has become a daily operation to me, I create this simple script called 2n800:

if [ $# -ge 1 ];
        mencoder $1 -vf scale=400:240 -oac mp3lame -ovc lavc -o ${1%\.*}.avi
        echo Usage:
        echo "\t$0 FILE"

It transforms the first parameter like something.flv to something.avi. Putting this script as executable on your path like on /usr/bin/ you can easily call the command 2n800 followed with tha name of your video you want to convert. If is readable by Mplayer, it will be converted.

After you converted you video and sent to your n800, you can watch on Mplayer to Maemo. The result is perfect.

Java: Accessing Private Members

Using reflection to change the accessibility of a private object field and access it at runtime.

import java.lang.reflect.Field;

class Life {
    private int meaning = 42;

class Hack {
    public static void main(String args[]){
        Life life = new Life();
        try {
            Field field = life.getClass().getDeclaredField("meaning");
        } catch (NoSuchFieldException e) {
        } catch (IllegalAccessException e){