Skip to content

RF Compression & Decompression Guide

Harry Munday edited this page May 21, 2023 · 21 revisions

FLAC Compression & De-Compression Guide

Previous Page RF Capture Guide

Sub-Page Speed & Decoding Testing

Next Page RF Decoding Guide

What is RF Compresson & Down-Sampling?

FM RF data is just like audio data just electrical signal values digitised into bits of information, but this is just more information in a different waveform pattern than normal sound waves, as such we can use lossless audio codecs like FLAC to compress captured FM RF data down A LOT or lossy ones to just break the files in fun ways too!

Now Down-Sampling is a method of cutting file size down with controled loss of data this can be done for low bandwith formats like HiFi FM signals without much care as only 5msps or less is needed but for video formats its more a stricter practice and the bandwith also changes between PAL/NTSC systems on a per format basis.

Downsampling can be practical with 40msps 8-bit and 40msps 16-bit captures from the Modified CX Cards or DomesDay Duplicator.

Very useful when using limited size optical discs for archival the commands can be easily tweaked on an as-needed basis for example VHS NTSC has been resampled down to 325MB/Minute without issue.

However and for unstable media it's advised to keep just a normal FLAC compressed RF without re-sampling it.

Linux Scripts (DomesDayDuplicator 10-bit Packed 40msps Captures)

Copy the scripts below into a text document, save and then add .sh extention to the end of the file, you can use these in any directory witch the script file is put inside of, you can name the scripts however you like but the below example is clear enough.

./40msps-DdD-16msps-8bit.sh DdD-capture.lds

Will make DdD-capture_NTSC_16msps_8-bit.flac

The scripts below autoamtically apend the samplerate/bit-depth/TV System accordingly.

DomesDayDuplicator FLAC

ld-compress DdD-capture.lds

Will just compress your capture to a lossless 40msps 16-bit FLAC

Down Sampling + FLAC Compression

Down-sampling is ideal for maximum space saving of stable media, however this is not lossless this is lossy so is not recommended unless you absolutely have to save space as this can yield up~to a 10:1 ratio these values below should be taken with a grain of salt as re-sampling can very per media format and per TV system such as NTSC/PAL. (NTSC VHS command has been fully tested)

NTSC - VHS/Betamax (16msps 8-bit)

#!/bin/bash

echo "Conversion of 10-bit 40msps .lds to 8-bit 16msps NTSC .flac has started"

ld-lds-converter -i $1 | sox -r 40000000 -b 16 -c 1 -e signed -t raw - -b 8 -r 16000000 -e unsigned -c 1 -t raw - sinc -n 2500 0-7650000 | flac -8 --sample-rate=16000 --sign=unsigned --channels=1 --endian=little --bps=8 - -o $1_NTSC_16msps_8-bit.flac

Imgsli Slider Comparison

16msps 8-bit with FLAC compression for VHS NTSC

Runtime File Size Storage Medium Note
45min 15 GB
60min 19.44GB
75min 24.30GB 25GB M-Disk/GlassMasterDisc
90min 29.16GB S-VHS/VHS-C tape max
120min 38.88GB
150min 48.6GB 50GB M-Disk / 50GB GlassMasterDisc Max
3-hour 58.32GB VHS SP Max
240min 77.76GB
5-hour 97.2GB 100GB M-Disk Max
6-hour 116.64GB 128GB Sony Quad Layer BDXL Max / VHS LP Max

PAL - VHS/BetaMax (18msps 8-bit)

#!/bin/bash

echo "Conversion of 10-bit 40msps .lds to 8-bit 18msps PAL .flac has started"

ld-lds-converter -i $1 | sox -r 40000000 -b 16 -c 1 -e signed -t raw - -b 8 -r 18000000 -e unsigned -c 1 -t raw - sinc -n 2500 0-8670000 | flac -8 --sample-rate=18000 --sign=unsigned --channels=1 --endian=little --bps=8 - -o $1_PAL_18msps_8-bit.flac

NTSC/PAL - Umatic/SVHS/SuperBeta/ED-Beta (24msps 8-bit)

#!/bin/bash

echo "Conversion of 10-bit 40msps .lds to 8-bit 24msps .flac has started"

ld-lds-converter -i $1 | sox -r 40000000 -b 16 -c 1 -e signed -t raw - -b 8 -r 24000000 -e unsigned -c 1 -t raw - sinc -n 2500 0-9400000 | flac -8 --sample-rate=20000 --sign=unsigned --channels=1 --endian=little --bps=8 - -o $1_24msps_8-bit.flac

VHS HiFi FM Audio - (S)VHS-HiFi 40msps to 10msps 8-bit

#!/bin/bash

echo "Conversion of 10-bit 40msps .lds to 8-bit 5msps .flac has started"

ld-lds-converter -i $1 | sox -r 40000000 -b 16 -c 1 -e signed -t raw - -b 8 -r 5000000 -e unsigned -c 1 -t raw - sinc -n 2500 0-3050000 | flac -8 --sample-rate=5000 --sign=unsigned --channels=1 --endian=little --bps=8 - -o $1_VHS_HiFi_5msps_8-bit.flac

Note

Video8/Hi8 hifi is in the same modulated signal as video just on different carriers so you use 1 file for both video/hifi decoding.

There will be WSL2 passthough scripts for windows made soon.

RF Compression & Resampling Commands - Windows Users

Download ld-tools for windows rename the folder to ld-tools-suite-windows and place it in the C:/ directory or your boot drives main directory.

Open PowerShell as an administrator

Install Choco (chocolatey package manager)

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Then you can install these tools system-wide (PATH) without any hassle.

Install FFmpeg

choco install ffmpeg

Install FLAC

choco install flac

Install SoX

choco install sox.portable

Manual .exe downloads SoX / FLAC / FFmpeg

DomesDayDuplicator

You can capture in 16-bit uncompresed or 10-bit packed

16-bit Signed to FLAC

Since this is uncompressed data it is reasy to handle

ffmpeg INPUT.s16 -i -f s16le -ar 40k -ac 1 -acodec flac -compression_level 11 -f ogg OUTPUT.flac

10-bit packed to FLAC

This outputs a unpacked file in .flac (Not Actually "Compressed")

2.8GB/Min 10-bit packed to 625MB/Min 16-bit FLAC

C:\ld-tools-suite-windows\ld-lds-converter.exe -u -i INPUT.lds | ffmpeg -f s16le -ar 40k -ac 1 -i - -acodec flac -compression_level 11 -f ogg OUTPUT.ldf 

You can then compress this file to a FLAC compresed file.

ffmpeg -i INPUT.flac -f s16le -ar 40k -ac 1 -acodec flac -compression_level 11 -f ogg OUTPUT.flac

Naming & Formating Your Files

Rename the .flac to your media format name using standard designators & standard naming guide

Page End

Sub-Page Speed & Decoding Testing

Previous Page RF Capture Guide

Next Page RF Decoding Guide

Clone this wiki locally