Skip to content
itewreed edited this page Oct 4, 2024 · 12 revisions

Capture Guide

This guide goes over the capture and handling of Teletext data.

Preparation

There are 2 ways to go about capturing VBI data,

Capture the whole signal from a VCRs test points and software decode it. (this changes VCR requirements to anything with good working heads)

or

Capture a portion of it alone via conventional signals e.g composite/s-video.

VHS-Decode Method (RF Capture + Software Decoding)

vhs-decode / ld-decode / cvbs-decode

BBC Testcard F 1994 VHS sample

Decode Teletext form decoded TBC files

Decode "Deconvolve" Teltext Data With

teletext deconvolve -c ddd-tbc INPUT.tbc

View Teletext Data With

teletext vbiview -c ddd-tbc INPUT.tbc

Conventional Method

Using a BT8x8 capture card, or similar, the capture is done by the following command

teletext record > capturefile.vbi

Alternatively it is possible to use the following command if the v4l2 tools are installed

v4l2-ctl -d /dev/vbi0 --stream-mmap --stream-to=capturefile.vbi

v4l2 Tools - For setup and fine-tuning

To be able to check the settings of the capture-card install the v4l2 tools

sudo apt install qv4l2

Then open that tool and select input, colour-mode and resolution and hit play. This will set the parameters and open a TV window and displays video. In most cases it is a good idea to stop the playback again, as it can interfere with the teletext capture.

Before capturing any teletext data from /dev/vbi0 it is a good idea to tune to best decodable teletext. You can use vbiview to do this. Vbiview can directly read from the device which usually is the capture device.

teletext vbiview /dev/vbi0

Then check the displayed lines. Green lines are the ones recognized as teletext. By clicking on them they are live deconvolved to stdout aka the terminal window. Tune your VCR for the best decode you can get. So the better you tune your VCR, the better a line is readable. This can take a while. Also it can be, that it differs from tape to tape. Especially longplay recordings are tricky and it can be a hit or miss to be able to deconvolve them.

Alternatively use

teletext deconvolve /dev/vbi0 -r 0

This will deconvolve the top line and is acceptable to tune the VCR as well. But be aware, that deconvolve might not be realtime and changing settings on the VCR might materialize with a lag of several seconds.

Sometimes non teletext data is recognized as teletext. There is no solution to it yet, only a workaround. To omit lines from deconvolve, the raw VBI stream has to be edited in an editor like virtualdub2 and the miss-detected lines need to be overpainted with black.

Naming

Standard naming
A proper naming is essential to identify what you've captured. The basic info should contain the name of the channel and the airdate. Also it is convenient to have a tape numbering. So the following layout could be handy tape<number>_channelname_date
An example capture then could look like this tape001_bbc1_2001-11-26.vbi. The date is in ISO 8601 notation, as this can be read by most systems. One of them is the Teletext Archaeologist page where bulk uploads use the channel name and a date in the filename to automatically name and date the uploads.


Adding technical specs
An extended form could include the tapespeed and the VCR model used. tape001_bbc1_2001-11-26_lp_hd630.vbi
In this case the tape was recorded in longplay and playback for capture was done with a Panasonic NV-HD630.
For the PAL variant of VHS the speeds of SP (Standard Play), LP (Long Play) and EP or SLP (Enhanced / Super Long Play) exist.

Another option would be to include the VCR system as well, cause there existed other systems like Betamax, Video2000, VCR, S-VHS etc.


Geographic information
To make the list complete also specific information about the recorded channel could be added. An example would be from which region of a national station the teletext is, as there can be different teletext content on the same program in different regions.

On some public broadcasters in Germany there was a special page showing the transmitter or region the signal was broadcasted from. This counted mostly for terrestrial broadcast. It could have been on page 195, 198 or 199.


Anomalies
Public broadcasters in Germany aired identical teletext on both national and all the regional channels throughout most of the 1980s. In the late 1980s the regional channels started to broadcast their own teletext information. So archival wise everything till the late 1980s could be labelled under the first national television ARD.

Editing

On the fly editing

FFMpeg is capable of on-the-fly editing of captured files. This especially comes in handy if certain lines in the capture disturb the deconvolve process. The ffmpeg output can directly be fed into vbiview or the deconvolve process

Blanking lines out

In most use-cases certain lines have to be blanked out which are falsely detected as teletext, like test signals. For this the drawbox filter is used.

The following example blanks out lines in a VBI file, captured with a bt8x8 capture card, and sends the output to vbiview

ffmpeg -f rawvideo -s:v 2048x32 -pix_fmt gray -r 25 -i input.vbi -vf drawbox=0:0:2048:4,drawbox=0:9:2048:4,drawbox=0:15:2048:4,drawbox=0:25:2048:4,drawbox=0:31:2048:1 -c:v rawvideo -f rawvideo -pix_fmt gray - | teletext vbiview

drawbox=x:y:w:h

  • x gives position in the horizontal and usually should stay at 0.
  • y is the line position an can go from 0 to 31, as there are 32 lines of vbi here
  • w is the width and depends on the capture setup, for bt8x8 it's 2048
  • h is height and corresponds to how many lines to draw over, starting from y position. So several lines can be drawn over at once

The same modificatons can directly be fed to a deconvolve process

ffmpeg -f rawvideo -s:v 2048x32 -pix_fmt gray -r 25 -i input.vbi -vf drawbox=0:0:2048:4,drawbox=0:31:2048:1 -c:v rawvideo -f rawvideo -pix_fmt gray - | teletext deconvolve

The same can be done with domesday86 captures, but the values differ a bit

ffmpeg -f rawvideo -s:v 2270x626 -pix_fmt gray -r 25 -i domesday.tbc -vf drawbox=0:21:2270:1,drawbox=0:327:2270:1 -c:v rawvideo -f rawvideo -pix_fmt gray - | teletext vbiview -c ddd-tbc

Here the width has to be 2270 in order for the correct dimensions. Also the line numbering is different as the fields contain the whole picture and TBC files contain even 626 lines. So y for the first field of teletext ranges from line 06 - 21 and for the second field from line 319 - 334. The example takes that into account.

Non-linear editing

Sometimes it is necessary to edit the captured VBI files itself. To load them into an editor like virtualdub2, the following format definitions have to be set

When captured using..
BT8x8 card

  • Frame rate 25
  • Width 2048 pixels
  • Height 16 pixels
  • Input Format Grayscale, 8-bit

CX88 card

  • Frame rate 25
  • Width 2048 pixels
  • Height 18 pixels
  • Input Format Grayscale, 8-bit

TBC File

  • Frame rate 25
  • Width 1135 pixels
  • Height 626 pixels
  • Input Format Grayscale, 16-bit
  • Scan line alignment 2 bytes

VBI'ed TBC File

  • Frame rate 25
  • Width 1135 pixels
  • Height 16 pixels
  • Input Format Grayscale, 16-bit
  • Scan line alignment 2 bytes

SAA7131 card

  • Frame rate 25
  • Width 1440 pixels
  • Height 16 pixels
  • Input Format Grayscale, 8-bit

Export is done as raw video
Be aware, that editors might handle resolutions not divide-able by 2 incorrectly.

Compression

The raw captures can be compressed and decompressed using flac. Usually, this tool is used to compress to lossless audio. As our capture is basically also a digitized AC waveform, like audio, the tool works the same way.

Compress a file
flac --best --sample-rate=48000 --sign=unsigned --channels=1 --endian=little --bps=8 --blocksize=65535 --lax -f <file> \

Decompress a file
flac -d --force-raw-format --sign=unsigned --endian=little <file>

This should compress the captures roughly by 60%.

The decompressed output can be directly piped to the teletext tool. So compressed files can be deconvolved on the fly without an intermediate decompressed file. To do so the -c option has to be used in the flac command, as it pipes the output to stdout instead of a file.
flac -c -d --force-raw-format --sign=unsigned --endian=little tape001_bbc1_2001-11-26.flac | teletext deconvolve