The newest version of my favorite music player/library program ever has been released – Amarok 1.3! I’ve been using the betas, and I have to say, there are some terrific improvements and it really works great; I love it even more. Do yourself a favor, ditch Juk, Rhythmbox, or whatever you’re using, and switch to Amarok. If you’re using WinAmp or iTunes for Windows, you just have a whole ‘nother set of problems…
Tag Archives: linux
bash script to convert 15fps mjpeg to mpeg-2
This sort of came up in #openvideo on FreeNode, so I figured I should post this conversion script I wrote, in case it comes in handy to anyone else.
#!/bin/sh
# Script for converting my Canon SD110 videos to something usable by Cinelerra.
if [ -z "$1" ]; then
echo "Give me a file, biatch!"
echo "Usage: videoprep.sh filenames"
exit
fi
while [ ! -z "$1" ]; do
if [ ! -e "$1" ]; then
echo "$1 does not exist!"
exit
fi
filename=$(basename "$1" .avi)
lav2yuv +n "$1" | yuvfps -r 30:1 | mpeg2enc -o $filename.m1v
lav2wav -I +n "$1" | mp2enc -o $filename.mp2
mplex $filename.mp2 $filename.m1v -o $filename.mpg
rm -f $filename.m1v $filename.mp2
mpeg3toc $filename.mpg $filename.toc
shift
done
echo "Done!"
exit 0
get rid of that pesky eth1394
For the longest time, I’ve had a problem where this stupid eth1394 module would be loaded and become eth0 instead of my network card (it would take eth1). Today, I was working on getting a DV camera hooked up through firewire and I finally found a solution. Insert this line into /etc/modprobe.conf (for 2.6 kernels):
install eth1394 /bin/true
Yay!
http://chaosengine.net/p5020d says that “for a 2.4 you add the following to /etc/modutils/local then run update-modules: alias eth1394 off”
assign permanent device name to removable media
One of the problems I’ve had with all the removable devices that I use (iPod, SD cards, and external hard drive) is that while Mandrake 10.1 (Mandriva) is generally pretty good about hotplugging them, if I have more than one plugged in, their device name (and Mandriva’s auto-generated mount point) differs depending on the order they are plugged in. Previously, I solved that by always plugging the devices in in a certain order, but that’s less than ideal and quite annoying. Today I ran across this how-to for a USB memory key under RH9 that introduced me to devlabel, which will (hopefully!) allow me to assign permanent device names to my removable devices. Unfortunately, there don’t seem to be any Mandrake RPM’s available nor any previous user who’s set it up. I’m downloading the tarball to see if I can compile it (fingers crossed!). Interestingly, it seems to be developed by Dell (and more friendly promo page).
ADD THE DISK TO DEVLABEL
devlabel attempts to give the same device name to removable media,
wherever they appear on the bus. We want our memory disk to always
appear as /dev/usbdisk1 no matter what USB bus it is on or what other
USB disk might be present.# devlabel printid -d /dev/sda1
S80:XXXXXXXXXXXXXXXXXXXX
# devlabel add -s /dev/usbdisk1 –partnum 1 -u ‘S80:XXXXXXXXXXXXXXXXXXXX’
Created symlink /dev/usbdisk1 -> /dev/sda1
Added /dev/usbdisk1 to /etc/sysconfig/devlabel
gnome, kde, and crack addicts
Ran across this funny, imaginary breakdown of how KDE developers work and live as compared to GNOME developers.
mandrake takes over the world, news at 11
First Mandrake acquires Conectiva and becomes Mandriva, and now it’s just bought some of Lycoris. It’s an acquisitions monster! Actually, I’m happy. I hope all these new purchases translate into some kickass new Mandrake- er, Mandriva releases next year.
amarok, the awesome music player
This is not only my new favorite Linux app, but also by far the best music player I’ve used, period. Amarok has terrific smart playlists, support for autodetecting track information based on musicbrainz fingerprinting, automatic downloading of album cover art from Amazon, an OSD feature to briefly overlay the info of a track as it begins playing, crossfade, song suggestions, automatic lyric download, and iPod support (although I haven’t tested this yet). It’s almost the perfect player.
Some small criticisms: The UI is very good, but a little cluttered in some places due to the number of features and amount of smart information available. It isn’t that bad, and I do have a ton of music, but it would be nice if the program could be sped up a little bit, as it lags a tiny bit sometimes. Could just be my computer and my collection, though. Inline tag editing (clicking a field in the playlist) like JuK’s would be nice, as would adding an item to the right-click menu to auto-detect track information, instead of having to open up the meta tag editor window. Playing music with the aRTs engine was a little bit troublesome at first, but aRTs needs serious help. Remembering what random songs were played, like in iTunes and Rhythmbox, would be great (it works going backwards, but not forwards). It doesn’t appear to have a graphic equalizer, but that’s about the biggest thing I’m missing.
Apparently there is an equalizer, under the Tools menu, that I missed. It is not available for the aRTs engine, however, and is rather limited. Inline tag editing is also in place, but is rather unintuitive – you have to select the song, then shift click on the field you want to change. More usability annoyances/bugs: If you change the album title of a song that is playing and try to download the cover art, it will not work because it is using the old album name. You can’t download cover art in the meta tag editor, only in the cover manager or while the song is playing. I am unable to edit the meta tags of a certain set of my songs, I think it may be due to their complex file names, but I have not confirmed yet.
As you can see, I don’t have any real problems or huge wishes thus far. I’d tried it in the past but it kept crashing on me, first on trying to load my music collection and then on trying to play music using aRTs. This time (after I got all the dependencies installed, grr), it worked perfectly and is playing very well – I highly recommend it.
finicky wireless and failing hard drive
I learned something today:
$ fortune -m LikeThis
(knghtbrd)
%
<Overfiend> Thunder-: when you get { MessagesLikeThisFromYourHardDrive }
<Overfiend> Thunder-: it either means { TheDriverIsScrewy }
<Overfiend> or
<Overfiend> { YourDriveIsFlakingOut BackUpYourDataBeforeIt’sTooLate
PrayToGod }
%
I’m posting from that a Knoppix 3.3 LiveCD on that old ThinkPad 600 I saved from the trash bin. Spent yesterday struggling to get the wireless card – a Netgear MA521 – to get an IP address from the DHCP server. Using Ndiswrapper with the driver they suggest worked great for detecting the card and to get signal and the correct network (according to Kwifimanager), but it just would not acquire the IP for some reason.
On the heels of that, this morning I started getting errors like this one:
end_request: I/O error, dev 03:05 (hda), sector 4432611
hda: read_intr: status=0x5b { DriveReady SeekComplete DataRequest Index Error }
hda: read_intr: error=0×40 { UncorrectableError }, LBAsect=4956834, sector=4432611
What I’ve gathered from newsgroup posts and reiserfsck output is that the hard drive is on its way out, just as the fortune says. I’m running badblocks as suggested by the “Bad block handling in ReiserFS” article in a last-ditch attempt to salvage the drive for a little while longer, but the list of bad blocks is enormous, so I’m fairly certain it’s shot. Bummer. Maybe I can still get it sold on eBay for $200…
On a side note, nothing but nothing is more annoying to me than accidently clicking a button or hitting some keyboard shortcut in the middle of typing a long post and then hitting back only to find that my entire text has been erased because it expired from the cache. Brilliant. I mean, could they not provide some sort of contingency for that, save form data little while longer? Cripes, it’s a royal pain in my butt.
streaming webcam experiments
Still trying to find the ideal Linux webcam application, after trying camorama and most recently w3cam + a homebrew script. Frank started playing around with a streaming cam last night, so I thought I’d give it a shot, since the only reason I hadn’t before was that I couldn’t allow direct connections at home. Anyway, I compiled and installed camserv, a streaming cam app for Linux that I’d run across before. It’s a little old, but it still works great. There is one gotcha when compiling, though. I got an undefined reference to `errno' error, which this thread helped me solve. Apparently it’s some lax coding that newer versions of GCC are more strict about. To fix it, I ran grep -rs "extern int errno" * to find the files with the bad code, then opened them all in kwrite (there’s probably a better way…) and replaced all occurrences with the correct code: #include <errno.h>.
After that, the README file is great for help configuring the program. I added a banner filter to print “themikecam.com” on the image, moved the timestamp to the bottom right, and added “%D” to display the date. Remember to switch the module being used from the default color-switcher test module to video_v4l_qcam and to open up your port of choice (default is 9192) in your firewall. I keep mine pretty tightly closed since I’m apparently connected directly to the net, but I went and opened that one port in shorewall through the Mandrake Control Center.
The last issue I had was that Internet Explorer doesn’t like the streaming JPEGs that camserv produces. Luckily, it comes with a built-in workaround, accessible at http://hostip:9192/singleframe, that outputs a normal JPEG upon request. Apparently Konqueror has an issue with viewing these JPEGs as well, but Firefox/Mozilla/Netscape and Opera work fine. Any Safari users out there? I added a line to my webcam updater javascript so that real browsers can view the actual streaming feed but MSIE and Konqueror are given the singleframe image and updated by Javascript every second.
I still have a few things to figure out to my satisfaction, such as how to deal with the streaming cams when they go off and how to automatically fix a hiccup/drop in the connection. I threw together a quick fsockopen() test so that if Frank’s cam and mine aren’t accessible within seven seconds, it will timeout and output “offline” in place of our images. Previously, the problem I was having was that none of the cams would update until the browser timed out the broken image. In the future, I’d also like to make the cams page fully dynamically customizable, so the user can select what cams he/she wants to view from an index in a sidebar, which would include the realtime online/offline status of every webcam. I’m thinking perhaps a PHP script that outputs an online/offline image, so that I can use a JavaScript similar to my webcam updater to continuously update the status, possibly contained by an iframe. I’m not sure what the performance impact of all this Javascript is, but I’m certainly curious…
bash backup script
Wrote another script today, this time to help me in my weekly backups. I’ve been running rsync as a cronjob to mirror all of my files weekly so I that I have a relatively recent backup in case of system failure or infection. I don’t use RAID because I don’t have the hardware and software RAID would suck resources, but primarily because RAID is meant to protect against hardware failure and to keep the system running, where I am more concerned with viruses or – more likely – mucking up my own system. With RAID the errors would be on all the drives and then I’d be screwed.
Anyway, I used to be backing up an 80gb internal IDE drive to a second one, but now I have a 160gb drive in an external enclosure, so now I’m backing up both internals to the external via Firewire. The problem that can arise with an external hard drive (as I discovered the first time I tried this) is that if for some reason it is not mounted (power is off, cable is disconnected, firewire module is throwing a fit), just running rsync will copy the entire drive onto itself in a folder where the mount should be. At least until it’s completely full and the system dies. Which is what happened to me. So I wrote a Bash script to check if the drive is mounted, attempt to mount it if it’s not, and then either run rsync to backup or exit with an error.
#!/bin/bash
BACKUPHD='/external'
EXCLUDE='/home/michael/rsync.exclude'
backup() {
echo -e "Running rsync to backup to $BACKUPHD\n"
rsync -ac --delete --exclude-from=$EXCLUDE / $BACKUPHD
}
if grep $BACKUPHD /etc/mtab
then
backup
exit 0
else
echo "Backup drive not mounted! Attempting to mount... "
if mount $BACKUPHD
then
echo -e "Success!\n"
backup
exit 0
else
echo -e "Failed!\n"
exit 1
fi
fi
exit 0
And the crontab for every Sunday at 3am:
# Backup
0 3 * * 0 /home/michael/sysutils/backup.sh