|
Bogdan Timofte
authored
a month ago
|
1
|
# VariaReEncoder
|
|
|
2
|
|
|
|
3
|
Batch transcoder for Garmin Varia dashcam footage. Converts H.264 source clips to HEVC MP4,
|
|
|
4
|
optimized for Apple Photos / QuickTime compatibility, with sidecar JSON copy and a telemetry
|
|
|
5
|
manifest placeholder for a future FIT sync pipeline.
|
|
|
6
|
|
|
|
7
|
## Requirements
|
|
|
8
|
|
|
|
9
|
- macOS or Linux
|
|
|
10
|
- `ffmpeg` and `ffprobe` in `PATH` (any recent version with libx265/libx264; videotoolbox on macOS)
|
|
|
11
|
- Bash 3.2+
|
|
|
12
|
|
|
|
13
|
## Quick Start
|
|
|
14
|
|
|
|
15
|
```bash
|
|
|
16
|
# Transcode everything in SampleFootage → Output (hardware encoder on macOS)
|
|
|
17
|
./garmin_varia_transcode.sh -s SampleFootage -d Output
|
|
|
18
|
|
|
|
19
|
# Preview what would happen without writing any files
|
|
|
20
|
./garmin_varia_transcode.sh -s SampleFootage -d Output --dry-run
|
|
|
21
|
|
|
|
22
|
# Single file, verbose output
|
|
|
23
|
./garmin_varia_transcode.sh -s SampleFootage/Day/clip.mp4 -d Output --verbose
|
|
|
24
|
|
|
|
25
|
# Transcode + delete originals after validation
|
|
|
26
|
./garmin_varia_transcode.sh -s SampleFootage -d Output --move-source
|
|
|
27
|
```
|
|
|
28
|
|
|
|
29
|
## Encoding Modes
|
|
|
30
|
|
|
|
31
|
| Mode | Encoder | Speed (30s clip) | Power\* | Use when |
|
|
|
32
|
|------------|--------------------|-----------------|-----------|----------|
|
|
|
33
|
| `hardware` | hevc_videotoolbox | ~4-5s | ~35W | Default — battery, large libraries, dashcam footage |
|
|
|
34
|
| `auto` | videotoolbox → x265 → x264 | varies | varies | Cross-platform or unknown machine |
|
|
|
35
|
| `quality` | libx265 (CRF 20) | ~50s | ~80W | Archival, cinema, complex sources |
|
|
|
36
|
| `compat` | libx264 (CRF 19) | ~30s | ~70W | Older TVs, players without HEVC support |
|
|
|
37
|
|
|
|
38
|
\* Measured on Apple Silicon MacBook Pro.
|
|
|
39
|
|
|
|
40
|
## CLI Reference
|
|
|
41
|
|
|
|
42
|
```
|
|
|
43
|
Options:
|
|
|
44
|
-s, --source, --input DIR Source directory or single file (default: current directory)
|
|
|
45
|
-d, --destination, --output DIR Destination directory (default: current directory)
|
|
|
46
|
--mode MODE hardware|auto|quality|compat (default: hardware)
|
|
|
47
|
--crf N CRF for quality/compat modes (lower = better; default: 20/19)
|
|
|
48
|
--no-overwrite Skip files that already exist at destination
|
|
|
49
|
--dry-run Print actions without writing files
|
|
|
50
|
--no-recursive Process only the top-level source directory
|
|
|
51
|
--extensions LIST Comma-separated extensions (default: mp4,mov,avi,m4v)
|
|
|
52
|
--verbose Full per-operation logs + ffmpeg/ffprobe output
|
|
|
53
|
--move-source Delete source after strict post-encode validation
|
|
|
54
|
-h, --help Show full help with encoding mode details
|
|
|
55
|
```
|
|
|
56
|
|
|
|
57
|
## Output Conventions
|
|
|
58
|
|
|
|
59
|
- Output is always `.mp4`
|
|
|
60
|
- HEVC outputs tagged `hvc1` (required for Apple Photos / QuickTime)
|
|
|
61
|
- Directory structure under source is preserved at destination
|
|
|
62
|
- File timestamps copied from source (`touch -r`)
|
|
|
63
|
- JSON sidecars copied 1:1 to destination
|
|
|
64
|
- `telemetry_manifest.json` written to destination as a placeholder for a future FIT sync pipeline
|
|
|
65
|
|
|
|
66
|
## Output Format (quiet mode, default)
|
|
|
67
|
|
|
|
68
|
```
|
|
|
69
|
2026-05-04 12:08:00 : Transcoding SampleFootage/Day/2026-04-04_18-10-36.mp4 ... done in 5s
|
|
|
70
|
2026-05-04 12:08:04 : Transcoding SampleFootage/Day/2026-04-04_18-10-05.mp4 ... done in 4s
|
|
|
71
|
[2026-05-04 12:08:35] [INFO] Summary: videos_processed=10 videos_skipped=0 errors=0
|
|
|
72
|
[2026-05-04 12:08:35] [INFO] Timing: total_elapsed=44s, video_encode_avg=4s
|
|
|
73
|
```
|
|
|
74
|
|
|
|
75
|
## Safety
|
|
|
76
|
|
|
|
77
|
- Destination inside source is rejected with an error
|
|
|
78
|
- `--move-source` only deletes source after codec + duration validation passes
|
|
|
79
|
- `--dry-run` never writes files
|
|
|
80
|
|
|
|
81
|
## Source Files
|
|
|
82
|
|
|
|
83
|
```
|
|
|
84
|
SampleFootage/ Original clips (gitignored)
|
|
|
85
|
Output/ Transcoded output (gitignored)
|
|
|
86
|
garmin_varia_transcode.sh Main script
|
|
|
87
|
CHANGELOG.md Version history
|
|
|
88
|
DEVLOG.md Development decisions and rationale
|
|
|
89
|
```
|