CONTINUUM CONTINUUM
Video Cutter · GuideHow to sync the cameras by their claps and cut them from the trial markers

Video Cutter guide

The Video Cutter syncs the cameras with each other by their claps, then cuts the long session recordings into one short video per test and run, using the start and stop times of the Clinical Log trial markers. Each clip is named after the test, the run and the camera, in one folder per test and run: TUG_run_01/left.mp4, TUG_run_01/right.mp4 (OBS cameras: TUG_run_01/cam0.mp4, cam1.mp4 …).

Before you start

1 · Choose the session videos

Click Choose video folder… and choose the subject's folder, e.g. VIDEOS/SUBJECT_03 with the iPhone clips in RIGHT/ and LEFT/, or one session's folder, e.g. VIDEOS/SUBJECT_1001/SESSION_01. Every video inside it is listed with its camera, its Rec. start (the clock time of its first frame) and its end.

Untick the videos you don't want (e.g. clips from another day or a test recording); the box in the header ticks or unticks all of them. Only the ticked videos are synced and cut. Changing the choice after a sync by sound undoes the sync, so click Sync by sound again.

Offset between the video and the sensors

Usually filled in by itself. While it is online, the Clinical Log measures how far its computer's clock is from internet time (the phones follow internet time) and saves it in the trial markers. When those trial markers are loaded, the Video Cutter puts the matching offset in Offset (s), all cameras and says so in green under it (e.g. the Clinical Log computer was 5.02 s ahead). Nothing has to be done. Older trial markers, or a session logged offline, have no measurement: then the offset stays 0 unless you type it.

When the video clock is not the sensor clock, type the offset under the video list. It is the same number as the Offset Detector's result and the Video Annotator's Offset (s):

offset = video clock − sensor clock

2 · What to cut

Choose one of the two options at the top of step 2:

One clip per trial

The start and stop of each run come from the Clinical Log file subject_XX_trialMarkers.yaml. With the Data folder set, it is loaded from RAW_DATA/SUBJECT_XX/SESSION_YY by itself. Otherwise click Load trialMarkers….

Whole videos, synced only (calibration)

For videos that must be synchronized but not cut into trials, such as the calibration videos. No trial markers are needed.

  1. In step 1 choose the folder (e.g. VIDEOS/SUBJECT_XX/Calibration). When both phones' videos are in that one folder, type LEFT / RIGHT in the Camera box of each.
  2. In step 2 tick Whole videos, synced only. File name starts as the folder's name; the files are <name>/<camera>.mp4, e.g. Calibration/left.mp4, Calibration/right.mp4 (Calibration_01/left.mp4 … when there are several recordings).
  3. In step 3 click Sync by sound and check the claps (claps at the very start and end of the videos are fine).
  4. Cut. Every camera's video is cut to the part all cameras recorded together, so the files start on the same moment and have the same number of frames. Nothing else is cut off.

3 · Sync the cameras by sound

This step needs videos from two or more cameras. If it says all the videos belong to one camera, their camera is taken from one folder: put each camera's videos in its own folder (RIGHT/, LEFT/) or type the camera of each video in step 1.

With two or more cameras, this step lines them up with each other by their sound, instead of trusting each camera's Rec. start. The claps heard during the session keep them in step all along, even when a camera's clock drifts. It is optional: without it every camera is placed by its Rec. start − Offset.

  1. Choose the Reference camera: the one where the claps are heard best. It stays on its Rec. start − Offset (so the offset in step 1 still matters for it); the other cameras follow it.
  2. Click Sync by sound. The whole sound of the reference videos is read to find the claps (long videos take a while), then each other video gets its delay to the reference video it overlaps.
  3. Check the claps. The loudness plot shows the whole reference video: green lines are ticked claps, grey ones other candidates; click it to move the player there. In the list, play each candidate with ▶ (3 s around it) and untick what is not a clap. A clap missing? Find it in the player (‹ 0.05 s / 0.05 s › to step) and click Add clap here; ✕ removes one added by hand.
  4. Delay here shows, for every ticked clap, the delay measured there for each other camera. Its ▶ plays that camera at the same clap, so you can hear and see that both line up. no match = that clap is not used; not covered = that camera was not recording then; not used = its delay is more than 50 ms from the other claps' (so it is probably not a real clap) and it is ignored. Each clip uses the delay of the claps around it.
  5. Check the cuts. The same plot shows every clip of step 4 that comes from that video: a light red band between two red lines (start and end, margins included). Point at a band to see its trial and run next to the time (e.g. 4:12.30 · TUG · run 01); click it to watch that moment. Overlapping clips, such as the combined SPPB balance clip over the three balance tests, shade darker. The bands follow the plan: they move when you change the margins, include NOT OK runs or the trial markers. They are drawn on the reference camera; the other cameras are cut at the same moments through the sync.

4 · Check the clips

The table lists every clip that will be made: one per run and camera, with its start time, length, the video it is taken from and where in that video (At). Check shows the start and end of a clip in every camera and lets you move them by hand. Check the notes under the table:

Check and move the cut by hand

When the trial markers or the sync are a little off (a start clicked late, a camera whose claps were unclear), check the clips before cutting. Click Check on any row: the trial opens under the table with every camera side by side.

A clip moved by hand shows manual in the table, its loudness-plot band (step 3) moves too, and the cut uses the new start and end. cut_plan.csv records the move in manual_start_s, manual_end_s (s from the trial markers) and camera_shift_s. The changes are kept until another video folder or trialMarkers file is loaded; a clip that already exists is only made again with overwrite existing clips ticked.

Cut: exact (default) re-encodes the clip so it starts on the exact frame. fast copies the video data and is quicker, but the clip starts at the key frame before the start (up to a few seconds earlier). fast is only available with one camera.

Same number of frames in every camera

With several cameras, all clips of the same trial and run get exactly the same number of frames, so they can be processed together:

5 · Cut the videos

  1. The clips are saved in VIDEOS_SPLIT/SUBJECT_XX/SESSION_YY in the Data folder (the browser asks once to allow editing). Or click Choose output folder…: it always opens in VIDEOS_SPLIT (in the subject's folder when it exists).
  2. Click Cut videos. Each row shows its progress; Stop cancels the clip being cut and stops.
  3. Clips that already exist are skipped, so you can run it again after adding videos. Tick overwrite existing clips to make them again.
Keep the tab open and visible while it cuts. A long run (e.g. the 9-minute UPDRS on 5 cameras) takes a while.

A file cut_plan.csv is saved with the clips: for each clip, the trial, the camera, the clock times, the video it came from and where in it; for cameras synced by sound also sync_ref (the reference video) and sync_delay_s (the delay used for that clip), the fps and number of frames, and how far the cut was moved by hand (manual_start_s, manual_end_s, camera_shift_s; 0 = automatic).

Names and conditions

VIDEOS_SPLIT/SUBJECT_XX/<test>_run_ZZ/<camera>.mp4, one folder per test and run with one video per camera, e.g. TUG_run_01/right.mp4, SPPB_Sit_to_Stand_run_02/left.mp4, or with OBS TUG_run_01/cam0.mp4 … cam4.mp4. The camera is camN for OBS and right / left for the phones (file names always in lower case), from the side in their folder name (e.g. Videos from right side). The test is the Clinical Log trial name (spaces and dashes become _); the run number is the one in the Clinical Log, so the clips match the sensor files (e.g. TUG runs 01 and 03 when run 02 was NOT OK). cut_plan.csv lists each clip with its condition number:

condClinical Log trialcondClinical Log trial
00UPDRS06SPPB - Tandem Stand
01TUG07SPPB - Sit to Stand
02CogTUG082MWT
03SPPB - 4 meters walk09Circuit upper body
04SPPB - Side By Side Stand10Circuit lower body
05SPPB - Semi-Tandem Stand

Problems