Skip to content

Teletext Capture

Last updated 2024-11-17. This document is nowhere near complete.

This will be a ‘living document’ detailing my process for capturing Teletext data from VHS tapes. Hopefully some of this may be useful to others.

The Hardware

VHS player

Currently I’m using a Panasonic NV-VHD1 VHS recorder for VHS playback - you can find more information about this device in the Equipment section of the site.

TV capture card

I’m using a Hauppauge WinTV-HVR-1300-DVB-T PCI card for capture, currently over composite although this card does also support s-video (which would be ideal as the signal would bypass the onboard comb filters - I’m only using composite as my VCR doesn’t output its VHS signal over s-video).

This card used the Conexant CX23882 for broadcast decoding so theoretically any capture card using this chip should be compatible with the stuff on this page.

The software

OS

Currently I’m using Ubuntu 24.04.1 LTS on my capture machine. Most tools and utilities are native to Linux, and the abundance of documentation for Ubuntu made this my choice of OS.

Capture software

The meat of the teletext capture is performed by the excellent vhs-teletext and most of what I’ve implemented is a wrapper based on the functionality this provides.

The Process

MUCH more to follow here…

Grabbing a screenshot during capture

Prior to a capture starting I’m grabbing a quick screenshot from the video feed just to see what was broadcasting when the data was. An absolute nice-to-have but it works well.

Note that if anything else is using the capture card at this time the screenshot will fail. I may be able to work around this in future using v4l2loopback but its very low priority.

Terminal window
mplayer tv:// -tv driver=v4l2:norm=$stream_type:width=$stream_width:height=$stream_height:device=$capture_device:input=$capture_device_input:fps=$stream_fps:noaudio -ao null -vo png:outdir=${tmp_folder}/ -frames 1
mv ${tmp_folder}/00000001.png ${tmp_folder}/${tape_name}_${elapsed_time}.png

Issues and Gotchas

Killing a teletext capture keeps the device locked.

If you’re cancelling a script with ctrl-c that has execute the teletext record command you may find that subsequent attempts fail as the VBI device is still open by the teletext command.

Ideally in the script I want to capture the PID of the process once its started and deal with the process gracefully once the script has received SIGINT, but at the moment I have this running prior to a capture being done.

Terminal window
check_device_available() {
# Checks whether the device is open by another process.
running_pid=$(lsof -t ${vbi_device})
if [ -z "${running_pid}" ]
# Do nothing - no PID returned
else
# PID returned - ask if it should be killed
proc_name=$(ps -p 31627 -o comm=)
read -p "${vbi_device} is in use by ${proc_name}. Kill it and continue? " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "You'll now get asked for sudo permission so the process can be killed."
sudo kill -9 ${running_pid}
else
echo "Cannot continue as device is open by another process."
exit 2
fi
fi
}