A small bash-script for geotagging videos. Generates an SRT subtitle file with a running timestamp and GPS coordinates, indicating when and where the footage was shot. As the metadata's in a separate track (not burned onto the footage for example), you can hide it when it's not needed.
exiftool >= 9.52
is needed for reading video file metadata, and performing GPS interpolation.
To check that the tool works and your video file contains the necessary metadata, try:
$ exiftool -CreateDate -Duration GOPR1412.MP4
Create Date : 2014:05:27 08:47:48
Duration : 0:00:30
If the two fields aren't present with sensible values, geodata-subtitle
may still able able to help you, but you'll
likely need to hack around a bit. Reading the source might help.
$ geodata-subtitle GOPR1400.MP4 > GOPR1400.srt
The above example will only write the running timestamp to the SRT file. For a more comprehensive example:
$ geodata-subtitle GOPR1400.MP4 7:06:49 +9:00 path/to.gpx "GeoMaxExtSecs=86400 GeoMaxIntSecs=1800" > GOPR1400.srt
Starting from the right, all arguments can be omitted if the associated functionality isn't wanted. As to the arguments:
GOPR1400.MP4
: video file from which the metadata will be read. Won't be written to.7:06:49
: camera clock correction. The camera clock is assumed to run in local time where the material was shot, but it's never exactly right. This can be used to shift it in line with the time of the GPS instrument that was used, or just local time if no geotagging is needed. Pointing the camera to a clock once while shooting the video is generally really useful in validating this. Negative offsets are allowed.+9:00
: the UTC offset of the location where the material was shot. This will affect geotagging: the camera is assumed to run local time (possibly corrected using the previous argument), and the GPS instrument is assumed to record times in UTC (they usually do), so the UTC offset compensates for this. Negative offsets are allowed.path/to.gpx
: unsurprisingly, file to read GPS locations from. All formats supported byexiftool
should work, not just GPX. Omitting this parameter will simply not attempt any geotagging, and just write out the timestamps."GeoMaxExtSecs=86400 GeoMaxIntSecs=1800"
: Additional options for the geolocation interpolation. If you're gettingTime is too far before track
-warnings for example, consider settingGeoMaxExtSecs
to a higher value (it'll makeexiftool
more tolerant of having to extrapolate missing positions;86400
means one day). The options are documented here.
License: MIT