Multimedia Applications - Desktop Ubuntu - Ubuntu Unleashed 2017 Edition (2017)

Ubuntu Unleashed 2017 Edition (2017)

Part II: Desktop Ubuntu

Chapter 6. Multimedia Applications


In This Chapter

Image Sound and Music

Image Graphics Manipulation

Image Using Digital Cameras with Ubuntu

Image Burning CDs and DVDs in Ubuntu

Image Viewing Video

Image References


The twenty-first century has become the century of the digital lifestyle, with millions of computer users around the world embracing new technologies, such as digital cameras, MP3 players, and other assorted multimedia gadgets. Whereas 10 years ago you might have had a small collection of WAV files scattered about your Windows installation, today you are more likely to have hundreds, if not thousands, of MP3 files scattered across various computers. Along with video clips, animations, and other graphics, the demand for organizing and maintaining these vast libraries is driving development of applications. Popular proprietary applications such as iTunes and Google’s Picasa were once coveted by Linux users, but open-source applications now exist that provide real alternatives, and for some people these are the final reasons they need to move to Linux full time.

This chapter provides an overview of some of the basic multimedia tools included with Ubuntu. In this chapter, you discover how to create your own CDs, watch TV, rip audio CDs into the open-source Ogg audio format for playback, as well as manage your media library. You also find out about how Ubuntu handles graphics and pictures and more.

Sound and Music

Linux had a reputation of lacking good support for sound and multimedia applications in general. However, great strides have been made in recent years to correct this, and support is now a lot better than it used to be. (It might make you smile to know that Microsoft no longer supports the Microsoft Sound Card, but Linux users still enjoy support for it, no doubt just to annoy the folks in Redmond.) UNIX, however, has always had good multimedia support, as David Taylor, UNIX author and guru, points out:

The original graphics work for computers was done by Evans and Sutherland on UNIX systems. The innovations at MIT’s Media Lab were done on UNIX workstations. In 1985, we at HP Labs were creating sophisticated multimedia immersive work environments on UNIX workstations, so maybe UNIX is more multimedia than suggested. Limitations in Linux support doesn’t mean UNIX had the same limitations. I think it was more a matter of logistics, with hundreds of sound cards and thousands of different possible PC configurations.

That last sentence sums it up quite well. UNIX had a limited range of hardware to support; Linux has hundreds of sound cards. Sound card device driver support has been long lacking from manufacturers, and there is still no single standard for the sound subsystem in Linux.

In this section, you learn about sound cards, sound file formats, and the sound applications provided with Ubuntu.

Sound Cards

Ubuntu supports a wide variety of sound hardware and software. Two models of sound card drivers compete for prominence in today’s market:

Image ALSA, the Advanced Linux Sound Architecture, which is entirely open source

Image OSS, the Open Sound System, which offers free and commercial drivers

Ubuntu uses ALSA because ALSA is the sound architecture for the linux kernel, starting with the 2.6 series, all the way to the current the 4.x series. OSS might still be found here and there, but it is no longer in widespread use and should be considered deprecated.

ALSA supports a long list of sound cards. You can review the list at www.alsa-project.org/main/index.php/Main_Page if you are interested, but Ubuntu detects most sound cards during the original installation and should detect any new additions to the system during boot. To configure the sound card at any other time, use the sound preferences graphical tool by searching the Dash for sound.

In addition, Ubuntu uses an additional layer of software called PulseAudio. PulseAudio is a sound server and acts as a mediator between the various multimedia programs that have sound output and the ALSA kernel drivers. Over the years, there have been many different sound servers used in Linux, each with different strengths, usability issues, and levels of documentation. These various sound servers have often been forced to run side by side on the same computer, causing all sorts of confusion and issues. PulseAudio aims to replace all of them and work as a single handler to accept output from applications that use the APIs for any of the major sound servers already in use, such as ESD, OSS, GStreamer, and aRts, and route the various output streams together through one handler. This gives several advantages, including the ability to control the output volume of various programs individually.

PulseAudio is still quite young, and its full potential has not yet been realized; however, it has matured over the last several releases and is better and more powerful than ever. Although there were stability issues and complaints in the first release that included PulseAudio, those don’t seem to be a problem anymore except in unusual hardware combinations and special cases, and more and more features have been implemented. For more information about PulseAudio, see www.pulseaudio.org/.

Adjusting Volume

Ubuntu offers a handy utility that you can use to control the volumes for various outputs from your computer. For a simple master volume control, just click the speaker icon in the top-right corner of the screen and move the slider left or right, as shown in Figure 6.1.

Image

FIGURE 6.1 Control the master volume level with the volume slider.

Alternatively, you can control all the output volumes for the system to make sure that you have set everything to your taste, as shown in Figure 6.2. To access the volume control, left-click the speaker icon and select Sound Preferences.

Image

FIGURE 6.2 Use the volume control to manage volume settings for all your sound output devices.

Sound Formats

A number of formats exist for storing sound recordings. Some of these formats are associated with specific technologies, and others are used strictly for proprietary reasons. Ubuntu supports several of the most popular sound formats, including the following:

Image RAW (.raw)—More properly known as headerless format, audio files using this format contain an amorphous variety of specific settings and encodings. All other sound files contain a short section of code at the beginning—a header—that identifies the format type.

Image MP3 (.mp3)—A popular, but commercially licensed, format for the digital encoding used by many Linux and Windows applications. MP3 is not supported by any software included with Ubuntu by default, but you can easily install software that supports MP3 later. In fact, the first time you try to play an MP3 file, Ubuntu asks whether you want to install the codec needed and walks you through the whole, simple process.

Image WAV (.wav)—The popular uncompressed Windows audio-visual sound format. It is often used as an intermediate file format when encoding audio.

Image Ogg-Vorbis (.ogg)—Ubuntu’s preferred audio encoding format. You enjoy better compression and audio playback and freedom from lawsuits when you use this open-source encoding format for your audio files.

Image FLAC (.flac)—This is a lossless format popular with audiophiles. The name stands for Free Lossless Audio Format and it is a compressed format, like MP3, but does not suffer from any loss of quality.


Note

Because of patent and licensing issues, Ubuntu does not by default support the MPEG, MPEG2, and MPEG3 (MP3) file formats. Although we cannot offer any legal advice, it appears that individuals using MP3 software are okay; it is just that Ubuntu cannot distribute the code because of how the code is licensed.

You can also enable the MP3 codec within Ubuntu by downloading a plug-in for GStreamer, the GNOME audio system. You do this by installing the gstreamer0.10-plugins-ugly package, which enables the MP3 codec in all the GNOME applications. Even better, there is a package called ubuntu-restricted-extras that you can install that enables all the major formats you are ever likely to encounter. You can find the package in the repositories, and, as mentioned earlier in the chapter, Ubuntu also recommends specific packages as needed when you attempt to use a file type that does not currently have an installed codec package. It really is that easy to deal with multimedia formats in Ubuntu.


Ubuntu even includes software in the repositories (such as the sox command used to convert between sound formats) so that you can more easily listen to audio files provided in a wide variety of formats, such as AU (from NeXT and Sun), AIFF (from Apple and SGI), IFF (originally from Commodore’s Amiga), RA (from Real Audio), and VOC (from Creative Labs).


Tip

For an introduction to audio formats, check out the list of audio file formats at www.fileinfo.com/filetypes/audio, with links to detailed information for each.


Ubuntu also offers several utilities for converting sound files from one format to another. Conversion utilities come in handy when you want to use a sound in a format not accepted by your current application of choice. The easiest one to use is also the easiest to install. Install the soundconverter package and then look for the application in the menu at Applications, Sound & Video, and Sound Converter. It has a clear graphical interface and easy-to-understand configuration options.

Listening to Music

If you’re anything like us, you might be a huge music fan. One of the downsides of having a fairly large music collection is the physical problem of having to store so many CDs. Wouldn’t it be great if you could pack them all away somewhere, yet still have access to all the music when you want it? Some manufacturers experimented with rather bulky jukeboxes that stored 250 CDs at once. The main downside with that was that finding a particular piece of music could take hours, having to cycle through each CD in the hope that it would match your mood.

Fortunately for us, Ubuntu is fantastic at working with CDs, even enabling you to rip your entire CD collection into a vast searchable music library, letting you quickly create playlists, and enabling you to create your own customized CDs. Getting started couldn’t be easier, mainly because Ubuntu comes preconfigured with everything you need.

Rhythmbox

Rhythmbox is a useful application that plays CDs if you insert an audio CD into your computer. It also attempts to obtain information about the CD from the Internet. If it’s successful, you see the name of the CD appear in Rhythmbox.

When you’re ready to play your CD, click the name of the CD under the Devices section and then click the Play button. You can also define whether the CD should repeat itself until stopped or whether you want to shuffle the music (randomize the playlist).

Of course, just listening to your CDs doesn’t really change anything; Rhythmbox acts like a regular CD player, enabling you to listen to specific tracks and define how you want to listen to your music by using playlists or sorting it by artists. The real fun starts when you click the Copy to Library button on your toolbar. Rhythmbox starts to extract, or rip, the audio from your CD and store it within the Music directory under your /home directory.

Depending on the speed of your optical drive and the power of your computer, the ripping process can take up to 15 minutes to complete a full CD. As it goes along, Rhythmbox automatically adds the files to your media library, which you can access by clicking the Music button on the left side of the Rhythmbox screen, as you can see in Figure 6.3.

Image

FIGURE 6.3 Rhythmbox displays a list of the music you have available.

Within the Rhythmbox interface, you can easily browse through the list of artist names or album titles, which affects the track listing that appears at the bottom of the screen. The numbers after each artist and album tell you how many tracks are assigned to that specific entry, giving you a heads up before you click them. Double-clicking any entry automatically starts the music playing. So, for example, double-clicking an artist’s name causes the music tracks associated with that artist to start playing. When a track starts to play, Rhythmbox automatically attempts to retrieve the CD artwork, which it then displays in the lower-left corner of the screen.

There’s a lot more that you can do with Rhythmbox, including download and listen to podcasts. A good place to start is the Ubuntu UK podcast at http://podcast.ubuntu-uk.org/. All you have to do is click an RSS link for the feed on that page, copy the link URL, and go to Rhythmbox. There, press Ctrl+P, or go to Music, New Podcast Feed, paste the link into the field, and click the Add button. Rhythmbox then contacts the server and attempts to download the most recent episodes of your chosen podcast.

Banshee

Banshee (Figure 6.4) is another music application that can handle ripping and playing back music, download cover art, sync with portable players, and can even play video.

Image

FIGURE 6.4 Banshee gives you a neat interface to browse through your music collection.


Getting Music into Ubuntu with Sound Juicer

A handy utility that is included with Ubuntu is Sound Juicer, found under Applications, Sound & Video as the Audio CD Extractor. Sound Juicer automatically detects when you install a CD and attempts to retrieve the track details from the Internet. From there, it rips the CD tracks into Ogg files for storage on your file system. You can see Sound Juicer in action in Figure 6.5.


Image

FIGURE 6.5 Create your own digital music collection with Sound Juicer.

Graphics Manipulation

Over a short period of time, digital cameras and digital imagery have become extremely popular—so popular that some traditional film camera manufacturers are switching solely to digital. This meteoric rise has led to an increase in the number of applications that can handle digital imagery. Linux, thanks to its rapid pace of development, is now highly regarded as a multimedia platform for editing digital images.

By default, Ubuntu installs the useful Shotwell Photo Manager in Applications, Graphics, and Shotwell Photo Manager (see Figure 6.6). This application is similar to other photo managers, such as iPhoto, and includes simple tools that are adequate for many users, such as red-eye reduction, cropping, color adjustment, and the ability to interact with online photo hosts such as Facebook, Flickr, and Picasa.

Image

FIGURE 6.6 For most people, the simple tools in Shotwell Photo Manager are sufficient.

The rest of this section discusses GIMP, a powerful graphics manipulation tool that intermediate and advanced users are likely to enjoy. You also learn about graphic file formats supported by Ubuntu and some tools you can use to convert them if the application you want to use requires a different format.

The GNU Image Manipulation Program

One of the best graphics clients available is GIMP. GIMP is a free, GPL-licensed image editor with sophisticated capabilities that can import and export more than 30 different graphics formats, including files created with Adobe Photoshop. It is often compared with Photoshop, and GIMP represents one of the first significant successes of GNU Projects. Many images in Linux were prepared with GIMP.

GIMP is not installed by default, but after you install it from the repositories you can find it by searching the Dash for Gimp in the menu at Applications, Graphics, and GIMP Image Editor.

You see an installation dialog box when GIMP is started for the first time, and then a series of dialog boxes that display information regarding the creation and contents of a local GIMP directory. This directory can contain personal settings, preferences, external application resource files, temporary files, and symbolic links to external software tools used by the editor.


What Does Photoshop Have that GIMP Does Not?

Although GIMP is powerful, it does lack two features Adobe Photoshop offers that are important to some graphics professionals.

The first of these is the capability to generate color separations for commercial press printers (CMYK, for the colors cyan, magenta, yellow, and key [or black]). GIMP uses RGB (red, green, and blue), which is great for video display, but not so great for printing presses. The second feature GIMP lacks is the use of Pantone colors (a patented color specification) to ensure accurate color matching. These deficiencies might not last long. A CMYK plug-in is in the works (an early version is available from http://cue.yellowmagic.info/softwares/separate-plus/index.html), and the Pantone issues are likely to be addressed in the near future, as well.

If these features are unimportant to you, GIMP is an excellent tool. If you must use Adobe Photoshop, you might want to explore using Wine or Codeweavers; there have been consistent reports of success running Photoshop on Linux with these tools. Bear in mind, though, that both Ubuntu and Photoshop release regularly, so check www.winehq.org/ and www.codeweavers.com/ for the current info before assuming it will work.


After the initial configuration has finished, GIMP’s main windows and toolboxes appear (see Figure 6.7). GIMP’s main window contains tools used for selecting, drawing, moving, view enlarging or reducing, airbrushing, painting, smudging, copying, filling, and selecting color.

Image

FIGURE 6.7 Right-click an image window to access GIMP’s cascading menus.

Using Scanners in Ubuntu

With the rise of digital photography, there has been an equal decline in the need for image scanners. However, there are still times that you want to use a scanner, and Ubuntu makes it easy with a program installed by default called Simple Scan. Simple Scan is designed to do one thing, scan photos or documents easily (see Figure 6.8). It has few settings or options but does all the things most people would want or need.

Image

FIGURE 6.8 Simple Scan makes scanning easy.

You can also use many types of image scanners with GIMP, which is likely to be the choice of people who like to tinker with settings and options or who need greater flexibility than is offered by Simple Scan. If it wasn’t installed when you installed GIMP, install the xsane package. Then, when you scan from GIMP, you will have an abundance of settings and options that you can use. You can also use XSane by itself; search the Dash for XSane.

Working with Graphics Formats

Image file formats are developed to serve a specific technical purpose (lossless compression, for example, where the file size is reduced without sacrificing image quality) or to meet a need for a proprietary format for competitive reasons. Many file formats are covered by one or more patents. For example, the GIF format had fallen into disfavor with the open-source crowd because the patent holder waited a while before deciding to enforce his patent rights rather than being upfront with requests for patent royalties.

If you want to view or manipulate an image, you need to identify the file format to choose the proper tool for working with the image. The file’s extension is your first indicator of the file’s format. The graphics image formats supported by the applications included with Ubuntu include the following:

Image BMP (.bmp)—Bitmapped graphics, commonly used in Microsoft Windows

Image GIF (.gif)—CompuServe Graphics Interchange Format

Image JPG (.jpg)—Joint Photographic Experts Group

Image PCX (.pcx)—IBM Paintbrush

Image PNG (.png)—Portable Network Graphics

Image SVG (.svg)—Scalable Vector Graphics

Image TIF (.tif)—Tagged Image File format

You can find an extensive list of image file extensions in the man page for ImageMagick, an excellent application included with Ubuntu, which you read more about in upcoming sections of this chapter.


Tip

Ubuntu includes dozens of graphics conversion programs in its software repositories that are accessible through the command line and from a graphical user interface (GUI), and there are few, if any, graphics file formats that cannot be manipulated when using Linux. These programs can be called in Perl scripts, shell scripts, or command-line pipes to support many types of complex format-conversion and image-manipulation tasks. See the man pages for the ppm, pbm, pnm, and pgm families of commands. Also see the man page for the convert command, which is part of a suite of extremely capable programs included with the ImageMagick suite.


Sometimes, a file you want to manipulate in some way is in a format that cannot be used by either your graphics application or the final application. The solution is to convert the image file—sometimes through several formats. The convert utility from ImageMagick is useful, as is the netpbm family of utilities. If it is not already installed, you can easily install ImageMagick from the Ubuntu repositories; the netpbm tools are always installed by default. convert is super simple to use from the command line. Here is an example:

Click here to view code image

matthew@seymour~:$ convert image.gif image.png

The convert utility converts between image formats recognized by ImageMagick. You can also manipulate color depth and size during the conversion process. You can use ImageMagick to append images, surround them with borders, add labels, rotate and shade them, and perform other manipulations well suited to scripting. Other commands associated with ImageMagick include display, animate, identify, and import. The application supports more than 130 different image formats (all listed in the man page for ImageMagick).

The netpbm tools are installed by default because they compose the underpinnings of graphics format manipulation. The man page for each image format lists related conversion utilities; the number of those utilities gives you some indication of the way that format is used and shows how one is built on another:

Image The man page for ppm, the portable pixmap file format, lists 47 conversion utilities related to ppm. This makes sense because ppm, or portable pixmap, is considered the lowest common denominator for color image files. It is therefore often used as an intermediate format.

Image The man page for pgm, the portable graymap file format, lists 22 conversion utilities. This makes sense because pgm is the lowest common denominator for grayscale image files.

Image The man page for pnm, the portable anymap file format, lists 31 conversion utilities related to it. However, there is no format associated with PNM because it operates in concert with ppm, pgm, and pbm.

Image An examination of the man page for pbm, the portable bitmap file format, reveals no conversion utilities. It’s a monochrome format and serves as the foundation of the other related formats.

Image The easiest way to resize or rotate image files is to install the nautilus-image-converter package from the repositories. This enables you to right-click an image when you are viewing files in the File Browser (for example, from Places, Pictures) and choose menu options to resize or rotate one or multiple images without opening another program.

Capturing Screen Images

You can use graphics-manipulation tools to capture images that are displayed on your computer screen. Although this technique was used for the production of this book, it has broader uses; there is truth to the cliché that a picture is worth a thousand words. Sometimes it is easier to show an example than it is to describe it.

You can use a captured screen image (also called a screen grab or a screenshot) to illustrate an error in the display of an application (a font problem, for example) or an error dialog that is too complex to copy down by hand. You might just want to share an image of your beautifully crafted custom desktop configuration with your friends or illustrate your written documents.

When using the default desktop, you can take advantage of the built-in screenshot mechanism (gnome-screenshot). You can use this tool by pressing the Print Screen key. (Alt+Print Screen takes a screenshot of only the window that has focus on a desktop.) Captured images are saved in PNG format. You can also find the tool in the Dash by searching for screenshot.

Other Graphics Manipulation Options

If you have very specific requirements for working with graphics, you may find one of the following better suits your needs than the general options and comments above. Some of these are in the Ubuntu repositories, but not all of them.

Image Blender is a 3-D image and animation editor that you can find at http://www.blender.org/.

Image CinePaint is a powerful and complex tool used by many Hollywood studios that you can find at http://www.cinepaint.org/.

Image darktable is a RAW editor and can be found at http://www.darktable.org/.

Image digiKam is photo management software and can be found at http://www.digikam.org/.

Image Hugin is a panoramic photo stitcher and can be found at http://hugin.sourceforge.net/.

Image Inkscape is a vector graphics creation and editing tool that you can find at http://inkscape.org/.

Image POV-Ray is a powerful and complex 3-D graphics program that uses ray tracing and can be found at http://www.povray.org/.

Image Radiance is intended for the analysis and visualization of lighting in design and can be found at http://www.radiance-online.org/.

Image Xara Xtreme is a general purpose graphics editor that you can find at http://www.xaraxtreme.org/.

Using Digital Cameras with Ubuntu

Most digital cameras used with Ubuntu fall into one of two categories: webcams (small, low-resolution cameras connected to the computer’s interface) or handheld digital cameras that record image data on disks or memory cards for downloading and viewing on a PC. Ubuntu supports both types. Other types of cameras, such as surveillance cameras that connect directly to a network via wired or wireless connections, need no special support (other than a network connection and viewing software) to be used with a Linux computer.

Ubuntu supports hundreds of different digital cameras, from early parallel-port (CPiA chipset-based) cameras to today’s USB-based cameras. You can even use Intel’s QX3 USB microscope with Ubuntu. The following sections describe some of the more commonly used types of still camera hardware and software supported by Ubuntu.

Handheld Digital Cameras

Because of the good development carried out in the Linux world, you can plug almost any digital camera in to your computer through a USB interface, and Ubuntu automatically recognizes the camera as a USB mass storage device. You can even set Ubuntu to recognize when a camera is plugged in so that it automatically imports your photographs for you.

Using Shotwell Photo Manager

Ubuntu comes by default with a pretty good photo manager called Shotwell Photo Manager that includes simple adjustment tools (see Figure 6.9). You can import your photos into Shotwell, assign tags to them, sort and arrange them, and even upload them to your favorite Internet photo-hosting sites such as Facebook, Flickr, and Picasa.

Image

FIGURE 6.9 Browse your photo collection and correct minor problems with Shotwell Photo Manager.

Burning CDs and DVDs in Ubuntu

Linux is generally distributed via the Internet as disc images called ISOs that are ready to be written to CDs or DVDs. Therefore, learning how to burn discs is essential if you have to download and install a Linux distribution. You can use CDs and DVDs to do the following:

Image Record and store multimedia data, such as backup files, graphics images, and music.

Image Rip audio tracks from music CDs (ripping refers to extracting music tracks from a music CD) and compile your own music CDs for your personal use.

Although USB storage devices such as thumb drives are making CDs and DVDs almost as rare as floppy disks, they aren’t quite gone, and many people still find them useful. As long as that remains true, we want to make sure this information is available.

Creating CDs and DVDs with Brasero

Although adequate for quick burns and use in shell scripting, the command-line technique for burning CDs and DVDs is an awkward choice for many people (but we still cover doing so later in this chapter because others find it useful and desirable). Fortunately, Ubuntu provides several graphical clients; the most useful is Brasero.

Brasero is an easy-to-use graphical CD and DVD burning application that is installed by default.

Brasero takes a project-based approach to disc burning, opening up with a wizard from which you can select from four different tasks that people commonly want to do. Figure 6.10 shows the opening screen. Brasero also remembers previous “projects,” enabling you to quickly create several copies of a disc, which is ideal if you’re planning to pass on copies of Ubuntu to your friends and family.

Image

FIGURE 6.10 Brasero gives you an intuitive way to create data and audio CDs and DVDs.

Burning a data CD or DVD is as easy as selecting the option in the opening screen and dragging and dropping the files you want to include from the directory tree on the left to the drop area on the right. If you insert a blank CD or DVD in your writer, Brasero keeps an eye on the disc size and tells you when you reach or exceed the limits. It also creates ISO files, which are disc images that contain everything that would exist on the medium if you burned a real CD or DVD in one file that can be mounted by computer file systems, which is useful if you want to create multiple copies of the same disc or if you want to share a disc image, perhaps using a USB thumb drive or over the Internet.

Finally, click the Burn button, input a label for the disc, and Brasero starts creating your new CD or DVD or image file. How long it takes to create a CD or DVD depends on the amount of data you are writing and the speed of your drive.

Creating CDs from the Command Line

In Linux, creating a CD at the command line is a two-step process. You first create the ISO9660-formatted image, and you then burn or write the image onto the CD. The ISO9660 is the default file system for CD-ROMs.

Use the mkisofs command to create the ISO image. The mkisofs command has many options (see the man page for a full listing), but use the following for quick burns:

Click here to view code image

matthew@seymour~:$ mkisofs -r -v -J -l -o /tmp/our_special_cd.iso /source_directory

The options used in this example are as follows:

Image -r—Sets the permission of the files to more useful values. UID and GID (individual and group user ID requirements) are set to 0, all files are globally readable and searchable, and all files are set as executable (for Windows systems).

Image -v—Displays verbose messages (rather than terse messages) so that you can see what is occurring during the process; these messages can help you resolve problems if they occur.

Image -J—Uses the Joliet extensions to ISO9660 so that your Windows-using buddies can more easily read the CD. The Joliet (for Windows), Rock Ridge (for UNIX), and HSF (for Mac) extensions to the ISO9660 standard are used to accommodate long filenames rather than the eight-character DOS filenames that the ISO9660 standard supports.

Image -l—Allows 31-character filenames; DOS does not like it, but everyone else does.

Image -o—Defines the directory where the image will be written (that is, the output) and its name. The /tmp directory is convenient for this purpose, but the image could go anywhere you have write permissions.

Image /source_directory—Indicates the path to the source directory; that is, the directory containing the files you want to include. There are ways to append additional paths and exclude directories (and files) under the specified path; it is all explained in the man page, if you need that level of complexity. The simple solution is to construct a new directory tree and populate it with the files you want to copy and then make the image using that directory as the source.

Many more options are available, including options to make the CD bootable.

After you have created the ISO image, you can write it to the CD with the cdrecord command:

Click here to view code image

matthew@seymour~:$ cdrecord -eject -v speed=12 dev=0,0,0 /tmp/our_special_cd.iso

The options used in this example are as follows:

Image -eject—Ejects the CD when the write operation is finished.

Image -v—Displays verbose messages.

Image speed=—Sets the speed; the rate depends on the individual drive’s capabilities. If the drive or the recordable medium is poor, you can use lower speeds to get a good burn.

Image dev=—Specifies the device number of the CD writer.


Note

You can also use the blank = option with the cdrecord command to erase CD-RW discs. The cdrecord command has fewer options than mkisofs does, but it offers the -multi option, which enables you to make multisession CDs. A multisession CD enables you to write a data track, quit, and then add more data to the CD later. A single-session CD can be written to only once; any leftover CD capacity is wasted. Read about other options in the cdrecord man page.

Current capacity for CD media is 700MB of data or 80 minutes of music. (There are 800MB/90-minute CDs, but they are rare.) Some CDs can be overburned; that is, recorded to a capacity in excess of the standard. The cdrecord command and some graphical programs are capable of overburning if your CD-RW drive supports it. You can learn more about overburning CDs at www.cdmediaworld.com/hardware/cdrom/cd_oversize.shtml/.


Creating DVDs from the Command Line

There are several competing formats for DVD, as follows:

Image DVD+R

Image DVD-R

Image DVD+RW

Image DVD-RW

Differences in the + and - formats have mostly to do with how the data is modulated onto the DVD itself, with the + format having an edge in buffer underrun recovery. How this is achieved affects the playability of the newly created DVD on any DVD player. The DVD+ format also has some advantages in recording on scratched or dirty media. Most drives support the DVD+ format. As with any technology, your mileage may vary.

We focus on the DVD+RW drives because most drives support that standard. The software supplied with Ubuntu has support for writing to DVD-R/W (rewritable) media, as well. It will be useful for you to review the DVD+RW/+R/-R[W] for Linux HOWTO at http://fy.chalmers.se/~appro/linux/DVD+RW/ before you attempt to use dvd+rw-tools, which you need to install to enable DVD creation (also known as mastering) and the cdrtools package. You can ignore the discussion in the HOWTO about kernel patches and compiling the tools.


Tip

The 4.7GB size of DVD media is measured as 1000 megabytes per gigabyte, instead of the more traditionally used, but not entirely accurate, 1024 megabytes per gigabyte (more appropriately written GiB), so do not be surprised when the actual formatted capacity, about 4.4GB, is less than you anticipated. A good explanation of the difference and the need for the correction is available at http://en.wikipedia.org/wiki/Gibibyte. Most hard drive manufacturers have also made the switch. dvd+rw-tools does not allow you to exceed the capacity of the disc.


You need to have the dvd+rw-tools package installed (as well as the cdrtools package). The dvd+rw-tools package contains the growisofs application (which acts as a front end to mkisofs) and the DVD formatting utility.

You can use DVD media to record data in two ways. The first way is much the same as that used to record CDs in a session, and the second way is to record the data as a true file system using packet writing.

Session Writing

To record data in a session, you use a two-phase process:

1. Format the disc with dvd+rw-format /dev/scd0 (only necessary the first time you use a disc, where /dev/scd0 is the device name for your drive).

2. Write your data to the disc with growisofs -Z /dev/scd0 -R -J /your_files.

The growisofs command simply streams the data to the disc. For subsequent sessions, use the -M argument rather than -Z. The -Z argument is used only for the initial session recording; if you use the -Z argument on an already used disc, it erases the existing files.


Caution

Some DVDs come preformatted; formatting them again when you use them for the first time can make the DVD useless. Always be sure to carefully read the packaging your DVD comes in to ensure that you are not about to create another coaster.



Tip

Writing a first session of at least 1GB helps maintain compatibility of your recorded data with other optical drives. DVD players calibrate themselves by attempting to read from specific locations on the disc; you need data there for the drive to read it and calibrate itself.

Also, because of limitations to the ISO9660 file system in Linux, do not start new sessions of a multisession DVD that would create a directory past the 4GB boundary. If you do so, it causes the offsets used to point to the files to “wrap around” and point to the wrong files.


Packet Writing

Packet writing treats the CD or DVD like a hard drive in which you create a file system (like ext3) and format the disc and then write to it randomly as you would to a conventional hard drive. This method, although commonly available on Windows-based computers, was long considered experimental for Linux and was never used much anyway because USB thumb drives became common before the use of CD or DVD-RWs had the opportunity. We do not cover this in detail here, but a quick overview is appropriate.


Tip

DVD+RW media are capable of only about 1,000 writes, so it is useful to mount them with the noatime option to eliminate any writing to update their inodes or simply mount them read-only when it’s not necessary to write to them.


It is possible to pipe data to the growisofs command:

Click here to view code image

matthew@seymour~:$ sudo your_application | growisofs -Z /dev/scd0=/dev/fd/0

It is also possible to burn from an existing image (or file, named pipe, or device):

Click here to view code image

matthew@seymour~:$ sudo growisofs -Z /dev/scd0=image

The dvd+rw-tools documentation, found at /usr/share/doc/dvd+rw-tools/index.html, is required reading before your first use of the program. We also suggest that you experiment with DVD-RW (rewritable) media first because if you make mistakes you can still reuse the disc instead of creating several new coasters for your coffee mug.

Viewing Video

You can use Ubuntu tools and applications to view movies and other video presentations on your PC. This section presents some TV and motion picture video software tools included with the Ubuntu distribution you received with this book.

TV and Video Hardware

To watch TV and video content on your PC, you must install a supported TV card or have a video/TV combo card installed. You can find a current list of TV and video cards supported in Linux at http://linuxtv.org/wiki/index.php/Main_Page.

Freely available Linux support for TV display from video cards that have a TV-out jack is improved over a couple of years ago, but still rather poor. That support must come from the X driver, not from a video device that Video4Linux supports with a device driver. Some of the combo TV-tuner/video display cards have support, including the Matrox Marvel, the Matrox Rainbow Runner G-Series, and the RivaTV cards. Many other combo cards lack support, although an independent developer might have hacked something together to support his own card. Your best course of action is to perform a thorough Internet search with Google.

Many of the TV-only PCI cards are supported. In Linux, however, they are supported by the video chipset they use, and not by the name some manufacturer has slapped on a generic board. (The same board is typically sold by different manufacturers under different names.) The most common chipset is the Brooktree Bt*** series of chips; they are supported by the bttv device driver.

If you have a supported card in your computer, it should be detected during installation. If you add it later, the hardware-detection utility should detect it and configure it. It is possible to try to configure it by hand, but because the Ubuntu kernel czars try to compile every hardware option available as a module and make it available, doing so isn’t likely to be of much use. Even so, this is what you would do.

First, to determine what chipset your card has, use the lspci command to list the PCI device information, find the TV card listing, and look for the chipset that the card uses. For example, the lspci output for one computer shows the following.

Click here to view code image

matthew@seymour~:$ lspci
00:00.0 Host bridge: Advanced Micro Devices [AMD] AMD-760 [IGD4-1P] System Controller (rev 13)
00:01.0 PCI bridge: Advanced Micro Devices [AMD] AMD-760 [IGD4-1P] AGP Bridge
00:07.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 40)
00:07.1 IDE interface: VIA Technologies, Inc. VT82C586B PIPC Bus Master IDE (rev 06)
00:07.2 USB Controller: VIA Technologies, Inc. USB (rev 1a)
00:07.3 USB Controller: VIA Technologies, Inc. USB (rev 1a)
00:07.4 SMBus: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 40)
00:09.0 Multimedia audio controller: Ensoniq 5880 AudioPCI (rev 02)
00:0b.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 02)
00:0b.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 02)
00:0d.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8029(AS)
00:0f.0 FireWire (IEEE 1394): Texas Instruments TSB12LV23 IEEE-1394 Controller
00:11.0 Network controller: Standard Microsystems Corp [SMC] SMC2602W EZConnect
01:05.0 VGA compatible controller: nVidia Corporation NV15 [GeForce2 Ti] (rev a4)

Here, the lines listing the multimedia video controller and multimedia controller say that this TV board uses a Brooktree Bt878 Video Capture chip and a Brooktree Bt878 Audio Capture chip. This card uses the Bt878 chipset. Your results will be different, depending on what card and chipset your computer has. This card happened to be an ATI All-in-Wonder VE (also known as ATI TV-Wonder). (The VE means Value Edition; hence, there is no TV-out connector and no radio chip on the card; what a value!)

Then you figure out what module is needed, probably using Google to search for “Bt878 linux” or “Bt878 Ubuntu,” and start reading documentation. You want to look for official pages first rather than blog posts. Finally, you need to enter some information into /etc/modules.conf. This file does not exist anymore in a default Ubuntu installation but may be created as needed and will be read at boot time. Then, you calculate the module and kernel dependencies with sudo depmod -a and sudo modprobe module name to load the module. Again, this is not necessary in Ubuntu because the people doing kernel configuration create a module for everything that exists, so if it is available to them, they will make it available to you with no extra work on your part, and the system scans to see what should be loaded at boot and pulls in what is needed then.

Video Formats

Ubuntu recognizes a variety of video formats. The formats created by the MPEG group, Apple, and Microsoft dominate, however. At the heart of video formats are the codecs—the encoders and decoders of the video and audio information. These codecs are typically proprietary, but free codecs do exist. Here is a list of the most common video formats and their associated file extensions, although many more exist:

Image AVI (.avi)—The Windows audio visual format

Image FLV (.flv)—Used in Adobe Flash, supports H.264 and others

Image MPEG (.mpeg)—The MPEG video format; also known as. mpg

Image MOV (.mov)—Another QuickTime video format

Image OGV/OGG (.ogv/.ogg)—The Ogg Theora freely licensed video format

Image QT (.qt)—The QuickTime video format from Apple

Image WEBM (.webm)—Google’s royalty-free container for audio and video (such as in VP8 format) designed for HTML5

Viewing Video in Linux

Out of the box, Ubuntu does not support any of the proprietary video codecs due to licensing restrictions. However, this functionality can be acquired if you install the ubuntu-restricted-extras package from the Ubuntu software repositories. You can learn more about this at https://help.ubuntu.com/community/RestrictedFormats.

You can watch video files and video DVDs with Totem Movie Player (Figure 6.11), which is installed by default. This may also be used with several other file formats and for both video and audio and is especially well suited for almost anything you are likely to want to use after you install the ubuntu-restricted-extras package.

Image

FIGURE 6.11 Totem Movie Player works with most common video and audio formats.


Adobe Flash

The Adobe Flash plug-in for the Firefox browser is a commercial multimedia application that isn’t provided with Ubuntu out of the box, but many people find it useful. Adobe Flash enables you to view Flash content at websites that support it. The easiest way of getting a hold of the official version of Flash is to install the ubuntu-restricted-extras package. After you’ve done this, any Flash animations play quite happily within any Firefox-based browsers. Note that Adobe recently announced they are discontinuing support for Flash on Linux. However, the Google Chrome browser supports Flash and Google has committed to making sure it continues to work on Linux, so if Flash is vital to you, using Google Chrome might be your best option.


Another interesting video viewer application is VLC, which is available in the software repositories and also for other operating systems like Windows and Mac OS X (see Figure 6.12). VLC uses its own set of audio and video codecs and supports a wider range of video formats than any other media player we have encountered. If VLC can’t play it, it probably can’t be played.

Image

FIGURE 6.12 VLC is a powerful and capable media player.

Personal Video Recorders

The best reason to attach a television antenna to your computer, however, is to use the video card and the computer as a personal video recorder.

The commercial personal video recorder, TiVo, started a new trend by using Linux running on a PowerPC processor to record television programming with a variety of customizations. You can turn your computer into a personal digital video recorder with Myth TV from www.mythtv.org/, a Linux-based digital video recorder software project, made even easier for Ubuntu users by the Mythbuntu project at www.mythbuntu.org/. Everything you need is available in the Ubuntu repositories and may be installed and configured easily thanks to the people involved in these projects.

Video Editing

You can now create and edit video in Ubuntu using PiTiVi (see Figure 6.13). It is not installed by default, but a quick search for “PiTiVi Video Editor” in the Ubuntu Software Center gets you started. You may import any video clip in any format that is supported by GStreamer, the main multimedia framework used in Ubuntu. This should include the files created by your digital camera, which should mount in Ubuntu as a storage device, making the transfer of the files from the camera to your computer quick and easy. PiTiVi lets you move scenes around, cut things, add your own soundtrack, and more.

Image

FIGURE 6.13 PiTiVi Video Editor.

Several other video editing options exist. If you have very specific requirements for working with video, you may find one of the following better suits your needs:

Image Avidemux is designed for people with simple needs and can be found at http://fixounet.free.fr/avidemux/.

Image Blender is a 3-D image and animation editor that you can find at http://www.blender.org/.

Image Cinelerra has been around for years, but recently made some big changes and is rebuilding its community. You can find it at http://cinelerra.org/.

Image CinePaint is a powerful and complex tool used by many Hollywood studios that you can find at http://www.cinepaint.org/.

Image Kdenlive comes from the KDE folks and can be found at http://kdenlive.org/.

Image OpenShot Video Editor can be found at http://www.openshot.org/.

Some of the above options are in the Ubuntu repositories, so check there first, but some you will have to download directly from their website.

References

Image www.videolan.org/—A multimedia player project with good documentation that will play almost anything.

Image http://fy.chalmers.se/~appro/linux/DVD+RW/—The DVD+RW/+R/-R[W] for Linux, a HOWTO for creating DVDs under Linux.

Image www.gimp.org—Home page of The GIMP (GNU Image Manipulation Program).

Image http://f-spot.org—Home page of the F-Spot project.

Image www.sane-project.org—Home page of the SANE (Scanner Access Now Easy) project.

Image www.imagemagick.org—Home page for ImageMagick.

Image http://gimp.net/tutorials/—Official tutorials for The GIMP.