-
Notifications
You must be signed in to change notification settings - Fork 101
Auto Audio Align
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.
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.
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.
HiFi-Decode Workflow (48kHz → 48kHz)
-
Audio Input: HiFi-decoded audio at 48kHz (from
hifi-decode) - JSON Input: TBC JSON from video RF decode
- Output: Final aligned audio at 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"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.flacffmpeg.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.flacffmpeg.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.flacMISRC Workflow (78125Hz → 48kHz)
- Audio Input: MISRC baseband audio at 78125Hz
- JSON Input: TBC JSON from video RF decode
- Output: Final aligned audio resampled to 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"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.flacffmpeg.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.flacffmpeg.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.flacClockgen Mod Workflow (46875Hz → 48kHz)
- Audio Input: Clockgen baseband audio at 46875Hz
- JSON Input: TBC JSON from video RF decode
- Output: Final aligned audio resampled to 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"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.flacffmpeg.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.flacffmpeg.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| 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.jsonwith 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-hzif using different capture rates (40Msps/20Msps/16Msps)
- FAQ - Frequently Asked Questions
- Diagram Breakdowns
- Visual-Comparisons
- VCR Reports / RF Tap Examples
- Download & Contribute Data
- Speed Testing
- Capture Setup Guide
- MISRC
- CX Cards & CXADC
- CX Cards - Clockgen Mod
- DdD - Domesday Duplicator
- RTL-SDR
- Hardware Installation Guide
- Finding RF Tap Locations
- Amplifier Setup Guide
- The Tap List Example VCR's
- Visual VBI Data Guide
- Closed Captioning
- Teletext
- WSS Wide - Screen Signalling
- VITC Timecode
- VITS Signals
- XDS Data (PBS)
- Video ID IEC 61880
- Auto Audio Align
- Vapoursynth TBC Median Stacking Guide
- Ruxpin-Decode & TV Teddy Tapes
- Tony's GNU Radio For Dummies Guide
- Tony's GNU Radio Scripts
- DomesDay Duplicator Utilities
- ld-decode Utilities