vbi2srt is a program for Linux to read Teletext data from a IVTV television card (e.g. Hauppauge PVR-350), extract the subtitles from the VBI data stream and write a subrip file. MPlayer automatically reads the subrip file and displays the subtitles. The program was inspired by Johan Duinkerken who developed the original concept of extracting subtitles from teletext data.
This implementation uses Unicode (UTF8) so glibc needs Unicode support.
Video Programming Signal (VPS) support has been added, this means that when a broadcaster sends a VPS and the times match then program is recorded more precisely. vbi2srt starts recording immediately and if a matching VPS signal is received then the video and subtitle files are rewound and the program is recorded until the VPS signal indicate that the transmission is complete.
There is a timing problem with the subtitles that vbi2srt generates and the VPS signal. MPlayer displays subtitles based on the timecode in group of pictures (GOP) timecode which is not reset when the program stream is rewound whereas the timings of the subtitles are reset. The best fix is to read the time from the GOP header and use this time for the subtitle display. Alternatively, reopen the mpeg stream which reset the timecode.
To embed VBI data into a MPEG file use:
ivtvctl -x 1 -b teletext
ivtvctl -x 1 -b teletext,wss,vps (also embed Video programming signal (VPS). Wide screen signalling (WSS))
MPlayer should be set up to have a /usr/share/mplayer/subfont.ttf or ~/.mplayer/subfont.ttf linked to a truetype font such as myriad.ttf or arial.ttf.
vbi2srt_record.py is a freevo-1.5.4 vbi2srt record server plug-in, included in the vbi2srt tar
file.
This plug-in goes into the /path/to/python2.3/site-packages/free/tv/plugins (usually /usr/lib or
/usr/local/lib).
To activate the plug-in use:
plugin.remove('tv.generic_record')
plugin_record = plugin.activate('tv.vbi2srt_record')
| -h | --help | print help and exit |
| -V | --version | print version and exit |
| -C | --chart | print character mapping chart and exit |
| -v | --verbose | print verbose information |
| -d | --debug | print debug information |
| -x | --hex | print HEX codes |
| -a | --ascii | print ASCII characters |
| -c | --colour | if colours are used in teletext output add colour codes to srt file |
| -tNUMBER | --time-offset=NUMBER | time offset for subtitles (msecs) |
| -SNUMBER | --seconds=NUMBER | recording duration (secs) |
| -MNUMBER | --minutes=NUMBER | recording duration (mins) |
| -iSTRING | --video-in=STRING | video input device or file (default /dev/video0) |
| -oSTRING | --video-out=STRING | video output device or file (default /dev/video16) |
| -mSTRING | --mpeg-decoder=STRING | video mpeg decoder device (default /dev/video16) |
| -bSTRING | --vbi-device=STRING | vbi device (default /dev/vbi0) |
| -PSTRING | --vps=STRING | use VPS (secs or HH:MM) (video programming signal) (no default) |
| -sSTRING | --srt=STRING | subrip file (default <video-in>.srt) |
| -pNUMBER | --page=NUMBER | page number for subtitles (100-899) (default none) |
vbi2srt -h
prints the usage.
vbi2srt -i <mpeg file> -p 881 -t -12
reads the mpeg file and writes /dev/video16, subtitles are shifted 12msec earlier)
vbi2srt -o <mpeg file> -p 888 -v
reads /dev/video0 and writes the mpeg file, verbose output.
vbi2srt -o <mpeg file> -p 881 -P <seconds>
reads /dev/video0 and writes the mpeg file used VPS to control the start and stop recording
times.
vbi2srt-0.1.11.tar.bz2 fixed a memory leak
(ouch).
vbi2srt-0.1.10.tar.bz2 corrected the synchronisation of the freevo
plugin and vbi2srt.
vbi2srt-0.1.9.tar.bz2 changed to act as a filter, requires mpeg
decoder chip, i.e. PVR-350.
vbi2srt-0.1.8.tar.bz2 changed subtitle colour codes to none. -c
enabled colour codes back.
vbi2srt-0.1.7.tar.bz2 changed default subtitle page to none, updated
freevo plug-in to take subtitle page from sixth parameter to TV_CHANNELS.
vbi2srt-0.1.6.tar.bz2 fixed a VPS argument bug, changed VPS so it
records if the VPS is waiting, it+es character sets, tidied up messages.
vbi2srt-0.1.5.tar.bz2 (experimental) added support for VPS (Video
programming signal), changed time-offset to msec.
vbi2srt-0.1.4.tar.bz2 added freevo support, changed command line
options.
vbi2srt-0.1.4-ms.patch.bz2 patch to convert the time offset to
ms.
vbi2srt-0.1.3.tar.bz2 added colour support, fixes for pages with
normal Teletext.
vbi2srt-0.1.2.tar.bz2 changed vbi reader to a thread.
vbi2srt-0.1.1.tar.bz2 initial version (don't use).
There are several thing that should be done including using libzapping to teletext capture, and updating the remaining languages. For IVTV cards that write mpeg data the program should write upto the next GOP when the program is terminating. Rewrite vbi2srt to read the vbi in the main thread and the mpeg stream in a child thread this will allow better VPS processing.