Hack 55. Try xine-Based Video Players
Use xine and xine-based players to view a number of video formats.
When it comes to multimedia programs under Linux, there are a number of alternatives to choose from and, in the case of xine, a back-end multimedia playback engine that is used by a number of frontends, such as Kaffeine and Totem. Although the selection of a media player is largely a matter of taste, a number of other factors apply as well. Even though in most cases the major media players under Linux all rely on the same codec libraries, I've noticed that some media players are able to play videos that cause other players to crash. Because of this, even in the cases where I choose other video players for files, I still have xine at the ready. This hack covers the major features of xine and discuss some of the frontends that are available.
Some people might associate xine with the video player, but xine actually refers to the portable multimedia engine that can play a number of audio and video files as well as support a number of different multimedia features. There are a number of different frontends that make use of the xine engine with the xine-ui frontend being the default frontend most likely associated with the project.
xine is a relatively popular library and most major distributions should package not only the xine-lib itself, but also the default xine-ui frontend. Otherwise you can download both xine-lib and xine-ui from the official xine page at http://www.xinehq.de and extract and build directly from the source.
After xine is installed, you can launch it either from your Media or Video menu in your desktop environment, or you can type xine in a console. The default interface (see Figure 3-3) is in two partsthe video window and the control window. The video window displays the current video being played and resizes to fit the current video. The control window provides a series of common controls such as play, pause, stop, and so on, as well as buttons to have xine open different media files, such as VCDs and DVDs. Other buttons on the control window allow you to change the playlist, change the current skin, and edit general xine preferences. All the buttons in the control window provide tool tips that explain their functions, in case the icons aren't descriptive enough. In addition, you can right-click on the video window to access all the different functions of the control window.
Figure 3-3. Default xine windows
The steps to play a video under xine differ depending on the type of video. To play a VCD, DVD, CD, or DVB (digital TV input) press the corresponding button on the control window. xine will load the respective audio or video from its default location (typically /dev/cdrom for CD-ROM-based video or audio, and /dev/dvd for DVDs) and start immediate playback. In the case of video with menus, xine will load the main menu which you can navigate with the arrow keys or a mouse. To play a video file, right-click on the video window and select Open File or press Ctrl-O to open the file selection dialog. Navigate to the file you wish to play, select it, and click the Select button. xine will start playback of the file immediately.
You can also choose files for playback within a playlist. Click the playlist button on the control window or type Ctrl-P to open the playlist editor. From this window you can add DVD, VCD, or other video sources as well as video files to the playlist. Once items are in the playlist, click the play button in either the playlist editor or in the control window to start playback. xine will play through the entire playlist. You can also save playlists for later or load previously saved playlists from this window.
Once a video has been chosen and is playing, you can control playback through either the control window or the right-click menu on the video window. The playback controls all have key bindings as well, so previous, play, pause, stop, and next can be accessed with Page Down, Enter, Spacebar, S, and Page Up, respectively. In addition you can skip forward or backward in the current video using the slider in the control window or by pressing the left or right arrows. You can also toggle full-screen mode either with the fullscreen button on the control window, through the right-click menu, or with the f key.
The xine-ui frontend makes a large number of the xine-lib configuration options available. To access the xine-ui preferences, click the Setup window button on the control window, Settings Setup on the right-click menu, or type Alt-S. The setup window (see Figure 3-4) has a number of tabs for General, Audio, Video, and other options. In the General window one of the first options lets you configure the configuration experience level. The level of experience you choose here, from Beginner to Master of the Known Universe, controls how many options will be revealed to you in the Setup Window. Some of the basic options you can configure in this window include the default skin to use for Figure 3-4. xine setup window
3.10.1. Other xine Frontends
While the default xine-ui frontend can do the job, some people have found the interface difficult to use, and others prefer an interface that more closely matches their desktop environment. There are a number of other frontends to the xine engine, and two of the most popular are probably Totem and Kaffeine.
Totem is a GTK2-based frontend to xine and, as such, appeals to users of the GNOME desktop environment. Totem should already be packaged by most major distributions, but otherwise can be downloaded directly from the official site at http://www.hadess.net/totem.php3. Totem boasts a very simple interface, with both the video and control windows combined in a single window with a menu bar along the top of the window. The interface is pretty self-explanatory, and you can drag and drop videos to the window to play them, as well as open them from the Movie menu.
Kaffeine is another xine frontend based on the QT toolkit. You can install Kaffeine either through your distributions package manager or directly from the official site at http://kaffeine.sourceforge.net. Kaffeine and Totem both resemble each other somewhat, but Kaffeine is intended for use with KDE. Apart from look and feel, both UIs behave in similar ways and because both access the same xine engine underneath, both should be able to play the same range of video and audio files.