Immich: Fixing ICloud Video Timestamp Errors

by Lucas 45 views

Hey guys, have you ever run into a situation where the videos you upload to Immich from iCloud Shared Albums end up with the wrong timestamps? It's a pretty annoying problem, but don't worry, we're going to dive deep into why this happens and what we can do about it. This article will explore the bug, the environment, the reproduction steps, and potential solutions. Let's get started!

The Bug: Incorrect Video Timestamps

So, here's the deal. You've got a friend, they've got an iPhone, and they've shared some awesome videos with you via iCloud. You download them, ready to back them up in Immich, right? But then, bam, the timestamps are all messed up. Instead of showing the actual recording time, Immich slaps on the current time of upload. This is a real bummer because it throws off your timeline and makes it harder to find those precious memories.

What makes this even more frustrating is that it only seems to happen with videos shared from iCloud. Photos usually upload with the correct timestamps. And it's not like we're doing anything wrong – we're just trying to get our memories organized.

This isn't just a cosmetic issue, folks. Accurate timestamps are critical for any photo library. They're the backbone of chronological organization, making it easy to browse through your memories. If the timestamps are off, your videos could end up buried, scattered, and lost in the shuffle. Trust me, it's a pain to scroll through your entire library to find that one video of your dog doing something hilarious!

Environment Details

To understand the problem, let's look at the technical stuff. The user is running Immich on an Ubuntu 24.04 server. The Immich server version is v1.140.1, and the mobile app version is v1.139.4. The issue occurs on both the server and the mobile app, specifically when dealing with videos transferred from iCloud Shared Albums.

The user is also using a specific setup: an iPad Air 5 for accessing and downloading videos. The provided docker-compose.yml and .env files give us further insights into their Immich configuration.

Reproduction Steps

Here's how to replicate the issue, step by step:

  1. Get a Friend Involved: Have a friend with an iPhone take a photo and a video. Easy peasy, right?
  2. Share and Join: Ask your friend to create a shared album in iCloud and add you to it. Then, open the album in Apple Photos and download those goodies.
  3. Immich Time: Open your Immich app or web interface and start a backup (if it's not already running). You'll notice the photo usually uploads with the correct timestamp, but the video won't upload automatically.
  4. Force the Upload: Open the video in Immich and manually force the upload. This is usually the step where things go south.
  5. Timestamp Shenanigans: After the upload, check the timestamp of the video. You'll likely see it's the time you uploaded or saved the video, not the original recording time.

See? Pretty straightforward, but the results are definitely not what we want. This process helps pinpoint the exact moment things go wrong.

Diving into the Logs and Metadata

The user has explored exiftool to analyze metadata, and the issue appears to stem from how iOS devices handle timestamps. Specifically, the CreationDate field in the video metadata contains the correct recording time. However, the CreateDate field, which Immich seems to use, is set to the time the file was created or saved, not the actual recording time. This discrepancy is likely the root cause of the timestamp issue.

Videos from other sources (like Android phones or direct uploads from other cameras) may have correct CreateDate values, which is why those videos are uploaded with the right timestamps. The problem is, videos shared from iCloud have this metadata inconsistency, leading to the timestamp errors.

Potential Solutions

So, what can we do to fix this? Here are a few ideas, ranging from simple tweaks to more complex solutions:

  1. Metadata Prioritization: The most direct solution is for Immich to prioritize the CreationDate field over the CreateDate field for iOS-shared videos. This is a relatively simple code change that could fix the issue immediately. This would mean that Immich would look at the CreationDate to get the proper timestamp when available.

  2. User-Adjustable Settings: Ideally, Immich could offer a setting that allows users to choose which metadata field to use for timestamps. This would give users more flexibility and control. For example, you could have an option in the settings to "Prefer CreationDate for iOS videos". This is definitely a more sophisticated approach.

  3. Pre-Processing Scripts: Before uploading, you could run a script (perhaps using exiftool) to copy the CreationDate to CreateDate for iCloud videos. You'd have to implement this outside of Immich, but it could be a good workaround for anyone dealing with this issue right now.

  4. Community Contributions: As Immich is an open-source project, you can contribute to the project by either helping with the development or the documentation, and also reporting issues with as much information as possible.

Conclusion

In conclusion, this is a real head-scratcher, especially when it comes to organizing memories. By diving into the bug, the environment, and the reproduction steps, we can understand how the timestamp issue occurs with videos shared from iCloud. The solution might involve a combination of Immich's metadata handling, custom scripts, and possibly some user-adjustable settings. Until then, we hope this helps you guys keep your photo libraries organized and your memories intact! Keep an eye out for updates, and let's hope we can get this issue resolved for good!