Thursday, March 29, 2007

subversion through a proxy

In order to use subversion (svn) behind my corporate firewall, I was able to edit the .subversion/servers file to point subversion at my locally running ntlmaps proxy. You may remember I mentioned ntlmaps as a proxy for yum late last year (http://cacasodo.blogspot.com/2006/09/yum-through-proxy.html).

Our shop is Microsoft-based, so I edited the following lines configured in the "~/.subversion/servers" file. The generic example is:
[global]
# http-proxy-exceptions = *.exception.com, www.internal-site.org
# http-proxy-host = defaultproxy.whatever.com
# http-proxy-port = 7000
# http-proxy-username = defaultusername
# http-proxy-password = defaultpassword


In my world, the first two lines point to the local ntlmaps proxy and the last two are used for user credentials:
http-proxy-host = localhost
http-proxy-port = 5865
http-proxy-username = (NT username)
http-proxy-password = (NT user password)


Neato!

Tuesday, March 27, 2007

the always tricky SMB mount syntax

I always forget, so here it is:
mount -t smbfs /// / -o username=/,password=

for example:
mount -t smbfs //server/E$ /mnt/test -o username=gagazote/mydomain,password=hackth1s

ah well..I'm not that bright anyway.

Update, 9/12/07:
Since the smbfs switch is being deprecated, probably a better way to do this in the future is to use the "-t cifs" switch described here:
/2007/09/mounting-windows-file-share-in-fedora.html

Saturday, March 17, 2007

client side imagemaps

The imagemaps on a couple of my sites were sorely out of date, so this article really helped out:
http://www.ihip.com/cside.html

Friday, March 16, 2007

creating a transparent favicon.ico with Gimp

I'm always forgetting the steps to do this properly. Here you go:
1) open a favorite image that you'd like to turn into a favicon to appear in your browser's location bar
2) click Image->Mode->RGB
3) using the erase tool, erase any areas of the graphic that you'd like to be transparent
4) using Image->Scale, resize the image to 32x32, the proper size for a favicon
5) first save the file as a GIF
- Gimp will popup a dialog that says "GIF can only handle grayscale or indexed images"
6) select * Convert to Indexed using default settings
7) click Export
8) save a copy as .ico. It will give you a number of choices for bits/pixel:
1 bpp, 1 bit alpha, 2-slot palette
4 bpp, 1 bit alpha, 16-slot palette
8 bpp, 1 bit alpha, 256-slot palette
32 bpp, 8 bit alpha, no palette

Choose 4bpp. However, I have seen with some images that 8bpp needs to be used.
9) upload to your website and enjoy!

Sunday, March 04, 2007

ripping a dvd with acidrip

Intro article
Before you get started, here is an excellent introductory article on how to use acidrip:
http://www.linuxjournal.com/article/9124

Install
Here are the quick steps to the install. As my distro is fedora, you'll need to have the fedora and freshrpms repos in /etc/yum.repos.d. Also, the perl rpms and Gtk2/Glib perl programs listed are from http://untrepid.com/acidrip/
yum install gtk*
yum install lsdvd
rpm -ivh /root/Desktop/perl-ExtUtils-Depends-0.205-1.fc4.noarch.rpm
rpm -ivh /root/Desktop/perl-ExtUtils-PkgConfig-1.07-1.fc4.noarch.rpm
tar zxvf Gtk2-1.143.tar.gz
tar zxvf Glib-1.144.tar.gz

Ripping
You can burn to avi or mpg container format with a number of codec options. Taking the defaults for lavc or xvid codecs yielded a video with correct audio, but thick, green lines across the bottom half. Two-pass lavc ended up with the same green lines. The "copy" function worked without green lines, but the resultant avi file was too big (3.5GB). Outputting to MPG using lavc, xvid or two pass also shows green lines, but using "copy" yielded a smaller (2.5GB) file.

Playback
It is interesting to note that xine, mplayer and ffplay could not play the avi. However, ffmpeg was able to re-encode the avi file. The mpg was playable in all players, but all had stutter and lost audio sync if forward was pressed during playback.

Re-encoding
Since the filesize was huge, I decided to re-encode in order to fit on a standard CDROM. Re-encoding the mpeg using FFMPEG -target dvd outputted to a second, smaller mpeg was a disaster: the file did not play properly (mostly audio sync problems) in any Linux media players. Therefore, I am going to reencode the avi using FFMPEG. Rendering using FFMPEG to DVD is pretty bulletproof: a video rendered with FFMPEG plays in almost all my Linux media players; however, FFPLAY seg faults, which is strange as it is the companion player to FFMPEG.

Re-encoding using FFMPEG bitrate (-b) switch
I took the resulting file and used ffmpeg to shrink the size of the file by outputting it to a lower quality bitrate mpeg2. This was done by using ffmpeg's bitrate (-b) switch:
ffmpeg -i charade.avi -target dvd -b 3000 charade.mpg

This cut down the file size by about 33%.

I then lowered the bitrate further to 1500. The resulting file size was a little more than 1/3 the original and still looked decent. Finally, I lowered the bitrate to 750. The resulting file was about 1/4 the original size, but started to show compression artifacts. That was the limit on my tolerance for crappy looking video, so I stopped there.

Summary
bitrate: file size reduction
3000: 33%
1500: 65%
750: 75%

I will continue to experiment.

3/10/2007 update
Re-encoding using FFMPEG Qscale (-qscale) switch
I've experiment a bit more. Instead of using -b as a switch to ffmpeg, I used -qscale. Qscale is short for quality scale. The scale ranges from 1 to 30, with one being the highest quality audio and video output with the least reduction in file size and 30 being the lowest quality output with the most reduction in file size. My goal was to reduce a DVD from 3.5GB (avi) to an mpeg less than 700MB in order to fit on a CDROM. I hoped the re-encode would occur without appreciable quality loss in the audio or video, but I wasn't sure.

By testing a number of Q factors ranging from 5 to 10 to 15, I was able to reduce the original 3.5GB avi file to 628MB without a terrible amount of compression artifacts. There was a loss of video quality, but not to the extent that the video was unwatchable. The audio, however, was still good and the size of the file had been reduced by almost 5/6ths! Excellent! Here is the command I used:
ffmpeg -i charade.avi -target dvd -qscale 15 charade.mpg

In the final analysis, it seems the easiest way to use acidrip is to:
1) rip DVD to avi using copy feature
2) if needed, reduce file to CDROM size using FFMPEG's Qscale parameter

that's it for now..
Feel free to drop me a line or ask me a question.