# Basic configuration

As a general rule, the initial &kplayer; settings are chosen for optimal performance and playback, so no additional setup is needed. However, in some cases changing the initial settings can improve &kplayer; performance.

## Video setup

XVideo is the video output &kplayer; uses by default. For many systems this is the optimal choice. Make sure your X Server has XVideo extension enabled. Look in your `/etc/X11/xorg.conf` or `/etc/X11/XF86Config-4` file for a line that reads

`Load "extmod"`

This is the line that loads the XVideo extension, so make sure it is not disabled. Also check `/var/log/Xorg.0.log` or `/var/log/XFree86.0.log` to make sure that XVideo is loaded without error.

If &kplayer; cannot use XVideo for any reason, it will fall back on using X11 video output in the default configuration. X11 output is OK except it forces the use of software scaler, which will consume significantly more processor cycles, and it does not support changing contrast, brightness, hue and saturation, so those controls will not be functional.

Depending on your video card, you may find that a different &mplayer; video output type(s) work better for you. For example you can try VIDIX output if you have a Matrox or ATI card. For Matrox cards there is also XMGA output.

You can change the video output type on the Video page in &kplayer; Settings. However, some video outputs may not support embedding video into &kplayer; and will open their own window instead. Those video outputs are not recommended.

## Audio setup

The optimal audio output to use with &kplayer; is ALSA, which is the default setting when &kplayer; is first installed. If ALSA is not available, OSS is the second best choice.

If the audio output is configured correctly, but &kplayer; cannot use it, usually it is because another program has locked the audio device. The optimal solution for this is to allow multiple programs access the audio device at the same time.

For example, to set up ALSA to allow more than one program to use the same device, put something along these lines into your `~/.asourndrc`:

    pcm.!default
    {
      type dmix
      ipc_key 1234
      slave.pcm "hw:card-name"
    }

where `card-name` is the name of the audio card that you can find out by running ``cat` `/proc/asound/cards``. Before trying the new configuration, be sure to stop any programs that are known to lock audio devices and keep them locked, for example ``killall` artsd`

You can change the audio output type on the Audio page in &kplayer; Settings.

However, some audio outputs like SDL or sound server outputs like ARTS or ESD are not recommended since they may cause stability problems, degraded performance and a broken volume control.

## &mplayer; setup

Depending on how you installed &mplayer; you may have gotten a global `mplayer.conf` file in a directory like `/etc/mplayer`. The local version of that file is `~/.mplayer/config`. Make sure that those files do not have a `gui=yes` option. Remove or comment it out if you find it. If you ever want to use &mplayer;'s own GUI (not recommended), you can get it by running `gmplayer`.

Also make sure there are no other options that may interfere with &kplayer; operation. If you see any, either comment them out or override them in &kplayer; Settings.

## Smooth playback

A while ago Arpi wrote a Fine-tuning &mplayer; article where you can find more useful tips on optimizing &mplayer;.

One thing you can do to get smoother playback is enable the hardware RTC timer. Run

``echo` 1024 > `/proc/sys/dev/rtc/max-user-freq``

as root, and also make sure `/dev/rtc` is user readable.

Arpi also recommends trying options like `-mc 0.001` and `-autosync 30`. Put them into the Additional command line arguments field on the Advanced page in &kplayer; Settings and see if they make a noticeable difference for you.

The `-vop` &mplayer; option has since been replaced by the `-vf` option, so that section of the article may be somewhat obsolete or the tips may need some adjustment for the current &mplayer;.

## Previews in the Open File dialog

There is some obsolete &kde; based software, like &kaboodle;, that tells &kde; that it wants to be used for previewing media files, even those it does not support, in the standard Open File dialog, which is what &kplayer; uses. This makes browsing directories with media files painfully slow, and unfortunately there is no option to turn off previewing selectively for certain file types. Even if you turn off the Play automatically option, the preview program will still be loaded. The workaround is to either turn off previewing in &kplayer; entirely if you don't need it, or remove the offending program from your system.

## Previewing files in &kmldonkey;

The recent official &mldonkey; GUIs have been badly broken, leaving &kmldonkey; as the most usable, albeit crashy, &mldonkey; frontend. &kmldonkey; supports embedding of &kplayer; for previewing files, but it is recommended that you change your mldonkey_preview script to start the full &kplayer; for previewing partial downloads, since that will give better interface and more options. If &mplayer; cannot play a partial download, probably nothing else will, so just wait for a larger chunk to get downloaded.