Comments (7)
Ok, after plenty of research and testing I have landed on the most common timeshifting problem and a partial solution for it.
GoPro cameras save video files with local times, while the QuickTime standard defined video time information in UTC. While staying within the GoPro camera itself and the Quik mobile app, that does not represent an issue as both treat it the same way. Unfortunately, all other platforms including GoPro Cloud, Apple Photos, and Google Photos treat the date/time information as UTC resulting in all videos being timeshifted once they leave the GoPro ecosystem.
exiftool
provides a simple solution to timeshifting files and it should be able to incorporate that timeshift into the --process
option without the need for an additional pass over the data.
For this to work we need the DST offset to be applied to the video date/time data of all the videos (not photos as they are correct). That offset could either come from the geonames lookup we perform after import (not perfect as we only do one lookup per day) or from the delta of the QuickTime Create Date and the first GPS Date of the file, since the GPS Date/Time is always in UTC. Alternatively, we could even consider using the first GPS Date/Time as is.
Here is an example of how to use exiftool
to perform the timeshift:
exiftool -AllDates+=7 -quicktime:time:all+=7 -verbose -o P_20221004110648_GoPro_Hero10_2442_GX010328.mp4
As per this example, it will probably be a good idea to expand the file prefix from Keeping the filename as is to preserve the local time the file was recorded in. This allows us to still find the originating imported file without additional logic at the library level.P_
for processed to PT_
for processed and timeshifted.
from goprox.
Calculating the timeshift difference dynamically based on rounded hours between CreateDate
and GPSDateTime
:
exiftool -ee -d '%s' -p '${GPSDateTime;$_=int(($_-$self->GetValue("CreateDate"))/3600+0.5)}' P_20221004110648_GoPro_Hero10_2442_GX010328.mp4
from goprox.
The integrated version that calculates time shift and assigns it to all QuickTime dates that exist (but no more)
exiftool -wm w -ee -d '%s' '-quicktime:time:all<${GPSDateTime;$_=$self->GetValue("CreateDate")+int(($_-$self->GetValue("CreateDate"))/3600+0.5)*3600}' -o PT_20221004110648_GoPro_Hero10_2442_GX010328.mp4 P_20221004110648_GoPro_Hero10_2442_GX010328.mp4 -api TimeZone=GMT
The only thing left: replace rounding logic with one that works for negative offsets as well.
from goprox.
And this is the final exif logic with the expanded rounding logic that works for positive and negative offsets:
exiftool -wm w -ee -d '%s' '-quicktime:time:all<${GPSDateTime;$_=$self->GetValue("CreateDate")+int((($_-$self->GetValue("CreateDate"))/3600)+(($_-$self->GetValue("CreateDate"))/3600)/abs((($_-$self->GetValue("CreateDate"))/3600)*2 || 1))*3600}' -o PT_20221004110648_GoPro_Hero10_2442_GX010328.mp4 P_20221004110648_GoPro_Hero10_2442_GX010328.mp4 -api TimeZone=GMT
Next up is workflow integration. Will perform this time shift every time we process media for video files. Unfortunately due to the nature of the logic especially due to -wm w
this cannot be combined with the current processing pass, but has to be executed as an additional pass over the data.
from goprox.
After extensive testing and repeat usage of the logic, it has become obvious that renaming time-shifted video media is not a good idea as repeat runs would hang themselves as exiftool cannot overwrite existing target files.
The new implementation keeps the original processed filename and simply shifts all Quicktime tags to UTC while preserving the filesystem modification date&time as well as the filename.
from goprox.
Need to investigate why the embedded timeshift within the process
flow does not find matching files in some cases.
from goprox.
Turns out the default time format set via -d '%d'
leads to a broken TimeFmt logic in the -if4
clause of the exiftool statement.
-if4 '${FileModifyDate;DateFmt("%s")} gt 1666957443'
breaks when combined into
-d '%s' -if4 '${FileModifyDate;DateFmt("%s")} gt 1666957443'
as a double conversion would take place. To fix any prior output of print format needs to be eliminated for this tag by adding a #
-d '%s' -if4 '${FileModifyDate#;DateFmt("%s")} gt 1666957443'
from goprox.
Related Issues (20)
- Feature: Cleanup parameters and add filter options HOT 1
- Feature: Enhanced logging
- Update: Add new GoPro Labs v1.20.70 FW for Hero 11
- Feature: Add support for new GoPro Hero 11 Mini
- Update: Add new GoPro Hero 11 Firmware v1.20
- Test and verify new exiftool version 12.50 HOT 1
- Bug: Make test option local timezone independent
- Feature: Expand relative paths in logging output
- Documentation: Create initial help screen and man pages
- Feature: Enhance system level logging
- Bug: Fix GitHub Actions shield
- Feature: Create hidden markers on GoPro cards
- Feature: Improved archive processing
- Bug: Fix firmware processing
- Feature: Camera firmware updates
- Feature: Improved testing
- Update: Add various new GoPro firmware versions
- Bug: Permission Denied during --firmware processing
- Feature: Add basic support for DJI drone import
- Misc: Create FreeBSD Port HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goprox.