Hack47.Master Video Output Options


Hack 47. Master Video Output Options

Most video players support a number of output options. Understanding the difference between X11, xv, SVGA, and other output settings can help you make the most of your video playback.

Not all video cards are created equal. After all, you can't expect to play a game that just came out this year on a graphics card from 10 years ago. Similarly, when you watch video under Linux there are a number of different output options that are at your disposal depending on what your video card supports. Some of these options give you extra choices for video playback including hardware acceleration and the ability to scale the video. In this hack, I cover the major video output options and their advantages and disadvantages so you can better match your output selection to the abilities of your video card.

Where you configure these video output options varies greatly, depending on which media player you choose. For the purpose of this hack, I will cover how to select these output options with MPlayer on the command line, but other players require you to go into advanced preferences, such as in the case of a graphical video player such as xine-ui [Hack #55], or otherwise use a command-line switch to set the option. Check the documentation for your media player for information on where to change these settings. All these output options are supported in MPlayer and should also be supported in xinelib based players, provided the support is compiled in.


When choosing the appropriate video output setting, the ideal is to be able to push the work of displaying the video from the CPU to the video card. That way the CPU can be used purely for processing the video codec. In addition, many of the hardware-accelerated video output options allow you to scale the image to a larger size or even full screen. Video modes without hardware acceleration often can't scale the image, or if they can, you need a relatively fast processor to scale the image full screen. Experiment with the various output types and see which one suits your system best.

There are also a number of other hardware accelerated video modes that are designed for certain brands of video cards. For instance one particular mode provides hardware acceleration for 3dfx cards. For the purposes of this hack I've listed only modes that work for a wide range of cards. For more information about these modes and modes that are specific to certain types of cards, visit http://www.mplayerhq.hu/DOCS/HTML/en/video.html.


3.2.1. XV

The xv video output option is the primary hardware-accelerated type you will run into, and many media players are set to try xv video by default. xv uses the XVideo extension in X for hardware acceleration, so it requires XFree86 4.0.2 or newer as well as driver support for your video card. To test whether your card has support, use the xvinfo command. It should create a lot of output if your card is supported:

 $ xvinfo X-Video Extension version 2.2 screen #0 Adaptor #0: "Intel(R) 830M/845G/852GM/855GM/865G Video Overlay" number of ports: 1 port base: 56 operations supported: PutImage … 

If you don't see a lot of output, the xv extension isn't supported by your current module. In the case of NVIDIA and some ATI cards, you can download and install the official driver from their site.

The XV mode not only offers hardware-accelerated video, but also allows hardware scaling, brightness, and contrast adjustment so you can resize the video without putting extra load on the CPU. To select this option in mplayer, type:

 $ mplayer -vo xv filename 

3.2.2. X11

This option outputs to X11 without any hardware acceleration. Any display or scaling of the video output is done in software. Ideally, you will only fall back on this mode when all other options fail, because it is the slowest and most CPU-intensive. One other time you might purposely use this option is in the case of a multi-head setup or TV output where hardware accelerated drivers display a bluish window instead of the video. In general avoid this mode unless you must use it. Also avoid scaling the output if possible and instead change to a lower resolution in X. To select this option in mplayer, type:

 $ mplayer -vo x11 filename 

3.2.3. Simple Directmedia Layer

Simple Directmedia Layer (SDL) is a unified video and audio interface that is often used by games because it provides an interface to video hardware underneath without the program needing to know how to access the video hardware. A program can output video to SDL, which can then output to a number of other video drivers it knows about. A downside to SDL is that it uses software rendering, so choose hardware-accelerated options before SDL. For media players, the SDL output option might possibly provide more stable, more correct, or more consistent video output than other video output options, so it is worth trying if other video output options seem buggy or slow. To select this option with mplayer, type:

 $ mplayer -vo sdl filename 

3.2.4. Direct Graphics Access

Direct Graphics Access (DGA) allows a program to skip the X server and write directly to the framebuffer memory. This method allows DGA to use less CPU and gives you a full screen display of the video, however it can only display full screen, which might be a downside for certain uses. Also, although this mode uses less CPU, it is not a hardware-accelerated mode, and the kernel gives access to this kind of mode only to the root user. Since this is a software renderer you might wonder when to use this instead of the standard X11 driver. Use this mode instead of X11 if you want full-screen output, because X11 won't scale the image or resize to fill your entire screen.

To use this mode, your X server needs to be configured to use the DGA extension. Test this by searching for the string DGA in your X log file (usually /var/log/XFree86.0.log or /var/log/Xorg.0.log):

 $ grep DGA /var/log/XFree86.0.log (II) Loading extension XFree86-DGA 

If your computer supports this mode, type the following to use it with mplayer:

 # mplayer -vo dga filename 

3.2.5. SVGAlib

This output option allows media players to display video from a console without requiring the use of X. It requires that the svgalib libraries be installed on your system and renders in software, but again, SVGAlib provides an option to view video without X and possibly on older monitors and older video cards that don't support framebuffer display. Also, this mode requires root privileges to use. To use this option, become root. Then type:

 # mplayer -vo svga filename 

3.2.6. Framebuffer

Like the SVGAlib option, the framebuffer option allows you to display a video directly from a console without the use of X. Also like SVGAlib it supports a wide range of cards so you don't have to worry as much about hardware support. Your kernel does need to have framebuffer support (fbdev) compiled in (which newer prepackaged kernels should have), so kernels without fbdev support will not be able to use framebuffer mode. If you do have framebuffer support compiled in, type the following to use it with mplayer:

 $ mplayer -vo fbdev filename 

3.2.7. VESA

Like SVGAlib and framebuffer, this is another output option that allows you to display video from a console without X. One advantage to this option over framebuffer is that it doesn't require that any special graphics options be enabled in the Linux kernelyou just need a VESA-compatible BIOS. Another advantage to this option is that for some hardware (for instance, some ATI cards) this mode often works with TV-out even if you can't seem to get support otherwise in Linux. Like the other console options, however, it does all rendering in software, and has an additional downside in that it requires root privileges to use. To try this option, become root and then type:

 # mplayer -vo vesa filename 

MPlayer supports a number of other output modes in addition to the ones listed. To see which of the above modes Mplayer supports (and more), type:

 $ mplayer -vo help 

You can find out more about each of these modes in the MPlayer manpage.





Linux Multimedia Hacks
Linux Multimedia Hacks
ISBN: 596100760
EAN: N/A
Year: 2005
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net