GoPro Hero 8 footage provides optical context for sonar data but presents synchronization challenges. These scripts extract clips from continuous recordings, downsample to multiple resolutions, and calculate optical flow for motion matching.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/dfki-ric/uxo-dataset2024/llms.txt
Use this file to discover all available pages before exploring further.
Pipeline Stages
GoPro processing consists of three scripts:- prep_7_gopro_cut.bash - Extract clips from raw footage
- prep_8_gopro_downsample.bash - Re-encode to target resolutions
- prep_9_gopro_calc_optical_flow.py - Calculate optical flow
Synchronization Challenge
The GoPro Hero 8 does not provide synchronized timestamps with the ARIS or gantry systems. To align footage:- Manual timestamp extraction: Identify clip boundaries by finding motor engagement in audio tracks
- Optical flow matching: Compare GoPro motion patterns with ARIS optical flow
- Manual offset adjustment: Fine-tune synchronization in
prep_x_match_recordings.py
Step 1: Clip Extraction (prep_7_gopro_cut.bash)
Purpose
Cuts the continuous GoPro recordings into individual clips corresponding to each trajectory. Uses manually extracted timestamps where motor engagement is visible in the audio track.Timestamp Extraction Method
Timestamps were determined by:- Opening raw footage in video editor
- Examining audio waveform for motor engagement spikes
- Marking first frame with movement as clip start
- Marking last frame with movement as clip end
- Recording timestamps in MM:SS.mmm format
Configuration
config.yaml
Script Structure
The bash script reads configuration fromconfig.yaml and executes ffmpeg commands:
Example Clip Extraction
Usage
Output
Clip Naming Convention
The
-c copy flag copies video without re-encoding, making this step fast despite large file sizes. Audio is stripped with -an as it’s not needed for the dataset.Step 2: Downsampling (prep_8_gopro_downsample.bash)
Purpose
Re-encodes the UHD (5.3K) clips to lower resolutions for:- Preview and matching (SD: 640×360)
- Dataset export (FHD: 1920×1080)
- Full resolution (UHD: 5312×2988, optional)
Why Downsample Cut Clips?
Downsampling cut clips is more efficient than downsampling full footage because:- Only relevant portions are processed
- Can test different resolutions without re-cutting
- Parallel processing is easier with smaller files
Resolution Options
- sd (Standard Definition)
- fhd (Full HD)
- uhd (Ultra HD)
Resolution: 640×360Best for:
- Quick preview of recordings
- Optical flow calculation (faster)
- Manual matching in GUI tools
Configuration
config.yaml
Script Structure
Usage
This script processes all clips sequentially. For faster processing, consider running multiple ffmpeg instances in parallel manually.
Output
Step 3: Optical Flow Calculation (prep_9_gopro_calc_optical_flow.py)
Purpose
Calculates optical flow magnitudes for each GoPro clip. This enables motion-based matching with ARIS recordings, which is essential since the GoPro lacks synchronized timestamps.Optical Flow Methods
Configuration
config.yaml
Usage
gopro_clip_resolution.
Implementation Details
The script uses OpenCV’sVideoCapture to iterate through frames:
Output
*_flow.csv contains one row per frame with the optical flow magnitude.
Matching Workflow
After all preprocessing, match GoPro clips to ARIS recordings:Compare optical flow patterns
The tool displays:
- ARIS optical flow over time
- GoPro optical flow over time
- Current frame from both sensors
Identify matching motion
Look for similar patterns in the flow curves. The motion profile should be recognizable despite different absolute magnitudes.
Adjust time offset
Fine-tune the temporal offset until frames are synchronized. The tool shows overlaid frames to verify alignment.
Performance Tips
Cutting is slow
Cutting is slow
Cutting with
-c copy should be fast (no re-encoding). If slow:- Check disk I/O (slow external drive?)
- Verify you’re using
-c copy, not re-encoding - Process files in parallel manually
Downsampling takes forever
Downsampling takes forever
5.3K to FHD re-encoding is CPU-intensive. To speed up:
- Use hardware acceleration:
-c:v h264_nvenc(NVIDIA) or-c:v h264_videotoolbox(Mac) - Process clips in parallel across multiple machines
- Only generate SD for matching, skip FHD until export
Optical flow calculation fails
Optical flow calculation fails
Ensure:
- Video files are not corrupt
- OpenCV can read the codec (H.264 should work)
- Sufficient disk space for CSV output
- RAM available for video decoding
Export Configuration
When exporting the final dataset, only one GoPro resolution is included:config.yaml
Troubleshooting
FFmpeg not found
FFmpeg not found
Install ffmpeg:
Audio extraction failed
Audio extraction failed
These scripts use
-an (no audio) in all commands. If you need audio for timestamp extraction, remove the -an flag.Clips don't match trajectories
Clips don't match trajectories
Double-check timestamps in
prep_7_gopro_cut.bash. Times should match visible motor engagement in audio waveform.Next Steps
Gantry Extraction
Extract trajectory data to complete the sensor suite
Export
Assemble synchronized data for final dataset