A fork of LD-Decode, the decoding software powering the Domesday86 Project.
This version has been modified to work with the differences found in the tracked RF drum head signals taken directly from colour-under & FM modulated composite videotape formats.
[!CAUTION]
Not to be confused with the TV Modulator/Demodulator pack or the "antenna connectors" on the back of the VCR!
SMPTE ColourBars (16:9) Test Tape With WSS (PAL) exported full-frame (1112 x 624)
VHS 625-line and 525-line - NTSC, NTSC-J, PAL and PAL-M. Generally well supported
SVHS 625-line and 525-line - NTSC, NTSC-J, PAL and PAL-M. Basic support
U-Matic Low Band 625-line and 525-line - PAL and NTSC. Supported
U-Matic High Band 625-line - PAL. Basic support
Betamax 625-line and 525-line - PAL & NTSC. Suppported
Video8 & Hi8 625-line and 525-line - PAL & NTSC. Basic support
1" Type C (SMPTE Type C) 625-line and 525-line - PAL & NTSC. Basic support (More Samples Required!)
1" Type B (SMPTE Type B) 625-line and 525-line - PAL & NTSC. Basic support (More Samples Required!)
EIAJ 625-line - PAL. Supported (NTSC Samples Required!)
Philips VCR 625-line - PAL. Supported
Example Videos: VHS-Decode / The Rewinding / Video Dump.
Example Workflow Flowcharts and Overview Graphics
The frequently asked questions page and the Wiki, will help break things down and explain the real world benefits of direct RF capture preservation and software decoding compared to conventional high-cost hardware based workflows, so if you have just found this project welcome to the affordable future of tape media preservation.
This repository also contains an experimental CVBS decoder, cvbs-decode
, which shares code with ld-decode and vhs-decode. Capable of decoding basic RAW digitized NTSC and PAL composite video, including colour if the source is somewhat stable.
RAW CVBS has been captured using CX Cards & CXADC, however, only at lowest gain states and or with external signal feed into it to stop its hardware decoder from triggering.
[!CAUTION] CVBS capture is not possible with the DomesDayDuplicator Rev3 due to input filtering on the hardware, but is possible with the MISRC boards.
Test samples & signals can be digitally generated using HackTV or downloaded from The Internet Achive.
Thanks to VideoMem's work on Superheterodyne Decoding Tools we now have a working HiFi Audio Decoder which provides decoding for VHS & Video8/Hi8 HiFi FM tracks which takes uncompressed or FLAC compressed RF captures of HiFi FM signals and outputs standard 24-bit 44.1-192khz FLAC stereo audio files.
RTLSDR capture & decoding (cross plafrom as its 100% GNURadio based) can run in realtime on most systems (1~3 sec delay) and provide live playback, Alongside 8msps RF files and a 48khz 24-bit FLAC file of the decoded audio.
Preferably adjusted per tape and in excellent mechanical and head condition, prosumer metal track decks are preferable as they were built generally better in terms of mechnical stability than cheaper later consumer decks that use more plastics, the only crtical requirement is avalible test points or a head amplifyer that is easy to tap into, this goes for any and all tape formats.
[!TIP] SVHS tapes can be RF captured on standard VHS HiFi decks.
[!TIP] SVHS NTSC Decks - Currently inflated, but you can import PAL decks with NTSC support for 1/3rd the price though this only applys if conventional refrance SVHS captures are required.
[!IMPORTANT]
Always clean your tape track/drum/heads before and afterwards with 99.9% isopropanol and lint free cloths/pads/paper. This ensures less dropouts from dirty heads or tracks including the track of the head drum.
Its good practice to avoid cross contamination of tapes, especially if dealing with mouldy or contaminated tapes.
It also helps to make sure to re-lubricate metal and plastic moving joints cogs and bearings with appropriate greases and oils to avoid mechanical failures. Please read the Cleaning & Servicing Guide.
[!TIP]
Currently is there is 2 standardised hardware tools but RF Capture is not just limited to these 2 devices.
Capture is done using an simple GUI application.
Linux Application / Windows Application / MacOS Application
Built and geared torwards capturing RF from Laserdisc players, it does however also work perfectly well for digitizing many forms of tape FM RF signals. It consists of a custom analogue to digital board with an amplifier, an off-the-shelf DE0-NANO FPGA development board, and a Cypress FX3 SuperSpeed Explorer USB 3.0 board.
[!WARNING]
Dont use USB storage or video devices on the same USB bus as the DdD, it will crash the capture![!WARNING]
Several users have reported issues with dropped samples when using the ddd do capture on Windows, so as of now using it on Windows is not recommended.
Capture & Config uses simple command-line arguments and parameters CXADC
The most cost-effective approach is using a video capture cards based on a Conexant CX23880/1/2/3 PCI chipset.
Today with a modified Linux driver, these cards can be forced to output RAW signal data that can be captured to file, instead of decoding video normally as they otherwise would.
While you can use any generic card with the correct chips, today we recommend the ‘‘New’’ Chinese variants that can be found on AliExpress that have integrated Asmedia or ITE 1x PCIE bridge chips allowing modern systems to use them, and consistent performance.
These cards combined with a dedicated amplifier and some basic to advanced mods become amazing archival tools and was the first turn-key workflow with the clockgen mod enabling Video + HiFi RF + Baseband (linear or deck decoded hifi) to be captured in perfect hardware sync!
[!TIP] Please Read VCR Reports / The Tap List / Hardware Installation Guide
Information on various VCRs that have been documented alongside high resolution pictures of VCR's that have had RF taps installed, guidance on recommended cables/connectors & tools to use are also included.
The setup process for RF capture involves running a short cable internally from points that provide the unprocessed video and or audio signal to a BNC jack at back of a metal/plastic VCR chassis or cable threaded out a vent, this allows direct access to the FM RF signals conveniently & reliably, we call this a Tap Point or RF Tap, for some decks and camcorders however DuPont conectors and ribbon jigs can be used but are less mechanically secure.
- VCR Unit ==> Head Drum ==> RAW Signal From Heads ==> Amplification & Tracking IC ==> Tracked FM RF signals ==>
- FM RF Test/Signal Points ==> FM RF Capture ==>
- Software Decoding ==> Lossless 4fsc TBC Files ==> YUV Conversion ==> Standard Audio/Video Files.
Decks follow this naming or close to it not every possible name is covered.
Video FM RF Signal:
RF C
, RF Y
, RF Y+C
, V RF
, PB
, PB.FM
, V ENV
, ENV
, ENVE
, ENVELOPE
, VIDEO ENVE
, VIDEO ENVELOPE
HiFi Audio FM Signal:
HiFi
, A.PB
, A FM
, A.PB.FM
, Audio FM
, A-Out
, A ENV
, HIFI Envelope
, FM Mix Out
[!CAUTION]
Just because a test points has this name doesn't automatically mean it will have the signal we want, especially when it comes to hi-fi audio, be sure to check with the service manual if possible and do small test captures before finalizing any RF Tap setup.
Connection Cables
On CX White Cards you use the RCA (Vmux 1) for the RF input with C31 capacitor removed, but a BNC can be easily added.
[!TIP]
The Hardware Installation Guide visually goes over all the install steps for tape decks to Sony 8mm camcorders.
Adding a 10uf (0.1uf to 100uf range) capacitor to the test point or amplifier is recommended can help improve signal integrity (a handful VCRs have this on the test point already).
Center is Signal, Outer is Ground, this goes for jacks and for coaxial cable in general.
For a electrolytic capacitor Positive leg (longer) goes on test/signal point, Negative leg (shorter) on cable to connector/probe.
However this does not matter for Ceramic which are bi-directional & recommend today.
While type and voltage does not matter drastically it's best to use new/tested capacitors.
Note We use Aliexpress links for wide availability globally, but local vendors are a thing.
Note With some Sony decks you can use Dupont connectors on the test point pins making an easy RF tap.
Note Do not make sharp bends in any RF cabling, keep total cable runs as short as possible Ideally 30-60cm, more cable = more signal loss.
Note Some UMATIC decks have an RF output on the back, however this only provides Luma RF for dropout detection and not the full signal required for RF capture.
The ld-tools suite, tbc-video-export and combined exe version of ld-decode
/ vhs-decode
/ cvbs-decode
/ hifi-decode
which is simply decode.exe
exists for Windows.
This allows the use of ld-analyse's GUI to view TBC files, ld-lds-converter to convert and compress DdD captures inside Windows with drag and drop bat scripts.
The decode suite can also be built & run natively on Windows 10/11 or built inside WSL2 22.04.1 LTS (Windows Subsystem for Linux) however issues with larger captures i.g 180gb+ may require expanding the default virtual disk size.
See building on MacOS page on MacOS Build install docs are only currently for ARM based apple products such as the M1/M2 lines.
VHS-Decode, as with LD-Decode, has been developed and tested on machines running the latest versions of Ubuntu, Debian and Linux Mint. The tools should however be able to be built on other distributions too provided they have access somewhat recent versions to the needed dependencies, including at least python 3.8.
There is a Linux compatibility doc for various tested distributions of Linux.
Other dependencies include Python 3.8+, numpy, scipy, cython, numba, pandas, Qt5, qwt, Cmake, and FFmpeg.
Some useful free tools to note for post processing are StaxRip & Lossless Cut & of course DaVinci Resolve - these give you basic editing to quickly handle uncompressed files across operating systems, and for Windows users an easy FFmpeg/AviSynth/Vapoursynth encoding and QTGMC de-interlacing experience, and full colour grading and post production ability.
Install all dependencies required by LD-Decode and VHS-Decode:
sudo apt install git qtbase5-dev libqwt-qt5-dev libfftw3-dev libavformat-dev libavcodec-dev libavutil-dev ffmpeg pv pkg-config make cmake sox pipx g++ python3-dev
Ubuntu 22.04/Linux Mint 21/Debian may also need this library installed if one wants to use the GUI version of hifi-decode:
sudo apt install libxcb-cursor0
For Arch Linux
pacman -S base-devel git qt5-base qwt fftw ffmpeg pv cmake sox python python-pipx
Set up pipx
pipx ensurepath
(Alternatively, a python virtual environment can be used instead of using pipx)
Install TBC-Video-Export
pipx install tbc-video-export
(There is also self contained builds if install issues arise)
Optional dependencies for GPU (Nvidia Cards) FLAC compression support:
sudo apt install make ocl-icd-opencl-dev mono-runtime
Also Requires FlaLDF Download & Install via .deb for Linux
The vhs-decode respository also has hifi-decode, cvbs-decode, ld-decode included.
Download VHS-Decode:
git clone https://github.com/oyvindln/vhs-decode.git vhs-decode
Install VHS-Decode:
cd vhs-decode
Build and install vhs-decode via pipx
pipx install .[hifi_gui_qt6]
Compile and Install ld-tools suite: (Required)
mkdir build2
cd build2
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_QT_VERSION=5
make -j4
sudo make install
Go back to the main directory with
cd ..
To update do git pull
while inside of the vhs-decode directory.
To update to the latest git version of vhs-decode/ld-decode/hi-fi decode, run pipx install .
inside the vhs-decode directory after running git pull
To update the tools to the latest version, the steps under "Compile and Install ld-tools suite: (Required)" has to be re-ran after a git pull
. The tools are not updated very often.
[!NOTE]
debian/ubuntu does not have a qt6 version of qwt in repositories as of yet so you have to inform the build script to use Qt5 if both qt5 and qt6 are installed with -DUSE_QT_VERSION=5 as it might otherwise try to compile with qt6 instead and failing to locate qwt. The option is otherwise not needed.
Note with WSL2 & Ubuntu, ./
in front of applications and scripts may be needed to run them or to run scripts within the folder.
Use cd vhs-decode
to enter into the directory to run commands, cd..
to go back a directory.
Use Ctrl+C to stop the current process.
You dont actaully type <
and >
on your input & output files.
Connect Card to RF Tap
CXADC Readme for information on how to install & configure the driver, this also goes into depth on modes.
Commands for real-time FLAC capture on CX Cards
To see if you have a connection, use the live preview mode and then hook up your RF cable, normally you will see a white flash as a signal, if not change your vmux or input within a 0-2 range with the below command.
sudo echo 0 >/sys/class/cxadc/cxadc0/device/parameters/vmux
To see a live preview of tape signal being received by a CXADC card, note that the video head tracked signal will be unstable or wobbly if settings are not the same; you may only see "signal flash" if in 16-bit mode for example.
This is quite useful if you don't own a CRT with Horizontal/Vertical shifting, as it will allow you to inspect the full area for alignment and/or tracking issues.
PAL framing for the default 28.64 MHz/8-bit mode:
ffplay -hide_banner -async 1 -f rawvideo -pix_fmt gray8 -video_size 1832x625 -i /dev/cxadc0 -vf scale=1135x625,eq=gamma=0.5:contrast=1.5
NTSC framing for 28.64 MHz/8-bit mode:
ffplay -hide_banner -async 1 -f rawvideo -pix_fmt gray8 -video_size 1820x525 -i /dev/cxadc0 -vf scale=910x525,eq=gamma=0.5:contrast=1.5
Capture 30 seconds of tape signal using CXADC driver 8-bit samples
timeout 30s cat /dev/cxadc0 > <capture>_CXADC.u8
For 16-bit, simply change the output filename extension to .u16
For FLAC captures, set the output filename extension to your desired tape format, for example .VHS
It is recommended to use a fast storage device with 40-100 MB/s or faster write capacity, in order to avoid dropped samples, ideally an dedicated SSD (via M.2 or SATA connector, not USB) formatted with the exFAT filesystem.
For DomesDayDuplicator captures on Linux simply run:
ld-compress <capture>
For DomesDayDuplicator captures on Windows simply drag and drop on:
ld-compress.bat
or ld-compress-nvidia-gpu.bat
Your .lds
file will be compressed to an FLAC OGG .ldf
file.
For CXADC and other standard 8-bit or 16-bit RF captures use the following:
Copy Paste FLAC Compression Commands for CXADC
Editable flags are:
The --bps
flag can be changed to --bps=8
or --bps=16
for 8 & 16 bit captures and --ogg
is optional.
Change <capture>
& <output-name>.flac
to your input & output file name.
Reduce size of captured CXADC data (by 40-60%):
flac --best --sample-rate=28636 --sign=unsigned --channels=1 --endian=little --bps=8 --ogg -f <capture>.u8 <output-name>.flac
Output will be <output-name>.flac
if wanted you can rename the end extension to .vhs
/ .hifi
etc, but include _8-bit_28msps
and NTSC or PAL
etc in the name, to always know what the data and tape format is.
Decompress FLAC compressed captures:
flac -d --force-raw-format --sign=unsigned --endian=little <capture>.vhs <capture>.u16
Decode your captured tape to .tbc
by using:
vhs-decode [arguments] <capture file> <output name>
Basic Usage Example:
vhs-decode --debug --pal --threads 8 --tape_format VHS --cxadc CX-White-2022.10.25.u8 my-first-decode-2022.10.25
After decoding process your tapes VBI data with:
ld-process-vbi <decoded tape name>.tbc
Use analyse tool to inspect decoded tape data:
ld-analyse <decoded tape name>.tbc
(.tbc
files are headerless you can open them at any time during decoding, preview is limited to what frame info has been fully written to the JSON file updated every 100 frames or so)
VHS-Decode produces two timebase corrected files an S-Video signal in the file domain for VHS/Beta/Video8/Hi8 etc, It can also produce a single CVBS file for formats like SMPTE-C/B.
These are stored in 16-bit GREY16
headerless files separated into chroma/luma composite video signals in the .tbc
format filename.tbc
& filename_chroma.tbc
respectively alongside .json
and .log
files with frame and decode information, usable with the LD-Decode family of tools ld-analyse, ld-process-vbi, ld-process-vits, ld-dropout-correct & ld-chroma-decoder etc
The export scrips will by default render a lossless, interlaced top field first and high-bitrate (roughly 70-100 Mb/s) FFV1 codec video which, which although ideal for archival and further processing has only recently started to gain support in modern NLEs.
To generate .mkv files viewable in most media players, simply use the tbc-video-export
tool.
Read the README_gen_chroma_vid_scripts
README for the legacy script options.
Linux, MacOS & Windows
tbc-video-export Input-Media.tbc
[!IMPORTANT]
Read the full export guide here!
For archival to web use we have a wide range of pre-made FFmpeg profiles defined inside the tbc-video-export.json
file.
[!WARNING]
- Odysee uploads the provided web AVC files are ideal.
- Vimeo uploads de-interlace the FFV1 export it re-encodes pregressive SD quite well.
- YouTube de-interlace and upscale to 2880x2176p (anything below the 4k bracket is destoryed by compression.)
The stock profiles for web use the BDWIF deinterlacer, but QTGMC is always recommended give the de-interlacing guide a read for more details.
ProRes 4444XQ & FFV1 with PCM audio have been added for editing support.
Define your profile with for example: --profile ffv1_8bit_pcm
Profile Name | Codec | Compression Type | Bit-Depth | Chroma Sub-Sampling | Audio Format | Container | File Extension | Bitrate |
---|---|---|---|---|---|---|---|---|
ffv1 | FFV1 | Lossless Compressed | 10-bit | 4:2:2 | FLAC Audio | Matroska | .mkv | 70-100mbps |
ffv1_8bit | FFV1 | Lossless Compressed | 8-bit | 4:2:2 | FLAC Audio | Matroska | .mkv | 40-60mbps |
ffv1_pcm | FFV1 | Lossless Compressed | 10-bit | 4:2:2 | PCM Audio | Matroska | .mkv | 70-100mbps |
ffv1_8bit_pcm | FFV1 | Lossless Compressed | 8-bit | 4:2:2 | PCM Audio | Matroska | .mkv | 40-60mbps |
prores_hq_422 | ProRes HQ | Compressed | 10-bit | 4:2:2 | PCM Audio | QuickTime | .mov | 55-70mbps |
prores_4444xq | ProRes 4444XQ | Compressed | 10-bit | 4:4:4 | PCM Audio | QuickTime | .mov | 80-110mbps |
v210 | V210 | Uncompressed | 10-bit | 4:2:2 | PCM Audio | QuickTime | .mov | 200mbps |
v410 | V410 | Uncompressed | 10-bit | 4:4:4 | PCM Audio | QuickTime | .mov | 400mbps |
x264_web | AVC/H.264 | Lossy | 8-bit | 4:2:0 | AAC Audio | QuickTime | .mov | 8mbps |
x265_web | HEVC/H.265 | Lossy | 8-bit | 4:2:0 | AAC Audio | QuickTime | .mov | 8mbps |
-s
Skips number of frames -s 25
for example skips 1 second of PAL video.
-l
Defines length to export so -l 1500
is 1 minute of PAL video at 25fps or -l 1500
for NTSC at 29.97fps
--audio-track
Embed an audio file example: --audio-track HiFi_24-bit_192khz.flac
& --audio-track Linear_24-bit_48khz.flac
from HiFi-Decode
Full Example:
Linux, MacOS & Windows:
tbc-video-export -s 50 -l 1500 --audio-track HiFi_24-bit_48khz.flac --audio-track Linear_24-bit_48khz.flac Input.tbc
Software decoding provides the full signal frame, recovery software can be used to read and extract this information, however some information can be automatically extracted in the TBC file stage with ld-processs-vbi
like VITC & Closed Captions.
VITC Timecode (Standard SMPTE Timecode)
CC EIA-608 (Closed Captioning)
Teletext (European Subtitles & Information Graphics)
Ruxpin TV Teddy (Extra audio in visable frame)
This creates a scaled 720x608 PAL
or 720x508 NTSC
(IMX/D10) video file.
Linux, MacOS & Windows:
tbc-video-export --vbi input.tbc
VHS-Decode supports various arguments to change how captured tape recordings are processed. These vary slightly between formats like VHS & Umatic but the basic oprations remain the same.
The list below is a short list for common/daily usage but does not cover all the abilities and new or advanced command arguments possible so please read the complete and upto-date command list on the wiki as commands may change or be deprecated, so its always good to check this list for any updates.
[!CAUTION]
This is a mandatory setting for the decoders to work properly.
By default, this is set to 40 Mhz (40msps) (the sample rate used internally and by the Domesday Duplicator) at 16 bits.
The decoder is 8/16 bit agnostic so as long as sample rate is defined, it will decode it same for 10-bit packed captures and if its FLAC compressed.
-f
Adjusts sampling frequency in integer units.
Example's -f 280000hz
or -f 28mhz
or -f 8fsc
[!NOTE]
These are just shorthand arguments for there respective samplerate option.
--cxadc
28.6 MHz/8-bit (8fsc) (Recommended for stock card capture)
--cxadc3
35.8 MHz/8-bit (10fsc) (Not recommended for capture due to up-sampling)
--10cxadc
14.3 MHz/16-bit (4fsc) (Not recommended for capture due to under-sampling)
--10cxadc3
17.9 MHz/16-bit (5fsc) (Not recommended for capture due to under-sampling)
[!CAUTION]
This is a mandatory setting for the decoders to work properly.
Changes the TV System (line system & respective, colour system if any) to your required regional media format.
[!NOTE]
- Support for PAL-M is experimental.
- MESECAM (requires extra GNUradio script for decoding colour after the TBCs currently)
--system
followed by the TV System
Options are: NTSC
, PAL
, PAL-M
, NTSC-J
& MESECAM
For example: --system NTSC
[!CAUTION]
This is a mandatory setting for the decoders to work properly.
-tf
or --tape_format
sets the format of media you wish to decode.
Current Options are VHS
(Default), VHSHQ
, SVHS
, UMATIC
, UMATIC_HI
, BETAMAX
, BETAMAX_HIFI
, VIDEO8
, HI8
,EIAJ
, VCR
, VCR_LP
, TYPEC
& TYPEB
.
Example: --tape_format vhs
These commands are used for jumping ahead in a file or for defining limits. Useful to recover decoding after a crash, or for limiting process time by producing shorter samples.
-s
Jumps ahead to any given frame in the capture.
--start_fileloc
Jumps ahead to any given sample in the capture.
-l
Limits decode length to n frames.
-t
Defines the number of processing threads to use during demodulation, decode cant use more then 6-8 threads per decode currently so using 8 threads is the practical limit as its mostly a single core task.
(note: upon crashing, vhs-decode automatically dumps the last known sample location in the terminal output)
--debug
sets logger verbosity level to debug. Useful for debugging and better log information. (Recommended to enable for archival.)
--ct
enables a chroma trap, a filter intended to reduce chroma interference on the main luma signal. Use if seeing banding or checkerboarding on the main luma .tbc in ld-analyse.
--recheck_phase
re-check chroma phase on every field, fixes most colour issues. (No effect on U-matic.)
--sl
defines the output sharpness level, as an integer from 0-100, the default being 0. Higher values are better suited for plain, flat images i.e. cartoons and animated material, as strong ghosting can occur. (Akin to cranking up the sharpness on any regular TV set.)
--dp demodblock
displays Raw Demodulated Frequency Spectrum Graphs, makes a pop-up window per each thread so -t 32 will give you 32 GUI windows etc
[!NOTE]
The decoders can be RAW uncompressed data or FLAC compressed data.[!TIP]
.RAW will need to be renamed to s16/u16
.ldf
/.lds
(40msps Domesday Duplicator FLAC-compressed and uncompressed data).
.r8
/.u8
(CXADC 8-bit raw data).
.r16
/.u16
(CXADC 16-bit raw data).
.flac/.cvbs/.vhs/.svhs/.betacam/.betamax/.video8/.hi8 (FLAC-compressed captures, can be either 8-bit or 16-bit).
[!CAUTION]
If using custom extensions include,tv system
,bit depth
, andsample rate xxMSPS
inside the file name so it's clear what basic settings you will need to use to decode it, and it helps a lot when sharing or archiving somthing to know what it actually is.
Unlike CVBS-Decode & LD-Decode, VHS-Decode does not output its timebase-corrected frames as a single Composite .tbc
file for colour-under formats, but does for composite modulated ones such as SMPTE-C.
Both the luminance and chrominance channels are separate data files, essentially digital "S-Video", additionally useful for troubleshooting. Descriptor/log files are generated so you end up with 4 files with the following naming:
filename.tbc
- Luminance (Y) Image Data (Combined Y/C for CVBS)
filename_chroma.tbc
- Chrominance (C) Image Data (QAM Modulated)
filename.tbc.json
- Frame Descriptor Table (Resolution/Dropouts/SNR/Frames/VBI Timecode)
filename.log
- Timecode Indexed Action/Output Log
For future documentation changes, speak with Harry Munday (harry@opcomedia.com) or on Discord (therealharrypm)