Test Driving Linux/Music and Videos
The personal computer is fast becoming the hub of our digital lifestyle. With the emergence of high-speed Internet access, MP3 music files, streaming video, and P2P file sharing, the home computer is often more of an entertainment device than a place to balance your checkbook or write a school report.
A computer running Linux can be a great multimedia machine for your home. It is capable of playing DVDs and most forms of video files, listening to every conceivable type of music format, and creating and editing video and audio content. Many of the people who write programs for Linux are multimedia nuts themselves, so you can rest assured that the capabilities of multimedia software on Linux are second to none.
This chapter covers the common multimedia tasks you'll want to accomplish on your computer. However, because you're running Linux from the Move CD, you won't be able to try out some of the things I describe in this chapter unless you have more than one CD or DVD drive in your computer. (Obviously, if you have only a single CD drive, you can't listen to or burn a CD because the Move CD is already in the drive.) So instead of trying to work around these limitations, I'll just describe the programs and not worry about whether you can actually test out the features (though of course I'll let you know if there is an easy way to do so).
If you do have two optical drives, boot your machine with Move in a non-burning drive, i.e., a CD or DVD reader. This leaves the burner device free to make a CD.
Playing Music Files
Besides playing games (which I'll get to in the next chapter), the most common entertainment purpose computers are put to is playing music. Linux has dozens of programs for playing MP3 files and nearly every other digital music format.
The application for listening to music CDs inMove is called KsCD. To use it, all you have to do is pop a music CD into the drive, and the KsCD application will load automatically and begin playing your music (Figure 4-1). KsCD is configured to look up the album on the Internet and pull down a list of the album's songs. You have the typical buttons to play, fast forward, rewind, change tracks, pause, and stop. To exit the application, select Extras→ Quit.
If the KsCD program did not automatically start when you inserted a CD, it is probably because Move is watching the wrong CD drive. When your computer has two CD drives, one is considered the primary and the other the secondary; Move is configured to play CDs from the primary drive. To solve this problem, you can either reboot with Move in the other drive, or tell the KsCD program which drive to read from. To do this, open KsCD manually by clicking K Menu→ Enjoy music and video→ Listen to audio CDs. Inside of KsCD, click Extras→ Configure KsCD. At the bottom of the configuration window that appears, look for the field labeled CD-ROM Device containing the entry /dev/cdrom. Add a 1 to the end of this entry (/dev/cdrom1) to specify your second CD drive, click OK, and you should now be able to play CDs from that drive.
MP3s and other digital music files are played with the Totem multimedia program (Figure 4-2). Simply double-click an MP3's icon in Konqueror, and Totem will load and begin playing your music. Of course, at the moment this is easier said than done—the Move CD doesn't actually have any MP3 files on it. There are a few solutions to this problem. If you have a USB key, you can put a few of your MP3 files on it from within Windows, and then access those files by opening your Home directory in Konqueror. Or, if you have music files stored on your Windows hard drive, you can access them using the method described at the end of Chapter 3.
Totem's buttons are similar to those of a CD player and are used to control your digital music files. When you change tracks in Totem, you are actually moving through your playlist , which is simply a list of songs you select from your collection. This can be a random selection of songs you choose on the spur of the moment, or you can create a playlist and save it so you can use it again and again. You can create playlists to play back albums you have ripped and encoded from CD (many ripping programs do this automatically), or playlists for all the music you like to listen to on a rainy day, or at night, or while driving in Kansas. You bring up the playlist window in Totem by clicking the fourth button in the lower left of Totem's main window. From here you can add and remove music files from your playlist, move files within the playlist, or save the playlist so you can use it later.
Totem is not the only music playback application for Linux; there are several other popular ones as well. My favorites are XMMS and amaroK. XMMS, shown in Figure 4-3, looks and acts a lot like the popular Windows program WinAMP. You can use XMMS to listen to CDs and to play back Ogg files, as well as MP3, WMA, FLAC, and several other audio formats. XMMS has been around for years and is a very mature program; it comes with a playlist manager and a graphic equalizer, and there are dozens of plug-ins available that enhance its features in several ways. Visit http://www.xmms.org for more details.
My new favorite music program is amaroK (Figure 4-4). This program provides a lot of features in a cool-looking interface. I like that it can look up my album on the Internet and pull down images of the album cover, that it remembers which songs I've listened to and keeps statistics on my listening habits, and that it can automatically create playlists of the songs I never listen to as well as the songs I listen to most. (It's quite interesting to listen to a collection of songs you haven't heard in a while.) The newest version of amaroK even looks up song lyrics for you! Check out http://amarok.kde.org for more information on this neat program.
Watching Video Files
Five years ago most computers were not fast enough to watch a DVD without using special video chips. Today, the typical home computer has enough processing power to run several videos at once while ripping songs off a CD and searching for extraterrestrial life when it gets bored (http://setiathome.ssl.berkeley.edu). You can even turn your computer into a TiVo-like device using software included with video capture cards or high-end graphics cards.
But even though your hardware is powerful enough for almost any video chore, the software to actually watch videos isn't always as capable as you'd like. The reasons for this are many and varied, but I'll point out one reason that applies to Linux particularly.
As discussed in the previous section, multimedia files are encoded using special software that allows you to create small files while still maintaining most of the quality of the original media. To play back the encoded video, you use a special program called a decoder . There are dozens of video encoders and decoders, but most of them are not open source and cannot be distributed without paying a license fee. As a result, Linux is limited in its ability to play back some formats that can be easily played on Windows or a Macintosh, for example, the latest versions of Windows Media Videos (.wmv files) and some types of QuickTime videos (.mov files).
In addition to playing MP3 and Ogg music files, Totem plays back videos. Think of it as the Linux equivalent of the Windows Media Player, your one-stop program for almost all of your multimedia needs. To play a video in Move, just double-click its file icon. If Totem can handle it, it will open the file automatically and begin playing. If you can't see the video, try resizing the window vertically, as sometimes the video window portion of the player is hidden.
The Totem window itself looks exactly the same as it does when playing music, so there are no surprises here. Press F to toggle between full screen and windowed video. Another neat thing you can do is to take a screenshot of your video by going to Edit→ Take Screenshot. Unfortunately, this works only while the movie is playing, not paused, so you have to time your selection just right.
The Totem application is actually just a pretty GUI frontend for the open source video playing program xine—the real work of playing the video files is being done by xine and the codecs (video decoders) that it loads. There are several frontends for xine; Figure 4-5 shows another popular one.
Ripping and Encoding Music Files
MP3 files on the Internet come from the hard drive of some person who ripped the music from CD, encoded it in MP3 format, and uploaded it to the Web using any one of a dozen methods for sharing files. It is because of this file sharing on the Internet that MP3 has become synonymous with digital music files.
Besides being able to play back MP3 files, Linux can also be used to create them. Several open source encoders are capable of creating MP3 files; one of them, LAME, is well known even in the Windows world. Many Linux users prefer to use Ogg Vorbis files instead of MP3, because OGG is an open format that produces smaller and better quality audio files than MP3.
There are dozens of tools on Linux that can be used to encode audio files; the one on Move is called KAudioCreator. To launch it, click K Menu→ Enjoy music and video→ Rip audio CDs. You'll probably be greeted with one or two warning windows. The first one complains that "No encoder has been selected"; the second one tells you that "No tracks are selected to rip." Just click OK to close both these boxes.
To rip a CD, launch the KAudioCreator program and insert a CD into the drive. In a few seconds a list of your songs, complete with track titles, should appear in the main program window, as shown in Figure 4-6. Move has configured the KAudioCreator program to connect to the CDDB database on the Internet to look up the album information. If the main window displays a list of generic tracks, either your Internet connection isn't working, or the program couldn't find your album information on CDDB.
If there is a successful lookup in CDDB,Move has also configured KAudioCreator to automatically start ripping your CD. This is a very bad default behavior for a live CD setup, because each song you rip will take up space on your USB key, and in a matter of minutes the key could be completely full. You should stop the jobs immediately by clicking on the Jobs tab and clicking Remove All Jobs. Not only that, but you'll have to confirm you want to remove each job.
Even if I'm not running a live CD, I still find automatic rips annoying, as I may want to rip only a few songs or change my encoder before ripping. To turn off automatic ripping, go to Settings→ Configure KAudioCreator→ CD and uncheck the box next to "Automatically rip all songs upon a successful CDDB retrieval." If you choose, you can also disable automatic lookups in CDDB.
All ripped and encoded songs take up space. If you have a USB key, they are written to the key; otherwise, they are put in your computer's RAM. If you rip and encode too many songs, you'll quickly use up all the space on the USB key or in your RAM. To avoid running out of memory, don't rip more than two or three songs at a time (depending upon how large your USB key is), and delete your files before you rip more. (Of course, these limitations don't exist when you have Linux installed on your hard drive.)
By default, KAudioCreator will encode your music files in the Ogg Vorbis format. Since many portable music players cannot decode Ogg files, MP3 may be a better choice for you. To change KAudioCreator's default encoder, go to Settings→ Configure KAudioCreator→ Encoder, click an encoder from the list at the top, and click Apply. The LAME encoder should be used to encode MP3 files. Choosing "Leave as a wav file" tells KAudioCreator to just rip the CDs, not actually encode them. You can use these WAV files, which have the same quality as the source CD, in a CD burning program to create your own mix CDs. FLAC is a lossless encoder that produces larger files than Ogg or MP3 but smaller than WAV, and with perfect CD quality.
There are some other items of interest on this configuration screen. You can use the Encoded File Location field to enter a command that will determine the naming convention for your file and how it will be stored on your hard drive; for example, it can be stored in a folder named for the album, which is inside another folder named for the artist. The syntax for this command is not particularly complicated, but you may want to click the Wizard button to help you create it. The default should be fine for most people. You also have the option to create an album playlist when you rip the CD. This is particularly useful if you like to put all the music files for one artist in a single directory, as it allows you to play the album by selecting a single playlist file, instead of selecting the songs on an album individually.
It's now time to choose which files to rip and encode. Back in the main window, either click the Select All Tracks button, or click each track you want to rip. A check appears in the Rip column for each song you select. Once you've made your selections, click the Rip Selected Tracks button. The songs you selected are immediately queued up, and the program begins the ripping process. A window pops up to tell you that the jobs have started. Click on the Jobs tab to see the items you are ripping.
That's how the program would work if you were running Linux from the hard drive; now I'll tell you how you can use it within the limitations of the Move CD. As mentioned back in Section 4.1, if your computer has two CD drives, one is considered the primary one and the other the secondary one. KAudioCreator is configured to look for music tracks on the primary drive; if that's where your music CD is, then you're all set. If not, you can reboot, this time with Move in the other CD drive, or you can go through the same process you did with KsCD to make it see the other drive. Open KAudioCreator without a CD in the drive, and on the main screen click on the entry /dev/cdrom in the Device drop-down list. Add a 1 to the end of the entry to make the program see the second CD drive, then close the program and restart it. KAudioCreator should now be able to detect a CD in this drive, and you can rip some music.
The Move CD comes with the K3b CD burning application, regarded by many Linux users as the best CD burning application available on Linux. Some people find it to be even easier to use and more powerful than the popular Nero burning software on Windows. I've used this program many times to create master copies of the CDs that go into some of O'Reilly's books. To launch K3b, go to K Menu→ Administer your system→ Burn CDs-DVDs. When it starts up, K3b should tell you which CD burners it has found. Just click OK to clear this window.
The main K3b program window, shown in Figure 4-7, is divided into three panes. The top left pane presents a typical hierarchal view of your filesystem, and the pane in the top right shows you the files and directories in the selected folder. The bottom half of the screen changes depending upon the actions you are performing. When the program first starts up, this area displays several large buttons that let you start a new project. In this section I'll show you how to burn a data CD and how to make a copy of a CD. As I mentioned previously, you may not be able to follow along if you have only a single CD drive, so I'll just describe how the program would behave if it were installed on your hard drive.
Creating a Data CD
One of the most common (and crucial) uses for a CD burning tool is to back up your important files. K3b makes it easy to create archives of your data on a CD or DVD.
To burn a data CD, click the icon called "New Data CD Project" in the main K3b window. Next, select the files you want to add to your CD by dragging a file or folder from either of the top panes and dropping it onto either of the bottom panes. As you add each selection, a bar along the bottom of the screen will tell you how much space your files are taking up and how much space is still available on the CD. This makes it easy to fit the maximum amount of data on each CD.
When you're done selecting files, click on the big Burn button in the lower right corner. This brings up a new window that presents a lot of options to control your CD burning session (Figure 4-8). The default selections are usually fine, so I'll just tell you about a few of your choices.
- Only Create Image
- Checking this option allows you to create an image file instead of burning a CD. An image file, usually called an ISO, can later be used to burn a CD with just a few clicks, and is a perfect way to share the contents of a CD over the Internet. For example, the Linux distributions you download for free from the Internet come as ISO images.
- The options for multisession on the Settings tab allow you to burn data to a CD now and add more data to it later. If you check off the "Start multisession" option, you'll be able to add more data later by checking "Continue multisession." When you are ready to finish the disk, check off "Finish multisession" for your final burn session. If you don't check off the "Start multisession" option, the CD will be "fixed" when it's finished burning, and you can't add more data.
- Volume Desc
- This tab controls the metadata you want on the CD you burn. In most cases I leave this alone, but if you are burning a master CD for work that will be copied and distributed, you'll want to enter information appropriate to your business and the project.
And that's pretty much all there is to burning a data CD. Just click the Burn button and watch K3b's progress.
Copying a CD
Another common task for a CD burner is to copy a CD, for example, to make copies of a Linux distribution. In most cases, copying a Linux distribution and giving it to a friend is not only legal, but actually encouraged. You can freely make copies of the Move CD in the back of this book and give it to anyone who is interested in trying out Linux. I also like to make copies of all of my music CDs. I keep the originals safe in the house, and use the copies in the car. That way, if the CDs in the car are ever lost, stolen, or damaged, I've still got the originals in my house.
To start a CD copy session, either click the Copy CD icon at the bottom of the screen or select the option from the Tools→ CD menu. Either way, a window pops up that presents you with a few choices (Figure 4-9).
At the top you can select the device to copy from (the reader device) and the device to copy to (the burner device). If your machine has two burning devices you might accidentally make the wrong choices here, but don't worry—your burner won't try to copy a blank CD onto a music CD. At the bottom of the screen you can choose how many copies you want to make. When you're ready to make your copy, just click the Start button.
It's even possible to make a copy of a CD if you have only one CD drive, although obviously that drive needs to be a burner. K3b can create a temporary image of the source CD first, then allow you to exchange it with a blank CD, and then continue the burn using the image as the source. Don't try this with Move, however; the temporary image will probably be larger than the space on your USB key.
As you can see, K3b is a useful and versatile program. You can use it to create your own custom mix CDs, burn a data DVD, or even create your own video DVDs and CDs that can be played in a DVD player or on your computer.