File: technical.md

package info (click to toggle)
immich-go 0.31.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 94,260 kB
  • sloc: sh: 770; makefile: 21
file content (350 lines) | stat: -rw-r--r-- 10,482 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# Technical Details

This document covers the technical aspects of how Immich-Go processes files, handles metadata, and implements various features.

## File Processing

### Supported File Types
Immich-go supports same formats as Immich supports, among them:

#### Image Formats
- **JPEG**: `.jpg`, `.jpeg`
- **HEIC/HEIF**: `.heic`, `.heif` (Apple formats)
- **RAW Formats**: `.dng`, `.cr2`, `.cr3`, `.arw`, `.raf`, `.nef`, `.rw2`, `.orf`
- **Other**: `.png`, `.gif`, `.bmp`, `.tiff`, `.webp`

#### Video Formats
- **Common**: `.mp4`, `.mov`, `.avi`, `.mkv`
- **Mobile**: `.3gp`, `.m4v`
- **Professional**: `.mts`, `.m2ts`

#### Metadata Formats
- **XMP Sidecar**: `.xmp` files
- **Google Photos**: `.json` metadata files
- **Immich Archive**: `.JSON` metadata files

### Banned Files

Immich-Go automatically excludes several junk patterns. A trailing `/` means the pattern applies to directories; omit the slash to match files.

| Pattern              | Source          | Description              |
| -------------------- | --------------- | ------------------------ |
| `@eaDir/`            | Synology NAS    | Thumbnail directory      |
| `@__thumb/`          | Synology NAS    | Thumbnail directory      |
| `SYNOFILE_THUMB_*.*` | Synology NAS    | Thumbnail files          |
| `Lightroom Catalog/` | Adobe Lightroom | Catalog directory        |
| `thumbnails/`        | Various         | Generic thumbnail folder |
| `.DS_Store`          | macOS           | Finder metadata file     |
| `/._*`               | macOS           | Resource fork stubs      |
| `.Spotlight-V100/`   | macOS           | Spotlight index folder   |
| `.photostructure/`   | PhotoStructure  | Application data         |
| `Recently Deleted/`  | iCloud          | Recently deleted items   |

### Date Extraction

#### Priority Order
1. **EXIF Metadata**: Primary source from image files
2. **XMP Sidecar**: Secondary source from `.xmp` files
3. **JSON Metadata**: From Google Photos or archive files
4. **Filename Parsing**: Last resort extraction from filenames

#### Filename Date Patterns

| Pattern      | Example                                 | Format                |
| ------------ | --------------------------------------- | --------------------- |
| ISO Format   | `2023-07-15_14-30-25.jpg`               | `YYYY-MM-DD_HH-MM-SS` |
| Timestamp    | `IMG_20230715_143025.jpg`               | `IMG_YYYYMMDD_HHMMSS` |
| Phone Format | `20230715_143025.jpg`                   | `YYYYMMDD_HHMMSS`     |
| Screenshot   | `Screenshot 2023-07-15 at 14.30.25.jpg` | Various patterns      |

#### Date Range Formats

| Input                   | Interpretation                      |
| ----------------------- | ----------------------------------- |
| `2023`                  | January 1, 2023 - December 31, 2023 |
| `2023-07`               | July 1, 2023 - July 31, 2023        |
| `2023-07-15`            | July 15, 2023 (single day)          |
| `2023-01-15,2023-03-15` | Explicit range                      |

## Metadata Handling

### XMP Sidecar Processing

Immich-Go passes XMP files to the Immich server without modification. Immich uses them for:
- **Date/Time Information**: Capture date and timezone
- **GPS Location**: Latitude/longitude coordinates
- **Tags/Keywords**: Hierarchical tag structures
- **Descriptions**: Photo descriptions and titles
- **Technical Data**: Camera settings, lens information

### Google Photos JSON Processing

Google Photos JSON files contain rich metadata extracted and used by Immich-Go:

```json
{
  "title": "IMG_20230715_143025.jpg",
  "description": "Family vacation photo",
  "imageViews": "1",
  "creationTime": {
    "timestamp": "1689424225",
    "formatted": "Jul 15, 2023, 2:30:25 PM UTC"
  },
  "geoData": {
    "latitude": 37.7749,
    "longitude": -122.4194,
    "altitude": 0.0,
    "latitudeSpan": 0.0,
    "longitudeSpan": 0.0
  },
  "people": [
    {
      "name": "John Doe"
    }
  ]
}
```

#### Extracted Information
- **Albums**: Photo album associations
- **GPS Coordinates**: Location data
- **Capture Date**: Original photo timestamp
- **People Tags**: Face recognition names
- **Status Flags**: Favorite, archived, trashed, partner shared

### Archive Metadata Format

Immich-Go generates comprehensive JSON metadata for archived photos:

```json
{
  "fileName": "example.jpg",
  "latitude": 37.7749,
  "longitude": -122.4194,
  "dateTaken": "2023-10-01T12:34:56Z",
  "description": "Golden Gate Bridge view",
  "albums": [
    {
      "title": "San Francisco Trip",
      "description": "Photos from my vacation",
      "start": "2023-10-01T00:00:00Z",
      "end": "2023-10-05T23:59:59Z"
    }
  ],
  "tags": [
    {
      "value": "Location/USA/California/San Francisco"
    },
    {
      "value": "Event/Vacation"
    }
  ],
  "rating": 5,
  "trashed": false,
  "archived": false,
  "favorited": true,
  "fromPartner": false,
  "motion": false,
  "livePhoto": false
}
```

## File Pairing and Stacking

### Burst Detection

#### Time-Based Detection
- **Threshold**: Photos taken within 900ms
- **Algorithm**: Groups consecutive photos below threshold
- **Limitations**: May group unrelated rapid shots

#### Filename-Based Detection

##### Huawei Smartphones
```
Pattern: IMG_YYYYMMDD_HHMMSS_BURSTXXX[_COVER].jpg
Example: IMG_20231014_183246_BURST001_COVER.jpg
         IMG_20231014_183246_BURST002.jpg
```

##### Google Pixel
```
Pattern: PXL_YYYYMMDD_HHMMSSXXX.MOTION-XX.COVER/ORIGINAL.jpg
Example: PXL_20230330_184138390.MOTION-01.COVER.jpg
         PXL_20230330_184138390.MOTION-02.ORIGINAL.jpg
```

##### Samsung
```
Pattern: YYYYMMDD_HHMMSS_XXX.jpg
Example: 20231207_101605_001.jpg
         20231207_101605_002.jpg
```

##### Sony Xperia
```
Pattern: DSC_XXXX_BURSTYYYYMMDDHHMMSSXXX[_COVER].JPG
Example: DSC_0001_BURST20230709220904977.JPG
         DSC_0035_BURST20230709220904977_COVER.JPG
```

##### Nothing Phones
```
Pattern: XXXXXIMG_XXXXX_BURSTXXXXXXXXXXXXX[_COVER].jpg
Example: 00001IMG_00001_BURST1723801037429_COVER.jpg
         00002IMG_00002_BURST1723801037429.jpg
```

### RAW + JPEG Pairing

#### Detection Algorithm
1. **Filename Match**: Same name, different extensions
2. **Directory Location**: Must be in same folder
3. **Timestamp Proximity**: Taken within reasonable timeframe
4. **Size Validation**: RAW significantly larger than JPEG

#### Supported RAW Extensions
- **Canon**: `.cr2`, `.cr3`
- **Nikon**: `.nef`
- **Sony**: `.arw`
- **Fujifilm**: `.raf`
- **Olympus**: `.orf`
- **Panasonic**: `.rw2`
- **Adobe**: `.dng`

#### Example Pairing
```
Files:
- IMG_1234.CR3 (RAW)
- IMG_1234.JPG (JPEG)

Result: Paired for stacking/management
```

### HEIC + JPEG Pairing

Common with Apple devices that shoot in both formats:

```
Files:
- IMG_1234.HEIC (Apple format)
- IMG_1234.JPG (Compatible format)

Detection: Same basename, different extensions
```

### Epson FastFoto Detection

Specialized handling for Epson FastFoto scanner output:

```
Files:
- photo-name.jpg      (Original scan)
- photo-name_a.jpg    (Corrected scan)
- photo-name_b.jpg    (Back of photo)

Stacking: All grouped with corrected (_a) as cover
```

## Upload Processing

### Duplicate Detection

#### Server-Side Deduplication
1. **Checksum Comparison**: SHA-1 hash of file content
2. **Metadata Match**: Filename and timestamp comparison
3. **Size Validation**: File size verification
4. **Skip Logic**: Existing files skipped unless `--overwrite` used

#### Benefits
- **Resumable Uploads**: Interrupted uploads can be safely restarted
- **Multiple Sources**: Same photos from different sources handled gracefully
- **Storage Efficiency**: No unnecessary duplicates on server

### Concurrency Management

#### Upload Workers
- **Default**: Number of CPU cores
- **Range**: 1-20 concurrent uploads
- **Bottlenecks**: Usually network bandwidth, not CPU

#### Performance Characteristics
Based on testing with various configurations:

| Concurrent Uploads | Network Utilization | Server Load | Reliability |
| ------------------ | ------------------- | ----------- | ----------- |
| 1                  | Low                 | Minimal     | Highest     |
| 2-4                | Moderate            | Low         | High        |
| 8-12               | High                | Moderate    | Good        |
| 16+                | Maximum             | High        | Variable    |

#### Resource Usage
- **Memory**: ~10-50MB per concurrent upload
- **Network**: Scales linearly with concurrency
- **CPU**: Minimal impact (I/O bound operation)

## Archive Structure

### Directory Organization

```
archive-folder/
├── 2022/
│   ├── 2022-01/
│   │   ├── IMG_001.jpg
│   │   ├── IMG_001.jpg.JSON
│   │   └── IMG_002.mp4
│   └── 2022-02/
│       └── ...
├── 2023/
│   ├── 2023-01/
│   └── 2023-02/
└── 2024/
    ├── 2024-01/
    └── 2024-02/
```

### Filename Preservation

#### Original Names
- **Primary Files**: Keep original filenames where possible
- **Conflict Resolution**: Append numbers for duplicates (`IMG_001(1).jpg`)
- **Character Sanitization**: Replace filesystem-incompatible characters

#### Metadata Files
- **JSON Sidecar**: `original-name.ext.JSON`
- **XMP Preservation**: Original `.xmp` files copied alongside photos

### Incremental Updates

#### Update Logic
1. **New Files**: Added to appropriate date folders
2. **Existing Files**: Checked for changes, updated if different
3. **Metadata Updates**: JSON files refreshed with current server state
4. **Deletions**: Files not removed from archive (archive-only operation)

### Storage Patterns

#### Temporary Files
- **Location**: System temp or `IMMICHGO_TEMPDIR`
- **Usage**: Minimal temporary storage needed
- **Cleanup**: Automatic cleanup on exit


## 🔍 API Monitoring

This project includes automated monitoring of the Immich API specifications to ensure compatibility:

- **Automated Alerts**: GitHub Actions workflow monitors daily for API changes
- **Manual Checking**: Run `./scripts/check-immich-api.sh` to check for updates
- **Issue Tracking**: Automatic GitHub issues when API changes are detected
- **Documentation**: See [API Monitoring Guide](.github/immich-api-monitor/README.md) for details



## See Also

- [Configuration](configuration.md) - All configuration options
- [Commands](commands/) - Command-specific details
- [Best Practices](best-practices.md) - Performance optimization
- [Examples](examples.md) - Practical usage examples