hacks
i'm not much of a hacker, can't program much more than html and simple shell scripts. i do know my way around a bsd system and i love my command prompt. as you may have gathered i have several freebsd systems running 24/7, each of which of course has their own software "learning opportunities".
for example, getting a hp printer for windos to work nicely with cups, or transcoding movies for mobile phones. a lot of this is intended for personal use, so i guess i'll just be copying my numerous scraps of paper scattered around "mission control".
magnet links
i had been using the azureus auto start torrent directory setup, but as azureus also accepts magnet links, used by mininova.org and others, i decided i wanted gnome to pass these links to my bittorrent client automatically. here's how.
as the user using gnome type this in a console:
# gconftool-2 -s -t string /desktop/gnome/url-handlers/magnet/command "/usr/local/bin/azureus %s"that's it. you only need to do this once.
# gconftool-2 -s -t bool /desktop/gnome/url-handlers/magnet/need-terminal false
# gconftool-2 -s -t bool /desktop/gnome/url-handlers/magnet/enabled true
try a magnet link and check to see if the torrent has been added. you can configure azureus to accept magnet links and start downloading automatically. magic.
hp printers and cups
this one took a long time to get working. i guess i should rtfm more often...
the device in question is a hp deskjet 3520, but this should work for most printers supported by cups. anyway, the quick and dirty walk-through.
install the following ports:
print/cups-basereasonably logical i should think. although i don't have a clue as to which options i chose during the builds. i guess defaults should get you pretty far...
print/cups-lpr
print/hpijs
the print/hpijs port includes drivers for a gazillion hp printers.
next is something that took me enough time to want to post it somewhere, even if only for myself.
type this in a console:
# mv /usr/bin/lp /usr/bin/lp.origwe first made a backup of the original executables used for printing and then symlinked the version needed by cups to the location cups will actually look. trust me, it was the incantation i was looking for.
# mv /usr/bin/lpq /usr/bin/lpq.orig
# mv /usr/bin/lpr /usr/bin/lpr.orig
# mv /usr/bin/lprm /usr/bin/lprm.orig
# ln -s /usr/local/bin/lp /usr/bin/lp
# ln -s /usr/local/bin/lpq /usr/bin/lpq
# ln -s /usr/local/bin/lpr /usr/bin/lpr
# ln -s /usr/local/bin/lprm /usr/bin/lprm
you can prevent this being reverted when rebuilding/updating your system by adding:
CUPS_OVERWRITE_BASE=yesto your '/etc/make.conf'.
NO_LPR=yes
fire up cups and use the web interface.
transcoding to 3gp
we'll need ffmpeg-0.4.9-pre1 which might be found in multimedia/ffmpeg. and we need the port, not the package. let's start with a hack i found on bsdforums.org.
type this in a console:
# cd /usr/ports/multimedia/ffmpegclean up with:
# make extract patch
# make configure
# echo "AMR_NB=yes" >> work/ffmpeg-0.4.9-pre1/config.mak
# echo "#define AMR_NB 1" >> work/ffmpeg-0.4.9-pre1/config.h
# wget -P lib/ http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip
# unzip lib/26104-510.zip -d lib/amr_float
# rm lib/26104-510.zip
# unzip lib/amr_float/26104-510*.zip -d lib/amr_float/
# rm lib/amr_float/26104-510*
# cp -r lib/* work/ffmpeg-0.4.9-pre1/libavcodec/
# make install
# make cleanthe hack is to include amr audio, the standard followed by many mobile phones. later versions of ffmpeg may (or may not) include amr audio with a standard install.
# rm -r lib
and to finally transcode a feature film for you phone, try this incantation (and go and grab a beer):
# ffmpeg -i input_file.mpg -s qcif -r 12 -ac 1 -ar 8000 -ab 11 -acodec amr_nb -b 30 /path/to/output_file.3gpthis produces films of 12 fps, 176x144 (qcif), 8kHz 11kbps mono audio. small blocky films. ffmpeg accepts nearly everything you throw at it, not just mpeg's, so you can convert any xvid "dvd backup" you might have...
