2010. november 18.

OGM to AVI with hardcoded subtitles

I was trying to hardcode a subtitle while "-ovc copy". How silly of me. It is only possible to hardcode a subtitle if mencoder has to process the video file frame by frame, as it modifies the pictures when hardcoding.

For whatever reason MEncoder didn't want to work for me recoding a Vorbis audio stream to mp3 with Lame, so two steps were added in between.

#1. Demuxing OGM to separate stream-files
ogmdemux input.ogm

#2. Converting audio track to mp3
soundconverter -b -m audio/mpeg -s .mp3 input.ogm-a1.ogg

#3. Muxing video, audio and subtitle into an avi
mencoder input.ogm-v1.avi -o output.avi -audiofile input.ogm-a1.mp3 -oac copy -ovc lavc -lavcopts vcodec=mpeg4 -sub input.ogm-t1.str

#1-3. Of course at the end I managed to do steps 1-3 in a single step:
mencoder input.ogm -aid 1 -sub input.srt -o output.avi -oac mp3lame -lameopts cbr=128 -ovc lavc -lavcopts vcodec=mpeg4

I guess to achieve the all inclusive #1-3, I had to install some stuff and make mplayer for myself...
sudo apt-get install libasound2-dev libfreetype6-dev zlib1g-dev libmp3lame-dev libfontconfig1-dev libexpat1-dev ogmtools
./configure --enable-theora --enable-libdv --enable-mp3lame --enable-mp3lame-lavc --enable-mp3lib --enable-debug
But of course I don't know what exactly did the trick.

For a better quality it's possible to use extra options, like -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=5000:mbd=2:trell
To get needed value of vbitrate do a mencoder -ovc frameno -o frameno.avi -oac copy input.avi and read your value in the terminal window.

Gentoo Forums

2010. november 14.

ImageMagick BMP compression

To make uncompressed BMP files, or to decompress BMP files in ImageMagick, use the -compress none option.

To make less then 24-bit BMP files in ImageMagick, use the -colors 256 option, which would make a 8-bit BMP file.

Use these settings to be able to import scores into Neuratron PhotoScore.

2010. november 13.

image to pdf

I really can't handle ImageMagick when it comes to pdf files. It creates such huge files they are completely useless.

I tried out another way: pbm -> ps -> pdf:

first I ImageMagick convert pbm-s:
mogrify -format ps -density 300x300 *.pbm
then put them into ps2pdf:
lista=(`find -iname '*.ps' | sort`)
for i in "${lista[@]}"
ps2pdf -r300 -g1880x2688 $i $i.pdf

and bind them:
pdfjoin *.pdf --outfile output.pdf

It worked brilliantly. This way my pdf is 8 times smaller then my original pdf, and it's only 1.5 times bigger then the djvu I made from the same images.

Djvu was made directly from pbm files, converted with cjb2 and binded with djvm. No special option was used.

2010. november 7.

Image INFO through ImageMagick

identify -verbose image.jpg

To get only what you want to see you can use GREP like this:

identify -verbose image.ps | egrep "Resolution|Geometry"

This will return you the lines with Resolution and Geometry. Just what I need to make good compressed pdf files with ps2pdf.

2010. október 27.

Working in Imagemagick

Clearing margin area

I'm working on a scanned text page, that needs a cleanup on the margins.
the original image size is 2736x3928 and it's a pbm file.
~$ convert orig.pbm -crop 2320x3928+120+0 crop.pbm
this cuts down 120 pixels from the left side, and 2736-120-2320=296 pixels from the right side.
~$ convert crop.pbm -bordercolor white -border 296x0 -gravity none -crop 2736x3928+176+0 back.pbm
this puts back the cut-down border in the color white. (first we add a 296 pixel wide border to both sides, which makes our image 296+296+2320=2912 wide. we only need the 296 border on the right side, so we crop the one on the left to be 120 px with 296-120=176 pixels. check: 2912-176=2736 we counted right.)

You have to do this 2 step separately. You can use mogrify instead of convert to edit multiple files, but ALWAYS make a backup copy of your files before using mogrify!

That's it. Enjoy.

2010. október 6.

Still on my to-do list

The only serious problem remains the Eraser jumping around.
I already reported this bug, and I don't seem to be alone with it. You can find out more about it here: https://bugs.launchpad.net/ubuntu/+source/xf86-input-wacom/+bug/588435

I want the scroller back! (Success!)

The TC4400 has a jog dial for pgup/pgdn on the side of the screen. The last time it worked out of the box was (when I used it) Gutsy Gibbon.
Recently I tried it, and it works in Hardy Heron also, where the wacom stuff doesn't work o-o-t-b.

Today I had to skip a class to get back my scroller, but at least it payed off. It was a lot easier than I thought. My bad luck was that I'm just a windows-user and not a linux-guru.
Here's how it works:

xev - "print contents of X events" - is the command to check, which button moves which key. The jog dial wasn't recognized in xev.

dmesg - "print or control the kernel ring buffer" showed me what is happening behind the screens.

It said:

[ 218.438785] atkbd.c: Unknown key pressed (translated set 2, code 0x87 on isa0060/serio0).
[ 218.438791] atkbd.c: Use 'setkeycodes e007 ' to make it known.
[ 218.479875] atkbd.c: Unknown key released (translated set 2, code 0x87 on isa0060/serio0).
[ 218.479881] atkbd.c: Use 'setkeycodes e007 ' to make it known.
[ 218.819908] atkbd.c: Unknown key pressed (translated set 2, code 0x86 on isa0060/serio0).
[ 218.819915] atkbd.c: Use 'setkeycodes e006 ' to make it known.
[ 219.041670] atkbd.c: Unknown key released (translated set 2, code 0x86 on isa0060/serio0).
[ 219.041678] atkbd.c: Use 'setkeycodes e006 ' to make it known.

for moving the jog dial "up" and "down" ways.

As for setkeycodes it wasn't so trivial. The "keycodes" doesn't match any keycode that xev gives back, so I tried from 1 to 109 until I found the keys I was looking for. (104: Prior; 109: Next)

In the end, for me the following command solved the problem:

sudo setkeycodes e006 104
sudo setkeycodes e007 109

I don't know if this affected my success, but I did a
sudo modprobe hp-wmi

and I left it like that. I wanted to get the 'sudo modprobe tc1100-wmi' work, but I couldn't, and that's how I accidentally found real soultion.

By the way these were the keycodes for moving:
102: Home
103: Up
104: Prior
105: Left
106: Right
107: End
108: Down
109: Next

To make the changes permanent you'll have to add the setkeycodes lines without the sudo to the /etc/rc.local before the "exit 0".

2010. június 9.

Sorting out input devices 3.

Okay, so the cursor jumped again after the last changes.
I changed the /usr/lib/X11/xorg.conf.d/10-wacom.conf like this:

Section "InputClass"
Identifier "Wacom serial class"
MatchProduct "Serial Wacom Tablet"
MatchDevicePath "/dev/ttyS0"
Driver "wacom"
# Option "Device""/dev/ttyS0"
Option "Type" "stylus"
Option "ForceDevice" "ISDV4"
Option "Button2" "3"
# Option "Button3" "4"
Option "TPCButton" "on"

Section "InputClass"
Identifier "Wacom serial class"
MatchProduct "Serial Wacom Tablet eraser"
MatchDevicePath "/dev/ttyS0"
Driver "wacom"
# Option "Device""/dev/ttyS0"
Option "Type" "eraser"
Option "ForceDevice" "ISDV4"
Option "TPCButton" "on"

and now the system doesn't recognize the eraser. (this wasn't intended)
However, the jumping never happened ever since, and that was already about a week ago.

What in hell is happening?

Ununtu takes up almost 5 GB on my hard drive, and every "Important Security Update" seems to be more than 50MB! What in hell happened?!? Ubuntu used to take up 3.5 GB, even after several updates of even after updating to a newer version. And suddenly, the 6 GB space I dedicated to it will not be enough!

2010. június 1.

Sorting out input devices 2.

I didn't experience the cursor jumping jet today.
What I did today was

~$ sudo gedit /usr/lib/X11/xorg.conf.d/10-wacom.conf

now it looks like:

Section "InputClass"
Identifier "Wacom serial class"
MatchProduct "Serial Wacom Tablet"
MatchDevicePath "/dev/ttyS0"
Driver "wacom"
# Option "Device""/dev/ttyS0"
# Option "Type" "stylus"
Option "ForceDevice" "ISDV4"
Option "Button2" "3"
# Option "Button3" "4"
Option "TPCButton" "on"

Section "InputClass"
Identifier "Wacom serial class"
MatchProduct "Serial Wacom Tablet eraser"
MatchDevicePath "/dev/ttyS0"
Driver "wacom"
# Option "Device""/dev/ttyS0"
# Option "Type" "eraser"
Option "ForceDevice" "ISDV4"
Option "TPCButton" "on"

And works just right. We'll see what's gonna happen with the jumping.
What I basically did here was to add eraser and add proper device path, and remove unnecessary entries, like the one for supporting touch, and another one, which I don't know what it was for.

I didn't try removing the #-s jet. I jus put them in in case I want to adjust the file further to match what xorg.conf used to be before Lucid.

2010. május 31.

Sorting out input devices

The general problem is:
The cursor jumps around and clicks on things. As described here.
This post is dedicated to cornering and trying to solve the problem.
EDIT: as it turned out it was a hardware problem.

Cursor jumping around

I have this really "nice" problem since a while, and today I found out I'm not the only one in this situation.

Re: Mouse Jumping to corner on its own (TX2000 tablet PC)

2010-05-31 12:30 PM


I've been having the same problem with my TC4400 tablet running Ubuntu Linux.

Here are my experiences:

- the cursor started jumping about 5 months ago. The computer is in my hands for exactly 2 years now, but it was a renew, so it's some time older, maybe half-1 year.

- the cursor first started jumping to the bottom right corner.

- it had a tendency to jump when I was using firefox watching sites like gmail or youtube, that used Java and/or Flash.

- about 2 months ago it started jumping (and clicking of course) not only when I used firefox with the mentions conditions, but also for other programs, and generally, at any time.

- about 1 week ago, I installed the newest version of Ubuntu (10.04), and since then the cursor started to jump to the bottom left corner too, so now it jumps to 2 different places.

- I also noticed, that the cursor does not jump when I use the pen. (there is no touch recognition, only the pen)

- I also noticed, that my computer started to became awfully hot at the corner of the ventilator, which is the corner, where the ESC button is.

So far I thought about disabling the touchpad and use the joystick instead, but they disable together, so I cannot do that.

I cannot afford to be without my computer, so I cannot put it to repair service. (I had a painful experience with them already anyway.)

The only way I can avoid the cursor from jumping is to hold the pen with one hand to the monitor, but this is pretty uncomfortable.

This whole cursor jumping thing is really annoying, and I'm relieved that I'm not the only one experiencing this.

2010. május 29.

Labtec Notebook Webcam on Ubuntu

I bought this webcam last year. It worked with Gutsy, but it doesn't work in Lucid. Or at least with Skype not - at the beginning.

Here are some details to begin with:

skype version: Beta for linux.

~$ lsusb
ID 046d:08aa Logitech, Inc. Labtec Notebooks

~$ lsmod | grep videodev
videodev 34361 1 gspca_main
v4l1_compat 13251 1 videodev

~$ lsmod | grep gspca
gspca_zc3xx 45189 0
gspca_main 21199 1 gspca_zc3xx
videodev 34361 1 gspca_main

here's what I did so far:
- plugged in webcam. skype doesn't see it.
- installed cheese. video works. skype sees that there is a video device, but there's no picture.
- installed guvcview. still the same.
- I restarted the computer
- I tried again with the LD_PRELOAD stuff I found in other forums, and finally, like a miracle,

LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so skype

did the trick. :-)
I submitted this info on UbuntuWiki

2010. május 23.

Screen rotation through Nautilus scripts.

Here is how you make nautilus scripts work.

This is a script for rotating right (note-taking side):
xrandr -o right
xsetwacom set 'Serial Wacom Tablet' Rotate CW
This is to set back to normal:
xrandr -o normal
xsetwacom set 'Serial Wacom Tablet' Rotate NONE
I also use the following two, so I can rotate in any direction:
xrandr -o left
xsetwacom set 'Serial Wacom Tablet' Rotate CCW
xrandr -o inverted
xsetwacom set 'Serial Wacom Tablet' Rotate 3

Little Disturbing Problems

I can't use xbindkeys to bind the keys I want.
The only specific key I can bind like this is the "Ctrl+Alt+Del" button on the edge of the screen. But that's the least disturbing one.
- I need the scroll button on the edge of the screen the most.
- The single button next to the volume keys would be also very useful.
- Not to mention the mouse-activated keys... which just never worked.

Setting the pen button to work

As written here, in 10.04 we don't use xorg.conf anymore. We use
gksudo gedit /usr/lib/X11/xorg.conf.d/10-wacom.conf

And what we do is, that we put Option "Button2" "3" under the section that is for the pen, like here:
Section "InputClass"
Identifier "Wacom serial class"
MatchProduct "Serial Wacom Tablet"
Driver "wacom"
Option "ForceDevice" "ISDV4"
Option "Button2" "3"
Option "TPCButton" "on"

An alternative solution is to put the
# Custom wacom settings.
xsetwacom set 'Serial Wacom Tablet' 'Button2' '3'

lines into our .profile file, in our home directory. (it's a hidden file)

Java Applets on Lucid

I found this terrific post, which completely worked for me. Unlike icedtea & co.
It runs my internet bank and it runs facebook photo uploader too!!

It goes like:

The one java app I have to use does not work correctly with openjdk and icedtea, so I really must use sun's runtime and plugin. I was surprised to see that neither this thread nor any of the others I could find said anything about getting sun's plugin to work on lucid (or with firefox-3.6 in general). Maybe my search string wasn't good enough. Anyway, here's how to do it.

First, open 'Software Sources', click the 'Other Software' tab, and enable the lucid partner repo. (If it doesn't show up on the list, add it: deb http://archive.canonical.com/ubuntu lucid partner )

Next, install sun-java6-plugin.

Uninstall both icedtea6-plugin and openjdk-6-jre.

And finally, due to this bug, run the following command in terminal:

sudo update-alternatives --install /usr/lib/mozilla/plugins/mozilla-javaplugin.so mozilla-javaplugin.so /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so 1

This is the only step that is specific to firefox-3.6 and lucid.

Restart firefox and check about:plugins to verify that the correct plugin version is loaded.

If icedtea and openjdk work for the apps you use, then I recommend that you continue to use them rather than switching to the sun versions. However, if you use apps that do not work correct with ubuntu's default java installation, the above should work.

Ubunti 10.04 LTS Lucid Lynx

Yes, I changed. I didn't upgrade, because updating was simply using up the space. How in hell is Ubuntu wanting to take up more space than 6 GB?! Well, I said no to it, and installed a completely new one, the newest one, with long term support. Now, if this works out, I don't have to change for a while.

Works out of the box:
- pen, eraser and pen button in Xournal
which I'm really happy for.

also somehow the post concerning tc4400 and ubuntu grow through the years, so now I have a larger base for support. I'll see if the post will be helpful in the end or not.

I was also pleased when I experienced the new "Make bootable ubuntu USB" for the first time. It works good.

However, still, I didn't dare to go back on 64-bit.

2010. március 7.

Image rotation nautilus script in the right click menu

create folder:

create files:
"Rotate CW"
"Rotate CCW"
"Rotate 180"

edit these in gedit, and than make them executable.

This is the script for Rotate CW:
for CCW use 270 and for 180 use 180 instead of 90.

2010. március 6.

VirtualBox printing


2010. március 2.

Screen rotation with stylus rotation on Karmic

Here's what changed:

To reach metacity type in terminal: gconf-editor /apps/metacity

To rotate the screen use xinput --list to determine the nape of the stylus, and replace "stylus" to the new name in the rotate script. My stylus has the name of: "Wacom Serial Tablet PC Pen Tablet/Digitizer"