Skip to content

Auto Audio Align

Harry Munday edited this page May 10, 2026 · 6 revisions

Auto Audio Alignment

After decoding your Video RF and or HiFi FM audio you will want to sync your decoded audio data with your video file or Linear captures made by audio ADC's running off the same clock source like the Clockgen Mod or MISRC.

There is a few ways to do this, as it is only a simple process of reading the post decoded .JSON file for total duration and offsets from dropped fields/frames of information, but the standard workflow currently uses Rene Wolfs implementation for Windows, Linux and MacOS, however this may change to a more universal python replacement later as Mono is considered an extra dependency.

Inside tbc-tools

As of tbc-tools v3.x.x it now has a GUI and auto loading for export.

Using Auto Audio Align

With a standard configuration you just need to alter the following:

  • -i baseband.wav

Input PCM or FLAC audio file.

  • --json capture.tbc.json

Input TBC JSON from decoded video RF.

  • baseband_aligned.flac

Output name at the end (also s16 will do 16-bit if s24 is replaced)

  • --stream-sample-rate-hz & -ar

Input rate of your audio file in Hz i.e 46875 for clockgen baseband, 78125 Hz for MISRC baseband and 48000 for hifi-decode or 44100 for ld-decode analog.

  • --rf-video-sample-rate-hz

Capture rate of your base file this normally will be 40000000 (40Msps) or 20000000 (20Msps) & 16000000 (16Msps) for down-sampled captures.

Warning

If decoding is running at native capture rate i.g --no-resample is used on a 20msps file, otherwise assume 40msps as this is what the decoder will internally re-sample to and this will affect the time base of 28.6msps CX Card captures for example.

Align Script

Alignment has been made mostly automated with the align script's today.

Input.JSON input.wav (or flac) and you get an input_aligned.flac output.

Copy-Paste Command Examples

HiFi-Decode Workflow (48kHz → 48kHz)

Input Requirements

  • Audio Input: HiFi-decoded audio at 48kHz (from hifi-decode)
  • JSON Input: TBC JSON from video RF decode
  • Output: Final aligned audio at 48kHz

Linux & MacOS

Stereo HiFi (48kHz)
"ffmpeg" -i hifi_audio.wav -filter 'channelmap=map=FL-FL|FR-FR' -f s24le -ac 2 - | mono VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 6 --stream-sample-rate-hz 48000 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg -f s24le -ar 48000 -ac 2 -i - -sample_fmt s32 hifi_aligned.flac
Mono HiFi (48kHz)
"ffmpeg" -i hifi_audio.wav -filter_complex "[0:a]channelsplit=channel_layout=2.1:channels=FL[FL]" -map "[FL]" -f s24le -ac 1 - | mono VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 3 --stream-sample-rate-hz 48000 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg -f s24le -ar 48000 -ac 1 -i - -sample_fmt s32 hifi_aligned.flac

Windows

Stereo HiFi (48kHz)
ffmpeg.exe -i hifi_audio.wav -filter_complex "channelmap=map=FL-FL|FR-FR" -f s24le -ac 2 - | VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 6 --stream-sample-rate-hz 48000 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg.exe -f s24le -ar 48000 -ac 2 -i - -sample_fmt s32 hifi_aligned.flac
Mono HiFi (48kHz)
ffmpeg.exe -i hifi_audio.wav -filter_complex "[0:a]channelsplit=channel_layout=2.1:channels=FL[FL]" -map "[FL]" -f s24le -ac 1 - | VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 3 --stream-sample-rate-hz 48000 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg.exe -f s24le -ar 48000 -ac 1 -i - -sample_fmt s32 hifi_aligned.flac
MISRC Workflow (78125Hz → 48kHz)

Input Requirements

  • Audio Input: MISRC baseband audio at 78125Hz
  • JSON Input: TBC JSON from video RF decode
  • Output: Final aligned audio resampled to 48kHz

Linux & MacOS

Stereo MISRC (78125Hz → 48kHz)
"ffmpeg" -i misrc_baseband.wav -filter 'channelmap=map=FL-FL|FR-FR' -f s24le -ac 2 - | mono VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 6 --stream-sample-rate-hz 78125 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg -f s24le -ar 78125 -ac 2 -i - -af aresample=48000 -sample_fmt s32 misrc_aligned_48k.flac
Mono MISRC (78125Hz → 48kHz)
"ffmpeg" -i misrc_baseband.wav -filter_complex "[0:a]channelsplit=channel_layout=2.1:channels=FL[FL]" -map "[FL]" -f s24le -ac 1 - | mono VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 3 --stream-sample-rate-hz 78125 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg -f s24le -ar 78125 -ac 1 -i - -af aresample=48000 -sample_fmt s32 misrc_aligned_48k.flac

Windows

Stereo MISRC (78125Hz → 48kHz)
ffmpeg.exe -i misrc_baseband.wav -filter_complex "channelmap=map=FL-FL|FR-FR" -f s24le -ac 2 - | VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 6 --stream-sample-rate-hz 78125 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg.exe -f s24le -ar 78125 -ac 2 -i - -af aresample=48000 -sample_fmt s32 misrc_aligned_48k.flac
Mono MISRC (78125Hz → 48kHz)
ffmpeg.exe -i misrc_baseband.wav -filter_complex "[0:a]channelsplit=channel_layout=2.1:channels=FL[FL]" -map "[FL]" -f s24le -ac 1 - | VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 3 --stream-sample-rate-hz 78125 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg.exe -f s24le -ar 78125 -ac 1 -i - -af aresample=48000 -sample_fmt s32 misrc_aligned_48k.flac
Clockgen Mod Workflow (46875Hz → 48kHz)

Input Requirements

  • Audio Input: Clockgen baseband audio at 46875Hz
  • JSON Input: TBC JSON from video RF decode
  • Output: Final aligned audio resampled to 48kHz

Linux & MacOS

Stereo Clockgen (46875Hz → 48kHz)
"ffmpeg" -i baseband.wav -filter 'channelmap=map=FL-FL|FR-FR' -f s24le -ac 2 - | mono VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 6 --stream-sample-rate-hz 46875 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg -f s24le -ar 46875 -ac 2 -i - -af aresample=48000 -sample_fmt s32 baseband_aligned.flac
Mono Clockgen (46875Hz → 48kHz)
"ffmpeg" -i baseband.wav -filter_complex "[0:a]channelsplit=channel_layout=2.1:channels=FL[FL]" -map "[FL]" -f s24le -ac 1 - | mono VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 3 --stream-sample-rate-hz 46875 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg -f s24le -ar 46875 -ac 1 -i - -af aresample=48000 -sample_fmt s32 baseband_aligned.flac

Windows

Stereo Clockgen (46875Hz → 48kHz)
ffmpeg.exe -i baseband.wav -filter_complex "channelmap=map=FL-FL|FR-FR" -f s24le -ac 2 - | VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 6 --stream-sample-rate-hz 46875 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg.exe -f s24le -ar 46875 -ac 2 -i - -af aresample=48000 -sample_fmt s32 baseband_aligned.flac
Mono Clockgen (46875Hz → 48kHz)
ffmpeg.exe -i baseband.wav -filter_complex "[0:a]channelsplit=channel_layout=2.1:channels=FL[FL]" -map "[FL]" -f s24le -ac 1 - | VhsDecodeAutoAudioAlign.exe stream-align --sample-size-bytes 3 --stream-sample-rate-hz 46875 --json capture.tbc.json --rf-video-sample-rate-hz 40000000 | ffmpeg.exe -f s24le -ar 46875 -ac 1 -i - -af aresample=48000 -sample_fmt s32 baseband_aligned.flac

Key Sample Rates Reference

Audio Source Input Rate Output Rate
HiFi-Decode 48000 Hz 48000 Hz
MISRC 78125 Hz 48000 Hz
Clockgen Mod 46875 Hz 48000 Hz

Important

Remember to update these values in your commands:

  • Replace capture.tbc.json with your actual JSON file name
  • Replace input audio filename (e.g., hifi_audio.wav, misrc_baseband.wav)
  • Replace output filename as desired
  • Adjust --rf-video-sample-rate-hz if using different capture rates (40Msps/20Msps/16Msps)

Page End

Home

Starting & Contributing

Software Installation

Capture Hardware

Hardware Installation

Software Usage

VBI Data Extraction & Decoding

Tools & Scripts

Guides

Technical

Other Decoders

Support & Community

Clone this wiki locally