~proflutz/TicTacSync

Hardware + software combo for audio video syncing

48fc844 README.mf tweaks

5 months ago

e1622be edited tracks.txt for multicam

5 months ago

#tictacsync

#Warning: this is at pre-alpha stage

Unfinished sloppy code ahead, but should run without errors. Some functionalities are still missing. Don't run the code without parental supervision. Suggestions and enquiries are welcome via the lists hosted on sourcehut.

#Description

tictacsync is a python script to sync, cut and join audio files against camera files shot using a specific hardware timecode generator called Tic Tac Sync. The timecode is named TicTacCode and should be recorded on a scratch track on each device for tictacsync to work.

#Status

Feature complete! tictacsync scans for audio video files and then merges overlapping audio and video recordings, It

  • Decodes the TicTacCode audio track alongside your audio tracks
  • Establishes UTC start time (and end time) within 100 μs!
  • Syncs, cuts and joins any concurrent audio to camera files (using FFmpeg)
  • Processes multiple audio recorders
  • Corrects device clock drift so both ends coincide (thanks to sox)
  • Sets video metadata TC of multicam files for NLE timeline alignement
  • Writes synced ISO files with dedicated file names declared in tracks.txt

#Installation

This uses the python interpreter and multiple packages (so you need python 3 + pip). Also, you need to install two non-python command line executables: ffmpeg and sox. Make sure those are accessible through your PATH system environment variable. Then pip install the syncing program:

> pip install tictacsync

This should install python dependencies and the tictacsync command.

#Usage

Download multiple sample files here (625 MB, sorry) unzip and run:

> tictacsync dailies/loose

The program tictacsync will recursively scan the directory given as argument, find all audio that coincide with any video and merge them into a subfolder named SyncedMedia. When the argument is an unique media file (not a directory), no syncing will occur but the decoded starting time will be printed to stdout:

	
> tictacsync dailies/loose/MVI_0024.MP4

Recording started at 2024-03-12 23:07:01.4281 UTC
true sample rate: 48000.736 Hz
first sync at 27450 samples in channel 0
N.B.: all results are precise to the displayed digits!

If shooting multicam, put clips in their respective directories (using the camera name as folder name) and the audio under their own directory. tictacsync will detect that structured input and will generate multicam folders ready to be imported into your NLE (for now only DaVinci Resolve has been validated).

#Options

For a very verbose output add the -v flag:

> tictacsync -v dailies/loose/MVI_0024.MP4

For a one line output (or to suppress the progress bars) use the --terse flag:

> tictacsync --terse dailies/loose/MVI_0024.MP4 
dailies/loose/MVI_0024.MP4 UTC:2024-03-12 23:07:01.4281 pulse: 27450 in chan 0

To also produce synced ISO audio files, specify --isos . A directory named ISOs will contain for each synced video a set of ISO audio files of exact same length, padded or trimmed to coincide with the video track. After re-editing and re-mixing a remergemix command will resync the new audio with the video and the new sound track will be updated on your NLE timeline, at least in Kdenlive...

> tictacsync --isos dailies/structured

When called with the -p flag, zoomable plots will be produced for diagnostic purpose (close the plotting window for the 2nd one) and the decoded starting time will be output to stdin:

> tictacsync -p dailies/loose/MVI_0024.MP4

Typical first plot produced :

word

Typical second plot produced (note the 34 FSK encoded bits 0010111101001111100110000110010000): slicing