on 04-04-2019 05:04 AM
I'm interested in this (but no experience using ffmpeg) but it doesn't look like this is possible. Someone can correct me if I'm wrong, but given that threads on extracting an exact frame number (let alone timestamp) for an original frame show that this isn't simple, finding GPS coordinates based on the individual frame isn't possible directly.
As I understand it, there are no GPS coordinates mapped to individual frames as there would be with a single camera image from a still camera with a gps chip embedding coordinates into the metadata. Instead, GPS tracklogs alongside video (GoPro included) are separate streams (stored in various places and in various ways, making it interesting for developers to try and pull them out and make them comprehensible).
You can see some of the ramifications of this by looking at a GPX (or csv) of GoPro gps data extracted by dashware or GPMD2CSV: A hyperlapse I shot has 3 GPS stamps per second but 30 video frames per second. A 60fps video I shot has GPS coordinate data at 20x per second.
The best you'd be able to do -- if you could get a perfect timestamp for a frame off the video -- would be interpolating between the known GPS coordinates. Exiftool can do that for you via -geotag, or you can do it yourself using something like lightroom. Since any timestamp you got on a frame would be an interpolation, you'd be locating the frame by matching one interpolation to another. Probably more than adequate, but not simple.
If I were pulling frames, I'd just snapshot them in VLC player, fix the individual frame datetimeoriginal field to the video's shot datetime + elapsed time to the frame, and either let exiftool -geotag it (or them) from the exported gpx file, or drop them on a map in lightroom or similar in the next window. This would obviously only be tolerable for a handful of frames at a time.
Maybe there's a better way.
on 04-04-2019 05:19 AM
I'm not suggesting that you extract GPS metadata using ffmpeg.
It might be easier to suggest possible solutions if you could explain at a high level what you are ultimately trying to do with the MP4 and the images you export and GPS tag from the MP4.
on 04-04-2019 05:22 AM
on 04-04-2019 05:32 AM
Dashware already exports the data to a CSV, which is found in the project save folder alongside the other saved project files. If and when you grab the correct data profile, and the sync is OK, it then does the overlays and gauges correctly (though not always, in my experience. Hyperlapses seem to vex it, as they vex Quik).
A GPX (as well as few different CSV) exports of the telemetry can be obtained via GPMD2CSV's batch process. These can also easily be used in dashware with the correct data profile. However, (again, as I understand it) there's no per-frame GPS data to be obtained by any extraction method, because (as outlined above) this does not exist. There's video stream. There's telemetry and GPS data in a separate stream, and these are not mapped to each other frame by frame. Any software mapping overlay is interpolating map position and frame display based on a synchronization routine from a more-or-less known position at a more-or-less known time (either automatic or manual).
04-04-2019 05:32 AM - edited 04-04-2019 05:33 AM
Let me clarify. Yes, you could use ffmpeg to extract the metadata from the MP4. But, it would be at the track (aka stream) level. The GPS data associated with a specific frame would need to be done using another method from the extracted track data.
Again, could you please explain at a high level what you are trying to achieve?
on 04-04-2019 06:14 PM
1) Extract a GPX (either from MP4 or misc telemetry files on the GoPro)
2) Check the file creation timestamp in the EXIF of the MP4
3) Mark down the time of extracting the JPGs with 1s precision and hand them over to ffmpeg
4) Check the duration from the start frame to the target frame and add this time difference to the original file creation time from EXIF
5) Grab coordinates from GPX
6) Apply geotag with exiftool.
(Even semi-)Automating this will be a real pain in the ass IMHO. I started by simply comparing a movie EXIF file creation timestamp and GPX exported from here:
There is a big discrepancy in timing, about 10 minutes (and couple of hours but let's say this is due to the timezone). I guess this telemetry extractor is buggy.
Btw snapshotting from VLC player will give you at max your monitor resolution and video stream will be almost always certainly higher so not sure it's a good idea.
Just saw this other topic:
Advertisement video claims to be able to do what I need but on MacOS only:
I got Windows 7 and 10 but software is buggy as hell and can't load a single video with it, let alone export a JPG. Anyone caring to try?
on 04-04-2019 10:16 PM
I can only hope this is valid for the Windows version nowadays as well. Running another VM with MacOS just because of this software makes me wanna shoot myself in the foot :)