This is a "plugin" for the Video Disk Recorder (VDR).

Written by:                  Andreas Kool <akool@gmx.de>

Project's homepage:          http://akool.bei.t-online.de/vdr

Latest version available at: http://akool.bei.t-online.de/vdr/analogtv/download

See the file COPYING for license information.

Description:
------------

Internally, this plugin it a realtime MPEG-1 encoder.

With the help of this plugin you could connect any analogue equipment
to your VDR:

 - bttv compatible analogue tv-cards (i.e. Hauppauge WinTV ...) to
   watch tv-channels which are only available analogue at your location

 - video grabber cards or the s-video input of your tv-card to connect
   your good old VHS-recorder and convert your old recordings into
   *.vdr files

 - your camcorder to watch your vacation videos on the tv-set

 - a webcam (maybe via USB) and watch yourself watching tv ;-)

 - your good old turntable to record your vinyl discs with the vdr


Requirements:
-------------

 - a realtime MPEG-encoder, "mp1e" (http://zapping.sf.net) preferred
   it also works fine with ffmpeg (http://ffmpeg.org)
   or hardware-MPEG-encoder (like the Hauppauge PVR-250/-350)
 - the LIBDVB (http://www.metzlerbros.org/dvb/libdvb-0.5.5.tar.gz)
 - Video for Linux *Two* highly recommended (http://www.bytesex.org/snapshot)
 - ALSA 0.9.3 (or better) highly recommended (http://alsa-project.org)
 - optionally Nextview EPG ("http://nxtvepg.sourceforge.net")
 - optionally hoerzu2vdr (http://www.wontorra.net/filemgmt/index.php)


Installation:
-------------

This plugin is written for VDR 1.1.x and VDR 1.2.x

If you want to use this plugin as a primary device (i.e. you dont have a
DVB- or DXR3-card), you should use at least VDR 1.2.1
(or VDR 1.2.0 + ftp://ftp.cadsoft.de/vdr/vdr-1.2.0-fix-noosd.diff)

It currently needs a patch for VDR to work.

It is probably possible to build the plugin for other versions of VDR,
but don't count on it.

Steps:

As usual, unpack the plugin and make a link:

  cd /usr/src/dvb/VDR/PLUGINS/src
  tar xjf /tmp/vdr-analogtv-x.x.x.tar.bz2
  ln -sf analogtv-x.x.x analogtv

Now you have to install the LIBDVB:

download http://www.metzlerbros.org/dvb/libdvb-0.5.5.tar.gz,
extract in _parallel_ to the DVB directory, and patch

  cd /usr/src/dvb
  patch -p1 < VDR/PLUGINS/src/analogtv/patches/libdvb-0.5.4.patch

(
if you are using dvb-kernel a

  ln -sf dvb-kernel/linux/include include

could be helpfully here ...
)

and install

  cd libdvb-0.5.5
  make
  make install


If you are using a PVR-card, you can skip the following "mp1e" chapter:

Now checkout "mp1e":

  cd /usr/src/dvb/VDR/PLUGINS/src/analogtv
  cvs -d:pserver:anonymous@cvs.zapping.sf.net:/cvsroot/zapping login

(When prompted for a password for anonymous, simply press the Enter key)

  cvs -z3 -d:pserver:anonymous@cvs.zapping.sf.net:/cvsroot/zapping co rte/mp1e
  cvs -z3 -d:pserver:anonymous@cvs.zapping.sf.net:/cvsroot/zapping co rte/src

[
  Or use my last checkout (as of april, 10. 2003) from

    "http://akool.bei.t-online.de/vdr/analogtv/download/rte-10mar03.tar.bz2"

  and extract

    tar xjf rte-10mar03.tar.bz2
]


Now patch mp1e:

  patch -p0 < patches/mp1e.patch

and make it:

  cd rte/mp1e
  ./configure
  make
  make install


now you have to patch VDR:


  cd ...../vdr-1.x.xx

only if you are using VDR-1.2.2 or below:

  patch -p1 < PLUGINS/src/analogtv/patches/vdr.patch

if you are using the autopid-patch:

  patch -p0 < PLUGINS/src/analogtv/patches/vdr-1.2.4-autopid.patch

_or_ if you _dont_ use the autopid-patch:

  patch -p0 < PLUGINS/src/analogtv/patches/vdr-1.2.4.patch

_or_ if you are using vdr-1.3.x:

  patch -p1 < PLUGINS/src/analogtv/patches/vdr-1.3.0.patch

finally compile:

  make
  make plugins

and install.


Now you should be able to start VDR with "-Panalogtv".


Maybe, you could give "ffmpeg" a try:

  cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg login

(When prompted for a password for anonymous, simply press the Enter key)

  cvs -z9 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co ffmpeg

[
  Or use my last checkout (as of april, 1. 2003) from
  "http://akool.bei.t-online.de/vdr/analogtv/download/ffmpeg.tar.bz2"

  And extract

    tar xjf ffmpeg.tar.bz2
]

and make it:

  cd ffmpeg
  ./configure --disable-altivec --disable-audio-beos --disable-dv1394 --disable-network --disable-zlib --disable-a52 --disable-vhook --disable-ffserver
  make install



This plugin needs the wished channels or analogue devices in the file "channels.conf".

The enclosed "examples/channels.conf.analgue.IESY" can be directly appended
to "channels.conf", but the frequencies are only valid in the cabelnetwork 
of Hessen of IESY.


The single fields of the channel definition:

-> "RTL:210250:B6C0D0:C:0:160:80:0:32001:12003:0:0:0"

Name       - name of the channel
Frequency  - Frequency, have a look at e.g. "europe-west.list"
	     Equipment/Inputs without a tuner
	     (like the s-video- or composite-input) should have "1"
	     here (vdr-1.2.6 and above does not like Frequency=0)
Parameters - Norm:
	     B6 = PAL
	     B7 = NTSC
             B8 = SECAM

             Capture device:
             C0  = /dev/video0
             C12 = /dev/video1
             C23 = /dev/video2
             C34 = /dev/video3
             C45 = /dev/video4

             Video source:
             D0  = Television
             D12 = Composite1
             D23 = Composite2
             D34 = S-Video

Source     - fix "C"
Srate      - fix "0"
VPID       - the wished Video PID (arbitrary)
APID       - the wished Audio PID (arbitrary), optionally Mixer-Input-Device
TPID       - the wished Teletext PID (arbitrary)
CA         - fix "32001"
SID        - Service ID (have a look at e.g. enclosed "ChannelMap.h")
NID        - for future use, currently always 0
TID        - for future use, currently always 0
RID        - fix "0" (or arbitrary values to allow doubled entries)


ATTENTION: With analogTV-0.9.11 the syntax of "channels.conf" has changed:

	In former times the video source (0 = Television, 1 = Composite1, 2 = S-Video, ...)
	was in the field Srate, now it is in field Parameter behind the "D".

        In former times the capture device (10 = /dev/video0, 11 = /dev/video1 ...) 
        was in the field SID eingetragen, now it is in field Parameters behind the "C"

        OLD:  RTL:210250:M64:C:0:160:80:0:32001:10:0:0:0
	-----------------^^^
	-----------------------^ Video source
	----------------------------------------^^ Capture device + 10

        NEW:  RTL:210250:B6C0D0:C:0:160:80:0:32001:12003:0:0:0
	-----------------^^^^^^ "B6" -> PAL, "C0" -> Capture device 0, "D0" -> Television
        -------------------------------------------^^^^^ SID of RTL

	Because of these changes unfortunately all analogues EPG-entries will 
	disappear as well as the filetuning settings.


In the column SID should the service ID of the channel be written in with the
help of the enclosed "ChannelMap.h". This makes it possible to program also
analogues channels with the help of the tvtv-plugin without any problems. 


In "channels.conf.analogue.IESY" there are already three example entries for
alternative analogues devices:

-> WEBCam:1:B6C23D0:C:0:160:80:0:32001:65002:0:0:0

A WEBCam, that is connected via USB (as "/dev/video2"). Thus you can have a look
at or record yourself watching tv ;-)

-> Composite:1:B6C0D12:C:0:160:80,6:0:32001:65003:0:0:0

The composite input of the tv-card.
Here you can see how an alternativ mixer-input can be selected (via "Apid2=6"),
that means: normally the sound comes from the input that has been selected in
the OSD-Setup, but if the composite1-input is played, the OSS-device "6" ("Line")
is used.

-> S-Video:1:B6C0D23:C:0:160:80:0:32001:65004:0:0:1

The s-video-input of the tv-card. Thus you can easily convert your old 
VHS-video-tapes in .vdr files ;-)


Once again summarized (because of many demands ;-):

the following columns are crucially

  Frequency
    the frequency of the channel (like in xawtv)

  Parameters
    Which device delievers the video signal of the bttv-driver?
    Here it is crucially in which order the several Video4Linux-driver have
    been loaded.

    If the bttv-driver has been loaded first and the DVB-driver afterwards
    and then a USB-WebCAM, this look like this:

      /dev/video0 - bttv (analogue TV-card) => "C0"
      /dev/video1 - DVB-driver	 	    => "C12" 
      /dev/video2 - USB-WebCam		    => "C23"

    Thus you have to insert "C0" in the column Parameters for the tv-card
    and "C23" for the Webcam.

    Where comes the video signal from? (have also a look at xawtv), e.g. 
    with a Hauppauge WinTV this looks like this:
      0 = Television  => "D0"
      1 = Composite1  => "D12"
      2 = Composite2  => "D23"
      3 = S-Video     => "D34"

    With a PVR this looks like this:
      0 = Composite 0              => "D0"
      4 = Tuner 0     		   => "D45"
      5 = Composite 4 (via Chinch) => "D56"
      9 = S-Video     	   	   => "D89" 


Usage:
------

Simply switch to a channel and watch or record ;-)

Because this plugin represents a complete DVB-card for VDR, all VDR-features
(like timeshifting, timertriggered recordings...) are normally usable.

Better expressed this plugins corresponds to a budget-DVB-card, this means,
that VDR is usable with only a analogue TV-card and this plugin, but 
you cannot *see* anything!

If you also want to watch tv, you need *in*every*case a card having a
hardware-MPEG-decoder (full featured DVB-, DXR3- or Hollywood-Plus-card).
This tv-out-card does not have to be in the computer having the analogues
tv-card, it can be with the use of the streamdev-plugin in any other 
computer (that is reachable over LAN)!

You can reach the settings of the analogTV-plugin via the main menu of VDR
("Setup AnalogTV") or via "Setup->Plugins->analogtv".
At the moment settings are only saved if the menu is selected via
"Setup->Plugins->analogtv" !


The setup is partitioned in several chapters:

In the chapter "Picture Properties" (that only appears if you are watching
a analogues channel at the moment) you can adjust contrast, brightness,
saturation as well as the frequency of the channel.
Every press on [left] or [right] on one of the 5 fields results in an immediat change
that can be observed on the current tv channel.
This *only* works with V4L2! If you are using V4L1 you have to switch to another
analogue channel to let the changes become effective!

Hint: Distortions of the picture can be avoided effectively by _reducing_ the contrast!

In the chapter "EPG" analogues EPG can be imported in VDR.
Therefore Nextview EPG from "http://nxtvepg.sourceforge.net" has to be installed.

By pressing "Load EPG now" the EPG can be directly imported.

Under "EPG from" it is adjusted whether the EPG is directly imported from nxtvepg ("pipe")
or loaded from several ASCII-files ("file"). The "file" mode on the one hand
is for debugging perposes, on the other hand for setups where the analogue tv-card is 
not located in the computer.

The files needed by "file" mode can be generated like this:
  nxtvepg -dump pi -prov FF > /tmp/pi.txt
  nxtvepg -dump ai -prov FF > /tmp/ai.txt
  nxtvepg -dump pdc -prov FF > /tmp/pdc.txt

Under "External programm" you can write any programm in that should be executed
before the import of the EPG-data.
I personally have here:

  "ssh tv nxtvepg -dump pi -prov %s > /tmp/pi.txt"

That means that analogTV gets the EPG-data via ssh from the computer "tv"
when importing automatically the EPG-data.
A possible "%s" is replaced by "EPG provider" discribed futher down.

Under "EPG provider" you have to select which EPG-provider should  
hand over data.
Here at my location there are at the moment 3 EPG-providers:

  9001 TRT
  0dc7 3sat
  0d92 Kabel 1

But it make more sense to merge the providers 3sat and Kabel 1 into a 
"merged database" and to select "FF" as "EPG provider".

Under "Autoupdate (hours)" you can adjust how often the EPG should be 
taken over automatically.

If you register here "0" the analogTV-plugin does *not* automatically 
update the EPG - normally you should register e.g. "24" for "once a day".

Under "Theme language" you can adjust if analogTV should insert the genre
of the broadcasts into the subtitle.

At the Moment the genre is transmitted in 3 different languages:

  eng - English
  ger - German
  fra - French

If one of these three languages is selected, analogTV fills the subtitle
with the genre(s) followed by additional informations like

  Mono
  2-chan
  Stereo
  Surround
  Wide
  PAL+
  Digital
  Encrypted
  Live
  Repeat
  Subtitles
  Rating x (of 1..7)
  age: x and up

A subtitle can for example look like this:

  Soziales/Politik/Wirtschaft Nachrichtenmagazin/Berichte [Stereo, Wide]


If you enter "none" into "Theme language" analogTV does not fill the
subtitle.

Because the names of the stations often differ from these in VDR's
"channels.conf" you can help analogTV importing the EPG with a mapping table.
This mapping table is called "epg.conf" and is located in the plugin
config directory, e.g. "/video/plugins"

This file "epg.conf" may have arbitrary lines of this form:

  VDR-name : nxtvepg-name : mode

When comparing the station names analogTV does _not_ look at lower / upper
case.

The mode defines if all (0) or only entries that are x * 12 hours in the
future should be imported.

Example:

  Das Erste:ARD:1

That means: VDR has a station called "Das Erste". All EPG-entries of the 
nxtvepg-station "ARD" should be imported there, but only those that are
12 hours in the future from _now_.

That feature allows to import analogues EPG-data for digital stations!
Here in the cabel network of Hessen the digital EPG is of much better
quality but only reaches one day into the future. The analogues EPG is
of lower quality but reaches about 8 days into the future.

So with the entry above the EPG of "today" comes from the digital EPG
but the entries of the 8 following day come from the analogues EPG.

The enclosed "examples/epg.conf.IESY" can be copied directly but 
should eventually be adapted.

While analogTV imports the EPG it writes a protocol into the file
"/tmp/epg.err". This file should be examined after the first EPG-import
for eventually occuring errors!
You should look with special attention on the section:

  Unknown channels are:
  Name=TRT - 131 event(s)
  Name=Tele5 - 57 event(s)
  Name=ORF2 - 110 event(s)

This example above says that analogTV has several EPG-entries for the
nxtvepg-stations "TRT", "Tele5" as well as for "ORF2" but cannot export
these into VDR because it does not know into which VDR-stations the data
should be exported.

In my case this is OK because I cannot receive any of these stations.

Nxtvepg does unfortunately not recognize if analogTV is running at
the moment. Therefore analogTV kills an eventually running nxtvepg
before switching to an analogues station and restarts nxtvepg after
longer remaining on a digital station (in "-daemon" mode).

Unfortunately nxtvepg does _not_ work with PVR cards because the 
PVR-cards does not support vbi as told by Hauppauge.

But it's possible to get the EPG from internet using the tool hoerzu2vdr
(http://www.wontorra.net/filemgmt/index.php).

To do so, you will have to do the following steps:

  1. download http://www.wontorra.net/filemgmt/visit.php?id=7
      and extract it e.g. to /video/hoerzu2vdr

  2. configure it as described in the enclosed README, under "examples/hoerzu2vdr"
      you will find my configuration (only valid for IESY, Hessen, Germany).
      for newbies: don't forget to do "chmod +x start.sh" :-)

  3. Apply the following settings in the OSD-Setup of the analogtv-plugin:
      EPG from:			hoerzu2vdr
      External program:		cd /video/hoerzu2vdr && ./start.sh &
      Autoupdate (hours):	72

From now on you will all 3 days automatically get the analogues EPG for the next 
7 days from the internet.


In the section "MPEG Encoder" you can adjust serveral parameters of the
MPEG-encoder. For Experts only ;-)
Important here: The most changes become only effective if the "Restart"
button is pressed because then the MPEG-encoder will be restarted!

Under "Encoder" you can select the MPEG-encoder you want to use.
At this moment (November 18. 2003) the support of the serveral encoder
looks like this:

  - mp1e       - works, at this moment the best choice

  - ffmpeg TS  - does NOT work (TS is only supported from version ffmpeg-0.4.7 and higher)

  - ffmpeg PES - works, but my Athlon 1200 has not got enough power
                 to deliver a distortionfree picture.

  - fame       - does NOT work - a muxer that repacks Audio and Video is still missing

  - test       - just for debugging, do not use

  - lavrec     - does NOT work - the delievered .avi still has to be converted
                 to MPEG-1

  - mencoder   - does NOT work - at the moment mencoder (still?) cannot output
                 MPEG-1/2 Layer II Audio

  - PVR TS     - not recommended, audio is stuttering
    	       	 please use PVR PES 

  - PVR PES    - have a look at the chapter PVR

  - nvrec TS   - does NOT work, because nvrec-20030316 only supports ffmpeg-0.4.6
                 but TS will be only supported from version ffmpeg-0.4.7 on

  - nvrec PES  - works, but should only be used with the GOP sequenz "I"
                 (only I-frames) (else there a constantly color errors).
                 There is only sound using "Mono", A/V is most times asynchronous,
                 after 2 .. 4 minutes running there are ring buffer overflows 
                 within VDR, but contrary to mp1e there are no picture distortions!


The entry "Video bit rate" is the most important one!
Here everyone has to find the optimal compromise between cpu load
and picture quality on it's own.
From 2,3 Mbit/s on the picture quality becomes acceptable, but there
a still distortions at fast changes of scenes or action scenes.
From about 5 MBit/s on I would speak of DVD-like quality (I personally
use 5 MBit/s).
It's very important to keep the cpu load *below* 90%, else the necessary
framedrops will soon cause a/v-asynchronity.

Under "Image size" the picture size that should be encoded can be adjusted.
Here this basic rule applies: The bigger, the better is the picture quality
and the higher is the cpu-load. 
All here selectable sizes can be scaled to 720x576 by the hardware on the
DVB-card.

With "Clipping" you select that the encoder does not have to encode
16 pixel on the left and on the right.

Anyone who want's to know what GOP-sequence means, should buy a book
about MPEG...
Generally "I" causes the lowest cpu load and "IBBPBBPBBPBBP" produces
smaller file (when recording).
Additionally fast forward/rewind _only_ works with the GOP-sequence
"IBBPBBPBBPBBP".

Also an explanation of "Filter" would be too much for this README,
generally can be said:
"1 YUV 4:2:0 fastest" is the fastest, and "8 YUV 4:2:0 v-decimation"
produces the best picture quality.

"Motion compensation" causes the second highest cpu load and should
stay "0" (disabled) - anyone who wants can experiment with values
between 4 and 64.

"Deinterlacing" makes it possible to calculate the method used for
interlaced scanning. Therefore you should parallely select the filter
"9 YUYV 4:2:2 h-decimation".

All parameters above are discribed also in the manual-page of the
MPEG-encoder "mp1e" ("man mp1e").

With "Profile" you can select a few encoder options that make sense:

 - "fastest (weakly CPU)"  - for very weak CPUs (VIA Eden ...)
 - "medium (like akool)"   - As I use the plugin 
 - "best (strong CPU)"	   - optimal picture quality (from Pentium 4/3000 on :-)
 - "low filesize"	   - very bad picture quality and very small file size, for
			     recordings without any value.
 - "PVR"      		   - optimally settings for a PVR-card
 - "Automatic"		   - automatically switching between PVR and medium


In the section "Audiodevice" you can select from where the analogTV-plugin
gets the sound. (As you know you connected the soundcard and the tv-card with
a cable...)

When using the OSS-sound drivers (no matter if native or ALSA-emulation)
you insert here:

PCM device      : /dev/dsp
OSS Mixer device: /dev/mixer
OSS Mixer input : Line, Line1, CD ... depending upon used input

and when using ALSA:

PCM device      : alsa/default


Under "Audio mode" you can switch between mono and stereo.
Here also "Dual channel" (for broadcasts with 2 languages) is possible,
but then you have to select the wished channel on your a/v-receiver.


In the section "Various" there is the following:

The entry "Debug level" defines how much debug-output the plugin 
produces. Attention: When > 2 there will produced much output
(Up to a complete dump of the MPEG-frames)!
Anyone who want's to submit a bug report should *please* set the
debug level to 3 and attach it to the mail!

With "Hide Mainmenu Entry" you can suppress the entry in VDR's main
menu und with "Encoder always running" it is possible to let the
encoder run all the time - that means also when switching channels,
that makes switching much faster.
Also this _only_ works with V4L2!
When VDR is a few minutes not any longer on an analogues station the
encoder will be terminated also with this setting.


In the section "Interna" (Read only) you can see a few internal variables.


PVR:
----

Since analogTV-0.9.15 the Hauppauge PVR-card's (with onboard MPEG-2-_encoder_)
are supported!

The MPEG-decoder of a PVR-350 is not supported!

Therefore you have to do the following steps:

1. The according driver has to be downloaded from "http://ivtv.sf.net":
     cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ivtv login
     cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ivtv co ivtv
     
     patch < patches/ivtv-0.1.9.diff

     cd ivtv/ivtv/driver
     cp ../utils/videodev2.h .
     make

2. The PVR-firmware has to be installed:
     cd ../utils 
     ./ivtvfwextract.pl

3. This driver has to be loaded:
     cd /usr/src/dvb/ivtv/ivtv/driver
     modprobe i2c-algo-bit
     modprobe tuner type=5 # for a PAL-tuner
     insmod ./msp3400.o once=1 simple=1 debug=2
     modprobe videodev
     insmod ./saa7115.o
     insmod ./ivtv.o debug=1 mpg_buffers=100 video_nr=0
     # insmod ./tveeprom.o
     # ../utils/test_ioctl -u 0xff -p 4 -f width=480,height=576

     Importantly: The ivtv-driver should be the _first_ V4L-driver!
   	    	  With the module-option "video_nr=X" its possible to
                  declare the minor device number ("/dev/videoX") 
                  of the driver

4. In the OSD-Setup of the analogTV-plugin use the following settings:
     Encoder:                 PVR PES
     Video bit rate: 	      18
     Audio bit rate: 	      192
     Image size: 	      480x576
     Encoder always running:  Yes

     You could use other settings like for example:
     Video bit rate: 	      55
     Audio bit rate: 	      224
     Image size: 	      720x576
     but this leads to rather huge recordings.


Sky/NTL/Telewest Digibox:
-------------------------

From 0.9.30 onwards, the plugin supports control of Sky, NTL and Telewest
digiboxes using a redremote IR blaster (http://www.redremote.co.uk/serial),
only Sky mode has been tested as of yet. Red dot killing is also supported
- enable backup hack in the options.

Channel lines in channels.conf should be defined with the digibox 
channel number in the frequency field - a sample channel file is supplied 
in examples/channels.conf.analogue.sky.


Performance:
------------

I have been ask many times how much cpu-power is needed for the MPEG-encoder.
So far I can say this:

 - here on my P4 2400 the encoder needs about 3% CPU
 - here on my Athlon 1200 interestingly enough about 50% CPU
 - on Sascha's Duron 800 the encoder needs about 20% CPU
 - on Stefan Preuss' Duron 1100 the encoder needs about 15 .. 30% CPU
 - on Renes Duron 1200 the encoder needs about 20 .. 30% CPU
 - on Tobias VIA C3 1 GHz the encoder needs about 50% CPU 
 - Andre Neumann uses the encoeder with full (720x576) resolution,
   8 MBit video bitrate, 160 KBit audio bitrate on an Athlon XP 1800+,
   and has a load of about 30%.


Tips and tricks:
----------------

 - Anyone using SuSE-8.1 or SuSE-8.2 can use Video4Linux 2 by typing

     modprobe bttv09

   which improves performance and stability a _lot_!

 - The bttv(09) modul should be loaded whith the option "gbuffers=24" 
   to increase the amount of internal grabbing-buffers.
   (24 is the optimal value for the standard-GOP-sequenz "IBBPBBPBBPBBP")

     modprobe bttv09 gbuffers=24 gbufsize=1000000

   (Alternatively this can happen in "/etc/modules.conf")

 - The modul msp3400 should be loaded with the option "once=1".


 - While the analogTV-plugin is in use there should no external
   prozesses adjust the system time because it is very important
   for the a/v-synchronisation!

   So throw away

     - ntp
     - netdate

   and similar programms!

 - Anyone using a tv-card with a Bt878-chip ... a "lspci" shows something
   like that:
     [ ... ]
     00:0a.0 Multimedia video controller: Brooktree Corporation Bt878 (rev 02)
     00:0a.1 Multimedia controller: Brooktree Corporation Bt878 (rev 02)
     [ ... ]
   (as you see _two_ Bt878 entries), does possibly *not* need a sound card!

   It suffices completely to load the modul "btaudio"

     modprobe btaudio

   and to use the new appearing "/dev/dspX"
   (Have a look at "/usr/src/linux/Documentation/sound/btaudio")

   If the btaudio-driver works with xawtv but not with mp1e probably
   applying the patch "patches/mp1e_btaudio.diff" helps.

   Unfortunately the MSP34xx on the "Pinnacle Systems Studio PCTV pro" (my card :-( )
   is not connected correctly to the Bt868 chip, so the btaudio-driver
   does not work with e.g. this card.

 - When using a weak cpu it can probably help to increase the grabbing-buffer 
   within "mp1e". Have a look at "patches/mp1e.buffer.patch". Unfortunately
   after applying this patch the sound does _only_ work with "Mono", when 
   selecting "Stereo" there will be no sound any more!


Problems:
---------

All problems known to me are listed in PROBLEMS. Please read this file
*before* sending mail to me or to the mailing list - Thanks!
Further tips can be found in the file "FAQ" ;-)

Furthermore there exists a HOWTO that can be found at 
http://www.phonedation.de/VDR/AnalogHowTo.txt !

Here the most important things concerning a/v-synchronization (here
with me the plugin is absolutely sync since version 0.8.8 and that
also _for_ _hours_!)

 - If you have got a/v-asychronity _directly_ after switching to a
   analogues channel and the sound arrives about 1 second before
   the picture, then the sound does *not* come from the analogtv-Plugin,
   but directly from the sound/tv-card! There is something wrong
   with your mixer settings!
 - V4L2
 - ALSA (0.9.6 or better)
 - always use the newest plugin version
 - when updating the plugin always install mp1e _completely_ new with
   the enclosed patch 
   (that means download "rte-10mar03.tar.bz2", extract it, patch it like
   described above, make and make install!)
 - _decrease_ the video bitrate until the system load is under 90%
 - use the default-settings of the plugin in the OSD-setup 
   (best use the profile "medium (like A.Kool)" )
 - care that the signal qualitiy is a good as possible and eventually
   optimize finetuning
   (completely "snowy" channels cause substantial framedrops)
 - deactivate processes that adjust the system clock (ntp, netdate ...)


If the encoder mp1e cannot be compiled/linked this is in most time
caused by broken sound driver installations.
To fix this quickly remove (after ./configure) in the file 
"rte/mp1e/config.h" the line(s)

  #define HAVE_ALSA
  #define HAVE_ESD

or

  #define HAVE_OSS


If the compiler failes with:

make[3]: *** [mpeg2.lo] Error 1

(a sign for a too old gcc), you can change the line number 44
in the file "rte/mp1e/mpeg2.c" from

  #if 1 // def OPTIONS_M2I

to

  #if 0 // def OPTIONS_M2I

 - afterwards mp1e should compile.


If the module "memcpy.c" does not compile, 

gcc version 2.95.4 e.g. prints:

memcpy.c:220: parse error before `::'

this can be solved by _deleting_ the line

HAVE_FAST_MEMCPY = 1

and with that deactivating MMX enhanced memcpy() in the "Makefile".


If mp1e stopps immediately with the message

mp1e:mmx.c:172: Failed to identify CPU (2, No such file or directory)

you should think about buying a more up to date CPU ;-)

If nothing works:
Start vdr in the _foreground_, that means enter "vdr -Panalogtv"
in a linux console. Then enter the analogTV's OSD-setup and 
set "Debug level" at least to 1, better to 3 as well as 
"Debug output" to "stdout".
Now you can observe exactly what happens - or what goes wrong - 
when switching to an analogues channel.

Anyone who cannot solve his problems on his own should set "Debug output" to
"file", switch 1 .. 2 time between analgues channels and then
mail the file "/tmp/analogTV.log" to akool@gmx.de .

Finally I do have two request: First I am very happy about every (working)
mailed "channels.conf" and also "epg.conf" that I can provide it 
to the other users.
Second I am very happy about "/tmp/analogTV.rep" report files!
I you have got a satisfying configuration of the analogTV-setup 
please set "Report" to "yes" in the OSD-setup and then let in run 
for at least 5 minutes. Then switch to another channel (no matter 
if analogues or digital) and now mail the file "/tmp/ananlogTV.rep"
to akool@gmx.de . These files help me to provide in future times
a automatical and optimal, cpu-depending configuration of the MPEG-encoder.


Anyone using VDR _without_ DVB-card, that means if you use the
analogTV-plugin as a primary device, can use EPG by _activating_
the line

# NEED_OWN_SIP = 1

in the "Makefile".


Used files:
-----------

/usr/local/bin/mp1e
  The MPEG-encoder

/tmp/.analogtv.avi
  Named pipe - the MPEG- data channel between the encoder and the plugin

/tmp/mp1e.log
  Statistics of the MPEG-encoder

/tmp/analogTV.log
  All debug-/errormessages of the plugin if "Debug output" 
  is set to "file" in the OSD-setup.

/tmp/analogTV.rep
  Report of all available parameters if in the OSD-Setup "Report" is set to "Yes".

/video/plugins/epg.conf
  Configuration of the EPG-import

/tmp/epg.out
  Intermediate product of the EPG-import

/tmp/epg.err
  Error protocol of the EPG-import

/tmp/pi.txt
/tmp/ai.txt
/tmp/pdc.txt
  Intermediate products of the EPG-import


Thanks:
-------

This plugin is based on the work of

 - Michael H. Schimek <mschimek@users.sourceforge.net> (MPEG Encoder)
 - Dr. Marcus Metzler <mocm@metzlerbros.de> (PES->TS Remuxer)
 - Rene Bredlau <murray@blubber.de> (better PES->TS sowie TS->PES Remuxer)
 - Tom Zoerner <tomzo@users.sourceforge.net> (Nextview EPG)

without their work in the past the plugin could not exist.

Furthermore I want to thank:

 - Klaus Schmidinger <kls@cadsoft.de> for VDR and many useful tips

 - Sascha Volkenandt <mailbot1@wat.willz.de> for many useful tips

 - Rene Bredlau <murray@blubber.de> for several patches and above all a working
   PES->TS as well as a TS->PES remuxer.

 - my wife Claudia-Louise <clw@akool.de> for most times being patient when 
   I was coding until late at night. 

 - Tobias Bratfisch <bratfisc@informatik.tu-muenchen.de> for the support
   of the VIA C3 and the english README.

 - Alexander Damhuis <ad@phonedation.de> for the HOWTO

 - Guido Fiala <gfiala@s.netic.de> for the
   "channels.conf.analogue.BaWue-Boeblingen" and many useful tips.

 - Karsten Jaschultowski <hell@wurstgurke.de> for the
   "channels.conf.analogue.ish-NRW"

 - Andre Neumann <chef@andre-neumann.de> for the
   "channels.conf.analogue.ish-NRW-Breitbandausgebaut"

 - Petric Frank <pfrank@gmx.de> for the
   "channels.conf.analogue.Kabel-Baden-Wuerttemberg"

 - Nikolai Zhubr <s001@hotbox.ru> for the aiw-patch

 - Lars Altenhain <lars@altenhain.de> for the support of 
   Hauppauge PVR-x50 - cards 

 - Karsten Mueller <kmu@ratio.de> for the
   "channels.conf.analogue.Hamburg"

 - Jan Wagner <skywalker@wh2.tu-dresden.de> for the
   "channels.conf.analogue.Dresden"

 - Uwe Ortner <uwe.ortner@classic-net.de> for the   
   "channels.conf.analogue.Muenchen"

 - Wolfram Pienkoss <wp@bszh.de> for the
   "channels.conf.analogue.Stadtroda(like-Jena)" and the
   "channels.conf.analogue.Stadtroda(like-Jena)-PVR"

 - Christian Kopmann <christian@kopmann.com> for the
   "channels.conf.analogue.DITRA(Großraum_Karlsruhe)"

 - Dominik Strasser <dominik@die-strassers.de> for Siemens-analog-module
   enhancements 

 - Javier Marcet <lists@marcet.info> for the Audio sample rate
   enhancement

 - K.S.Herrmann <pddrksh@t-online.de> for the
   "channels.conf.analogue.KabelBW"

 - Dominic Morris <dom@suborbital.org.uk> for the Sky Digibox
   support with the redremote ir blaster 
   (http://www.redremote.co.uk/serial/index.html) and the
   "channels.conf.analogue.sky"

 - Andre Puschmann <apuschmann@apucs.com> for the
   "channels.conf.analogue.Erfurt"

 - Michael Koehler <mkoehler@psr.de> for the
   "channels.conf.analogue.DTKabel-Leipzig"

 - Nicolas Gerlach <nicolas.gerlach@gmx.de> for the
   "channels.conf.analogue.Bremen"

 - Petric Frank <pfrank@gmx.de> for the
   "channels.conf.analogue.KabelBW-Ludwigsburg"

 - Thomas Nau <thomas.nau@kiz.uni-ulm.de> for the
   "channels.conf.analogue.KabelBW-Ulm_Laupheim"

 - Martin Brodbeck <Martin.Brodbeck@gmx.de> for the
   "channels.conf.analogue.KabelBW.DettingenErms"

 - Andreas Fey <andreas@andreas-fey.com> for the
   "channels.conf.analogue.Telecolumbus-Sachsen-Thüringen.Jena,Landgrafen-Damenviertel"

 - Winfried Köhler <handygewinnspiel@gmx.de> for the
   "channels.conf.analogue.Berlin-Bosch"

 - Angelo Lambiasi <a.lambiasi@radiomarelli.com> for a bugfix.

@TRANSLATE_BEGIN
vdr-1.3.x:
----------

Seit dem 4. Januar 2004 unterstützt das analogTV-Plugin die neue
Developer-Version 1.3.x des VDR.

Folgende Änderungen gegenüber dem oben gesagten ergeben sich:

  1. In die 9. Spalte (CA) der "channels.conf" ist nun nicht mehr
     "32001", sondern "A0" einzutragen.
@TRANSLATE_END


have fun

Andreas Kool <akool@gmx.de>

Version Information: $Id: README,v 1.89 2005/01/13 20:04:06 akool Exp $
Release Information: $Name:  $
