Skip to content

Basic usage of ld decode

Harry Munday edited this page Nov 3, 2023 · 34 revisions

Obtaining a LaserDisc RF sample

Before you can decode anything with ld-decode, you will need something to decode. There are a few choices; find someone awesome with a RF capture you desire and get a copy of it or use the Domesday Duplicator (along with a calibrated LaserDisc player) and capture your own, but there is also plenty of samples of the DD86 Discs on The Internet Archive & The Community Shared Drive has samples of LaserDiscs and many outher analouge formats.

The resulting file has the extension .lds (or .ldf if it's been FLAC compressed with ld-compress which you can find in the ld-decode github repo under scripts).

The .lds is a 10-bit packed RF sample file, if you want to view the raw RF in a tool like audacity use a command such as the following to convert it into a 16-bit signed raw format:

ld-lds-converter --input my.lds --output my.raw --unpack

If you have a new capture environment it can be very useful to make a small .lds (just a few seconds) at the start, middle and end of a disc, then view in audacity to make sure the capture environment is good.

Making your first .tbc file

The first step in the decoding process is the complicated (and time-consuming) process of converting the raw LaserDisc RF into multiple streams of:

.tbc (the 4fsc NTSC or PAL field stream)

.pcm (a raw 44.1Khz 16-bit stereo analogue sound track)

.efm (the digital audio/data track)

.json which is a metadata file (i.e. it describes the .tbc file to the rest of the wondrous tools in the ld-decode tool-chain)

The other complex things ld-decode does are 'time-base correction' and 'framing' - and, as confusing as it sounds, 'framing' is actually about processing fields... As the disc spins, jitters and flies around merrily in a LaserDisc player, it's not very accurate about it. To remove all of these timing issues (which make the video go wibbily-wobbily) ld-decode picks up on the timing signals in the RF and stretches and contracts things to make everything look right. As well as this time-base correction, all of the NTSC/PAL information is arranged into fields which then go to make up the frames (every frame has a first and second field which are interlaced to make a complete 'picture').

In order to perform all this work ld-decode needs to know the type of video (NTSC is default, but --pal selects PAL), where to start (--start ) and how much to do (--length although, if you don't specify a length or a start, things will start from the beginning of the .lds/.ldf and continue until the end (or a lead-out frame).

Some captures include 'spin-up' - this is the bit where the player spins up the disc and settles onto the start of the first field of the first frame. As the player spins up the RF is all over the place and can't be decoded. ld-decode will attempt to skip this, but sometimes it needs some guidance with --start. The 'sequential frame' is the number of frames included from the start of the .lds/.ldf (it has nothing to do with the VBI frame numbering that might be shown by a real LD player).

So to decode something you might use a command such as:

ld-decode /my/indisc/awesome.ldf /my/outdisc/outputfile --start 300 --length 1000

Note that the 'outputfile' shouldn't have a .tbc extension - ld-decode will add this itself (no one knows why this is... it will always be a mystery).

Once the decode is finished you will have a bunch of files ready for the next parts of the process.

VBI data

Every disc, within the PAL or NTSC, has a Vertical blanking interval - this is the gap (from the prehistoric days of CRT TVs) where the raster had to get from the bottom of the TV back to the top - nothing could be displayed whilst that happened, so some smart-cookie decided to put useful data in there so the LaserDisc player wouldn't get bored waiting. The VBI data (often just called VBI as it sounds cooler) contains useful information about the video such as frame numbering and timecode or even fancy data like Teletext!

ld-decode will have already put some basic VBI data in the metadata (the .tbc.json file mentioned before) - but you can make it more complete by using the following command:

ld-process-vbi /my/outdisc/outputfile.tbc

Viewing the resulting decode

To view the decoding or decoded NTSC/PAL .tbc use the following command:

ld-analyse

ld-analyse is so awesome and provides so much good information, it needs it's own wiki just to describe it.

Drop-out correction

Every now and again there is a loss of RF from a LaserDisc, the signal goes 'poof!' for a very short period. This is called a drop-out (so we get DO (Drop Out), DOD (Drop Out Detection) and DOC (Drop Out Correction)). These appear as annoying black/white lines in the frames. You can correct most of these dropouts using the following command:

ld-dropout-correct /my/outdisc/outputfile.tbc /my/outdisc/outputfile.doc.tbc

Again, you can view the result of this correction in ld-analyse.

As a special note (for all you Unix whizzkids) - ld-dropout-correct, ld-chroma-decoder (see below) and ffmpeg all support 'pipelining' so, if you know what you are doing, there is no need to create intermediate files as you go) and this was first automated with the vhs-decode scripts which today has ended up as the tbc-video-export python script that even has a windows exe!

Dude, where's my colour?

To turn NTSC or PAL time base corrected files into a colour image it has to be processed with a chroma-decoder (because chroma is a posh word for colour and it has to be decoded); sometimes this is called comb-filtering, but it's got nothing to do with hairstyles really, so nobody knows why.

Running the NTSC/PAL through the chroma-decoder can produce an raw YUV or RGB uncompressed stream which you can then do anything with!

This command produces a seriously huge raw RGB file or all the frames, you can do this with a command such as:

ld-chroma-decoder /my/outdisc/outputfile.doc.tbc /my/outdisc/outputfile.doc.rgb

You can also create a more reasonable FFV1 10-bit 4:2:2 .mkv file with tbc-video-export which will also run ld-dropout-correct & ld-process-vbi.

Linux & MacOS

python3 tbc-video-export.py Input-Media.tbc

Windows

tbc-video-export.exe Input-Media.tbc

Making a nice video file of the result

This is a tricky one as there is no one-size-fits-all solution. To help with this you can look at the following wonderful wiki pages:

NTSC decode guide

PAL decode guide

That's it, you are now an uber-user and can begin to impress your friends with your new found skills! Once you are done with that, it's worth browsing the rest of the wiki for more information and some more advanced tricks.

Clone this wiki locally