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