Skip to content

FLAC Compression Guide

harrypm edited this page Jun 25, 2023 · 14 revisions

Usage Notes

You may add the --ogg flag but due to a recent update to FLAC, this is no longer a requirement. (2022)

Replace "media-name" with what you want to name your recording, data information is already added to the output for convenience.

Capture + FLAC in real time may cause dropped samples if used on older lower end systems or slow storage devices.

Realtime Capture & FLAC compression:

28mhz 8-bit

sudo sox -r 28636 -b 8 -c 1 -e unsigned -t raw /dev/cxadc0 -t raw - | flac --fast -16 --sample-rate=28636 --sign=unsigned --channels=1 --endian=little --bps=8 --blocksize=65535 --lax -f - -o media-name-28msps-8bit-cx-card.flac

40mhz 8-bit (Modifyed Card)

sudo sox -r 40000 -b 8 -c 1 -e unsigned -t raw /dev/cxadc0 -t raw - | flac --fast -16 --sample-rate=35795 --sign=unsigned --channels=1 --endian=little --bps=8 --blocksize=65535 --lax -f - -o media-name-40msps-8bit-cx-card.flac

14.3mhz 16-bit

 sudo sox -r 14318 -b 16 -c 1 -e unsigned -t raw /dev/cxadc0 -t raw - | flac --fast -16 --sample-rate=14318 --sign=unsigned --channels=1 --endian=little --bps=16 --blocksize=65535 --lax -f - -o media-name-14.3msps-16bit-cx-card.flac

17.8mhz 16-bit

sudo sox -r 17898 -b 16 -c 1 -e unsigned -t raw /dev/cxadc0 -t raw - | flac --fast -16 --sample-rate=17898 --sign=unsigned --channels=1 --endian=little --bps=16 --blocksize=65535 --lax -f - -o media-name-17.8msps-16bit-cx-card.flac

20mhz 16-bit (Modifyed Card)

sudo sox -r 20000 -b 16 -c 1 -e unsigned -t raw /dev/cxadc0 -t raw - | flac --fast -16 --sample-rate=17898 --sign=unsigned --channels=1 --endian=little --bps=16 --blocksize=65535 --lax -f - -o media-name-20msps-16bit-cx-card.flac

Post Capture FLAC compression:

28mhz 8-bit

flac --best --sample-rate=28636 --sign=unsigned --channels=1 --endian=little --bps=8 -f input.u8 -o "media-name-28msps-8bit-cx-card.flac"

40mhz 8-bit (Modifyed Card)

flac --best --sample-rate=40000 --sign=unsigned --channels=1 --endian=little --bps=8 -f input.u16 -o "media-name-40msps-8bit-cx-card.flac"

14.3mhz 16-bit

flac --best --sample-rate=14318 --sign=unsigned --channels=1 --endian=little --bps=16 -f input.u16 -o "media-name-14.3msps-16bit-cx-card.flac"

17.8mhz 16-bit

flac --best --sample-rate=17898 --sign=unsigned --channels=1 --endian=little --bps=16 -f input.u16 -o "media-name-17.8msps-16bit-cx-card.flac"

20mhz 16-bit (Modifyed Card)

flac --best --sample-rate=20000 --sign=unsigned --channels=1 --endian=little --bps=16 -f input.u16 -o "media-name-20msps-16bit-cx-card.flac"

Resampling Scripts

Thanks to Tony we have several re-sampling scripts & a breakdown of how to use GNU radio.

Rounded sample rates for FLAC

Note: the Fsc rate of the CX Chips output is based on the NTSC composite spec, though this does not really apply to the RF capture side of things whether you're capturing an NTSC or PAL signal, it's just noted due to VHS-Decode having the -f 8fsc -f 10fsc -f 5fsc -f 4fsc sample rate input frequency options.

The convention used for FLAC compression is raw sample rate divided by 1000 so the rates are as such.

28636 for 28.6mhz 8-bit (8fsc)

35795 for 35.7mhz 8-bit (10fsc) (Removed to prevent use, due to up-sampling)

14318 for 14.3mhz 16-bit (4fsc)

17898 for 17.8mhz 16-bit (5fsc)