# NVIDIA/TV-OUT

* NVIDIA
* Introduction |
* TV-OUT |
* Twin View |
* SLI |
* Stereo
Could you imagine a video-night sitting in front of a 17'' monitor? Wouldn't it be much nicer to go through all your videos using a television? Most video cards don't provide direct SCART-connection to the TV, but some offer a S-Video connection.
This page provides step-by-step documentation on howto setup your X-Server and use Tv-out.

## Setting up the X-Server

We need to edit three different parts of your X config file to make the X-server render your desktop or video to a television that is connected to your video card through the S-Video (or Composite) port on your videocard. They are used to associate a Monitor with a Device and define a Screen. If you look through your configfile you will notice that those sections already exist. No wonder, because we need one Device-, one Monitor- and one Screen- Section for each connected monitor/TV. In our case it's the original monitor (CRT) and the television. To make sure your monitor will work later on as well do not touch the existing sections. We will add new sections to support tv-out as well as the original monitor simultaneously. There is also a feature called TwinView which is not covered here.
Please make a backup of your configuration file before you make any changes to it.

### Device-Section and its options

This section associates each installed videocard with a driver. As you look through the xorg.conf your device-section section should look like this right now:
This Device Section controls the DVI/VGA output and ignores the tv-out and all devices connected to it. There are some special nvidia-options to use the tvout.

#### TVStandard

You should adjust this parameter to your monitor. In general you can take the value from this table:
| Value | Country |
| "PAL-B" | used in Australia, Austria, Belgium, Denmark, Estonia, Finland, Germany, Guinea, Hong Kong, Iceland, India, Indonesia, Italy, Malaysia, The Netherlands, New Zealand, Norway, Portugal, Singapore, Spain, Sweden, Switzerland and Russia |
| "PAL-D" | used in China and North Korea |
| "PAL-G" | used in Denmark, Finland, Germany, Iceland, Italy, Malaysia, The Netherlands, Norway, Portugal, Spain, Sweden and Switzerland |
| "PAL-H" | used in Belgium |
| "PAL-I" | used in Hong Kong, The United Kingdom, and most of the former colonies (i.e. South Africa, Australia, etc.) |
| "PAL-K1" | used in Guinea |
| "PAL-M" | used in Brazil |
| "PAL-N" | used in France, Paraguay, and Uruguay |
| "PAL-NC" | used in Argentina |
| "NTSC-J" | used in Japan |
| "NTSC-M" | used in Canada, Chile, Colombia, Costa Rica, Ecuador, Haiti, Honduras, Mexico, Panama, Peru, Puerto Rico, South Korea, Taiwan, United States of America, Venezuela, Dominican Republic... |
Usage:

#### TVOutFormat

This option is used to force the output to S-Video or Composite. If this option is missing it will be auto-detected. But be careful because this detection might fail. Possible values are SVIDEO and COMPOSITE.
Usage:

#### ConnectedMonitor

| Value | Effect |
| "CRT" | No effect, because you tell your videocard to use the monitor connected to the 15 pin VGA connector |
| "DFP" | Everything will be printed on the flat panel connected to DVI/HDMI output |
| "TV" | The monitor will be disabled and everything will be displayed on TV connected to the SVIDEO or COMPOSITE output |
| And in all combination for TwinView ||
Usage:

#### A complete device-section

Finally your new device section should look like this:

### The Monitor-section

As mentioned we need to setup a monitor device and define the Horizontal Syncronisation rate and the Vertical Refresh rate. You need not search for those numbers, because usually those numbers are the same for most televisions.

### The Screen-section

To complete the whole configuration we need to add a Screen section that associates the Device and Monitor sections and defines the desired display resolutions.

### The ServerLayout-section

We now have two monitor-sections, two device-sections and two screen-sections. But how does X know what do with with them. Easy answer. There's another section defined with ServerLayout which can be used to switch the used devices. There should already exist a Section for that which controls your current monitor and defines what keyboard and mouse to use. Don't edit it unless you know what your doing. This Tutorial describes how to use several serverlayouts. So we add one more of them using our television Screen section:

### Permissions

On a Debian or Ubuntu system you will have to edit allowed_users in /etc/X11/Xwrapper.config to get permission to start the X server.
If xinit reports "user not authorized to run the X server, aborting", edit the file /etc/X11/Xwrapper.config as follows:
Change this line:
to
Additionally, to connect to the server, you may need to launch X with "X :1 -layout tv -auth .Xauthority"

### Finally

After putting all that into your configuration file we are ready to test the X-Server and write a little script to launch mplayer on the TV.

## Testing Tv-Out

To test the TV out try this from and xterm on your CRT:
Your monitor should turn blank and might switch into Standby (SignalLost messages could also appear). If your TV is connected and the input selection is set correctly you should see the nVidia logo then the mousepointer should appear. To switch between monitor and TV you can use these key combinations:
| Effect |
| CTRL+ALT+F7 | This is the original Xserver with your windomanager running. Your TV turns black. |
| CRTL+ALT+F8 | This will be the tvout. You monitor turns black. |
If those keys don't work, try to zap through all: start from F1 and go up to F12. One should be your windowmanager and another is the television. The others are terminal loginprompts.
(In Ubuntu 7.04 the following has been found with the nvidia-glx driver on a Geforce4 Go 420 on issuing X :1 -layout tv:
This been reported as a bug)
To open a terminal go to your windowmanager, open a prompt and type:
If you now switch back to your TV on F8 there will be a terminal popped up in the upper left corner of the screen. Your config passed the test. We can now try to handle all this in a useful way.
When trying the xterm command above, you may get an error similar to:
This error occurs if your system is using Xauthentication (xauth) to limit who can access a running X server. You need to tell X that you want to allow access from the local machine to display :1. The following command is one long command that is split across 2 lines. It will configure Xauthentication so that display :1 will accept connections from the same sources as display :0. This command was constructed on and it works on Mandriva 2005 LE, and has been seen to work on Fedora Core 5 and Ubuntu 6.06 (Dapper Drake). To configure Xauthentication for local access, open a prompt and type:

## Shutting down the TV-SCREEN

It you want to shutdown the TV-screen session, you can easily use the same procedure as if you want to kill your X-Server.
* Activate the X-Session you want to terminate
* Press ALT + CTRL + BACKSPACE
* Switch back to your regular session and continue as if nothing happened

## Example Scripts to use the TV-Out
### Starting mplayer on TV

To get a command for running mplayer on the TV, create a new file /usr/local/bin/mplayer.tv, with this content:
Use locate or whereis to find the correct path if some commands are located elsewhere. ( FC5: /usr/bin/xinit and /usr/bin/X )
Make the script executeable:
| Parameter | Explanation |
| exec | replace shell with xinit and forward arguments |
| /usr/X11R6/bin/xinit | xinit opens up a new X-Server and runs a command |
| /usr/bin/xterm -ut -e | this is sometimes needed to get the right display |
| /usr/bin/mplayer | the movie player |
| -stop-xscreensaver | we don't want the screensaver active while watching a movie |
| -fs -vo sdl | use fullscreen playback |
| "$@" | forward parameters for mplayer |
| -- | everything coming after this will be parameters for xinit and not mplayer |
| /usr/X11R6/bin/X | this is the X-server we want to use |
| :1 | the new screen will be located at ":1" |
| -layout tv | we use our special ServerLayout "tv" |
You can now play all your videos on TV:

### mplayerstart: Bash script with resume

mplayerstart is a wrapper script for mplayer which allows the user to resume playback of a previously played file, supports several TV-out methods (including the xinit method above), disables screensavers, restores volume levels, and other features. The most recent version may be obtained here: mplayerstart.