Sunday, December 2, 2012

Canon CanoScan 9000F in Debian Linux

I purchased a Canon CanoScan 9000F scanner, to use with my Debian system. To ensure I would have a smooth time, I went to the Sane project website (http://www.sane-project.org/sane-mfgs.html#Z-CANON) and confirmed that it was fully supported.

Debian version of my system:


lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 6.0.6 (squeeze)
Release: 6.0.6
Codename: squeeze

Got the scanner plugged it in, powered it on. dmesg showed it.


[755012.680139] usb 1-8.1.3: new high speed USB device using ehci_hcd and address 96
[755017.773253] usb 1-8.1.3: New USB device found, idVendor=04a9, idProduct=1908
[755017.773260] usb 1-8.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[755017.773264] usb 1-8.1.3: Product: CanoScan
[755017.773268] usb 1-8.1.3: Manufacturer: Canon
[755017.773411] usb 1-8.1.3: configuration #1 chosen from 1 choice

Good. Tried:

scanimage -L


No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).


which found no scanner, bummer.

Googling around a bit, it turns out the pixma-backend included with Squeeze, doesn't have the required support. So based on this post -> http://permalink.gmane.org/gmane.comp.graphics.scanning.sane.devel/20896, decided to get the backend from the git repository and compile. Needed to get a few packages:



apt-get install git

apt-get install autoconf
apt-get install gcc
apt-get install libusb-dev
apt-get install make

Before, I could do:


cd code/
git clone git://git.debian.org/sane/sane-backends.git
cd sane-backends/
autoconf ( Squeeze has a older version, then what the git repository used, but it worked)
automake
BACKENDS="pixma" ./configure
make
su ( need to be root, for make install and to run ldconfig)
make install

ldconfig -v ( -v is verbose. From man page: will set up the correct links for the shared binaries and rebuild the cache.)

Success. The old version was:


scanimage -V
scanimage (sane-backends) 1.0.21; backend version 1.0.21

After running ldconfig.

scanimage -V
scanimage (sane-backends) 1.0.21; backend version 1.0.24



Now scanimage can detect the scanner.

scanimage -L
device `pixma:04A91908' is a CANON Canoscan 9000F multi-function peripheral

However the xsane front-end has trouble getting access to the scanner, the reason being, udev has the old libsane rules and not the ones we just built. The old rules are in:

/lib/udev/rules.d/60-libsane.rules

The one we just built are ( relative to where git placed them):

sane-backends/tools/udev/libsane.rules

We could either manually copy the lines we care about:

diff -u /lib/udev/rules.d/60-libsane.rules tools/udev/libsane.rules | grep -C 2 9000
+# Canon CanoScan 700F
+ATTRS{idVendor}=="04a9", ATTRS{idProduct}=="1907", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"
+# Canon CanoScan 9000F
+ATTRS{idVendor}=="04a9", ATTRS{idProduct}=="1908", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"
+# Canon CanoScan LiDE 110

or as I prefer, replace the old one with the new one.


Now the scanner is usable.



Thursday, May 17, 2012

Video conversion in Linux

My Nikon COOLPIX P300 camera generates h264, 1920x1080 videos in a .mov container. So a 17 second video is over 40 Megabytes. I decided to convert this to a different format, with the aim of reducing the file size.

A quick search led me to ffmpeg. Running that dispalyed a message to use avconv instead.

So on to avconv.

To do a basic conversion, the command is:

avconv -i in_movie.mov out_movie.avi

This however failed with:

[ac3 @ 0x875efa0] invalid bit rate

Turns out, the default bitrate used by avconv is not supported by the default audio codec ( ac3 ) it selected. Sigh.


Solution,  modify the command to use 192k audio bitrate which it support.

avconv -i in_movie.mov -b:a 192k out_movie.avi

This worked. It generated a 3 Megabyte file, which seemed impressive, but the quality sucked since it reduced the video bit rate dramatically.

I decided to move the video bit rate closer to the original video. So the command with video bitrate set to 19000 kbps is

avconv -i in_movie.mov -b 19000k -b:a 192k -out_movie.avi

This got me good video quality but it only reduced the file size by a few Megabytes.

I decided the best reduce the resolution by 1/2 to get a lower file size with good quality video.  That command is

avconv -i in_movie.mov -b 19000k -b:a 192k -s 960x540 out_movie.avi

This reduced the 40+ Megabyte file to a 12 Megabyte file.  Success.

Thursday, July 8, 2010

Compiling sfxr on Ubuntu

sfxr (http://www.drpetter.se/project_sfxr.html) is a cool utility for generating sound effects. To compile it on Ubuntu you need to install a few packages to resolve dependencies.

Dependencies are: build-essential libasound2-dev libasound2-plugins libsdl-dev libgtk2.0-dev

Taken from the comments in http://theravingrick.blogspot.com/2010/03/i-posted-on-some-of-work-i-want-to.html.

Thursday, June 17, 2010

ffmpeg: A simple command line tool for converting video formats

Simple to use:
ffmpeg -i input_file output_file.extension_of_new_format

like so, to convert a mpeg to swf (Adobe flash format)

bash$ ffmpeg -i video.mpeg output.swf

You can tweak the defaults by adding more parameters. Some that are useful are, bitrate(-b), framerate(-r) and output video size(-s). The last one would scale your video.

So the following:

bash$ ffmpeg -i video.mpeg -b 700k -r 25 -s 580x200 output.swf

would generate a swf that would have a birate of 700kbps, framerate of 25 and a size of 580 into 200 pixels.

If you are targeting a standard, like say dvd video. You can skip typing individual parameters and can use "-target dvd" instead. Check the man pages for more options.

Sunday, June 6, 2010

xvidcap: Make a video of your linux desktop.

Xvidcap is a nice tool to make movies of your linux desktop. It installs from the repos "sudo apt-get install xvidcap" and works great.

Sunday, March 28, 2010

High load on Acer Aspire 5738z with Ubuntu 9.10

There is a bug w.r.t to the graphic drivers for this laptop. This causes udev to take up quite a bit of CPU, making the laptop run hot.

The Ubuntu bug is here:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/440411

From the ubuntu bug, once can go look at the related kernel bug:
http://bugs.freedesktop.org/show_bug.cgi?id=23183

There seem to have been a resolution in the kernel but that got reverted since it was causing issues. So for now the problem remains.

For now I am killing udev to keep my laptop cool. Like so:

$ sudo /etc/init.d/udev stop

Thursday, March 18, 2010

Brigthness fix for Acer Aspire 5738z with Ubuntu 9.10

The brightness keys on this laptop (Fn + left/right arrow keys), do not work out of the box on Ubuntu. It does not work on 9.04 (Jaunty Jalopy) and continued to not work in 9.10 (Karmic Koala).

The work around for this is modifying your kernel command line to add "acpi_osi=Linux nomodeset acpi_backlight=vendor". One way to do this is to modify (or safer yet copy) a kernel entry in menu.1st file of the grub bootloader.

So for example if your boot directory is /boot/ then menu.1st is in /boot/grub/menu.1st.

I edited my latest kernel like so:
Old entry ->

title Ubuntu 9.10, kernel 2.6.31-20-generic
uuid some_id
kernel /boot/vmlinuz-2.6.31-20-generic
root=UUID=some_id ro quiet splash
initrd /boot/initrd.img-2.6.31-20-generic
quiet
New entry ->

title *Brigthness fix* Ubuntu 9.10, kernel 2.6.31-20-generic
uuid some_id
kernel /boot/vmlinuz-2.6.31-20-generic root=UUID=some_id
ro quiet splash acpi_osi=Linux nomodeset acpi_backlight=vendor
initrd /boot/initrd.img-2.6.31-20-generic
quiet

Taken from this thread:https://bugs.launchpad.net/ubuntu/+source/acpid/+bug/392948

Thursday, February 11, 2010

mtpaint - Good application to do pixel art in Linux

If you want to create some pixel art, I would recommend mtpaint - http://mtpaint.sourceforge.net/. It has pretty good functionality. So far the only thing I find difficult to use is the multiple layer functionality for creating animations.

Mouse issues with Ubuntu Karmic Koala (9.10)

If you are considering updating to Karmic Koala, hold of for now. Mouse support for some people has been broken since around November 2009 and is broken to date (Feb 2010).

My initial update to Karmic Koala went pretty smoothly. However down the line as I continued to update my packages something went wrong and now my mouse can be pretty flaky. After doing some google searches, it turns out that a bunch of folks are experiencing this problem. The cause of the bug has not been tracked down and there are only work arounds, such as:
1. Log out of your windows session and log in again, this seems to be working for me.
2. If you only have issues with a particular application run that application from the console like so:
$ export GDK_NATIVE_WINDOW=1
$ application_having_issues.
3. For more esoteric workarounds read the threads below. The above 2 were easiest for me to try.

Threads with the complaints:
http://ubuntuforums.org/showthread.php?t=1334222
http://ubuntuforums.org/showthread.php?t=1308754

Sunday, November 8, 2009

Using Vim for actionscript

The syntax file is here http://www.vim.org/scripts/script.php?script_id=1061.

Put it in /usr/share/vim/vim72/syntax/

Edit /usr/share/vim/vim72/filetype.vim to remove the .as filetype binding to Atlas so that vim will syntax highlight your code properly.

So the line in the file that looks like this

au BufNewFile,BufRead *.atl,*.as setf atlas

needs to be:

au BufNewFile,BufRead *.as,*.mxml setf actionscript

Monday, November 2, 2009

Good HTML, CSS tutorial


http://www.htmldog.com/ has good tutorials for HTML and CSS. The tutorials are easy to follow and teach the syntax well.

Thursday, October 29, 2009

Upgrading to Ubuntu Karmic Koala (9.10) from Ubuntu Jaunty Jalopy (9.04)

Related: Brightness fix

11Feb2010 Update: There are mouse issues with Karmic Koala so I would suggest you hold of from updating. See http://linuxbear.blogspot.com/2010/02/mouse-issues-with-ubuntu-karmic-koala.html

You need to run "sudo update-manager" in the command prompt.

This site has better details http://www.ubuntugeek.com/upgrade-ubuntu-9-04-jaunty-jackalope-to-ubuntu-9-10-karmic-koala-beta.html

Monday, September 28, 2009

Good sound editor for Linux

Audacity is a great sound editor for linux. Allows you to import various file format, edit them and export them back into any format you like.

Homepage: http://audacity.sourceforge.net/

Monday, August 31, 2009

Changing package repository source in Kubuntu 9.04 'Jaunty'

KMenu -> Applications -> System -> Software Management

Click on "Software sources".
Click on the drop box that shows you your current repos. Select "Other".
Now you can select the server you want or click on "Select Best Server" to let the app do it for you.

Monday, August 10, 2009

Flash on linux using Adobe Flex 3.3 SDK

As long as you don't mind using the command line, just download the flex 3.3 SDK, unzip it. The SDK contains both windows and Linux (Unixes) binaries.

The compiler is mxmlc which resides in /bin/mxmlc.

For reading material go to the Adobe documentation page.

Sunday, August 9, 2009

Getting started with Haxe on Linux

Haxe is a interesting language which supports multiple targets. I am currently interested in generating Flash SWF using Haxe.

Here are some interesting resources:
haxe.org -> The official site for Haxe.
www.cactusflower.org/learning-flash-with-haxe -> A well written tutorial.

Saturday, August 8, 2009

Java in Firefox 3.5.2 aka Shiretoko on Ubuntu 9.04 'Jaunty'

As of now it seems that the only way to have Java working on Firefox 3.5.2 is to also install Firefox 3.0.

Doing: sudo apt-get install sun-java6-plugin also gets Firefox 3, and without this package Java does not work in Firefox.

Friday, August 7, 2009

Linux (Ubuntu 9.04 'Jaunty') on a Acer aspire 5738z laptop

Related: Brightness fix.

The laptop cost me 839 Singapore dollars which is equivalent to some 600 US dollars. I thought it was pretty good value.

Specs of the laptop are: Intel Pentium T4200 at 2Ghz, 3 GB of DDR3 Ram, 250GB HDD and Intel GMA4500M video chipset.

I did my install from a USB thumb drive. The thumb drive was created by using a Ubuntu 9.04 livecd and "usb-creator" command that comes on the livecd. After creating the factory restore disks in Vista I got on with the install.

The installation was amazingly painless. The laptop does not display a message on the boot screen on how one can get to the BIOS settings. A little bit of googling revealed that F2 during start of boot will get me there. After changing the boot order in BIOS to boot from USB, I rebooted the machine and Ubuntu's installer started off. After selecting language and such Ubuntu took me to the partitioning tool. I decided to dual boot Vista and Linux, so after setting aside space for linux, some 50GB I let Ubuntu's installer do its thing.

The partitioning and installation went through pretty painlessly and I booted into Linux and have been enjoying my time there. The performance has been good and I am not seeing any issues with the Intel Graphic chipset.

Since I prefer KDE, I switched to that using:
sudo apt-get install kubuntu-desktop (Selected KDM when it prompted me for that).
sudo apt-get remove ubuntu-desktop ( to remove Gnome desktop and free up some space)
sudo apt-get autoremove (To cleanup)

Benchmarks:

Kernel version: cat /proc/version
Linux version 2.6.28-11-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009

Bogomips using cat /proc/cpuinfo
CPU 0: 3989.85
CPU 1: 3989.96

$ glxgears
3884 frames in 5.0 seconds = 776.770 FPS
3937 frames in 5.0 seconds = 787.264 FPS
3913 frames in 5.0 seconds = 782.374 FPS
3951 frames in 5.0 seconds = 790.153 FPS
3948 frames in 5.0 seconds = 789.423 FPS
3966 frames in 5.0 seconds = 793.111 FPS
3960 frames in 5.0 seconds = 791.963 FPS