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/download
See the file COPYING for license information.
Internally, this plugin it a realtime MPEG-1 encoder.
With the help of this plugin you could connect any analogue equipment to your VDR:
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 < VDR/PLUGINS/src/analogtv/patches/libdvb-0.5.4.patch
and install
cd libdvb-0.5.5
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
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/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:A0: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 "A0" 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:A0:10:0:0:0 -----------------^^^ -----------------------^ Video source ----------------------------------------^^ Capture device + 10 NEW: RTL:210250:B6C0D0:C:0:160:80:0:A0: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:A0: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:A0: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:A0: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: 4 = Tuner 0 => "D45" 0 = Composite 0 => "D0"
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 inevery*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:
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:
If one of these three languages is selected, analogTV fills the subtitle with the genre(s) followed by additional informations like
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).
@TRANSLATE_BEGIN
Leider arbeitet nxtvepg nicht mit einer PVR Karte zusammen, da laut
Hauppauge die PVR-Karte kein vbi unterstützt.
Daher ist es möglich, das EPG auch mittels des Tools hoerzu2vdr (http://www.wontorra.net/filemgmt/index.php) aus dem Internet zu übernehmen.
Hierzu sind folgende Einstellungen vorzunehmen:
Ab sofort wird nun alle 3 Tage vollautomatisch das analoge EPG für 7 Tage
im voraus aus dem Internet beschafft.
@TRANSLATE_END
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:
to deliver a distortionfree picture.
to MPEG-1
MPEG-1/2 Layer II Audio
please use PVR PES
but TS will be only supported from version ffmpeg-0.4.7 on
(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:
recordings without any value.
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.
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:
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.
I have been ask many times how much cpu-power is needed for the MPEG-encoder. So far I can say this:
modprobe bttv09
which improves performance and stability a lot!
modprobe bttv09 gbuffers=24 gbufsize=1000000
(Alternatively this can happen in "/etc/modules.conf")
So throw away
and similar programms!
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.
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 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
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".
This plugin is based on the work of
without their work in the past the plugin could not exist.
Furthermore I want to thank:
have fun
Andreas Kool <akool@gmx.de>