Extracting GPS Information from .MP4?

Started by Genesis, June 13, 2013, 03:10:39 AM

Previous topic - Next topic

Phil Harvey

I did spend some time working on this, but it was more work than I had hoped.  Maybe this would be a good project for me over the Christmas holiday.  I'll move it back up to the top of my to-do list.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).


dvazquez

Hi guys,

I'm trying to extract the GPS information from a .mov file but I'm not able. Maybe it is something similar to your problem with .mp4? I could send you some videos if needed.

There are some applications that can read the GPS information from my videos but I would have to extrac the info video by video and I would like to use exiftool api to extract the info by myself ino my application.

Thanks in advance

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

DJPhrost

Any progress on this yet?
I'm desperately needing GPS location pulled from an MP4 recorded on a smart phone, not sure if Android or iPhone, in the mp4 format.

Thank you,

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

DJPhrost

Curiously then, is there a specific reason?
I see this has been requested for many years now and seems to be very difficult to do, surely MP4s have geotags as well, or am I wrong?

What makes it so difficult to extract?

Just for personal edification.

I found a video of my now ex-fiance and another gentleman and was hoping the issue had been resolved so as to figure out whom it may have been. Oh well!

Phil Harvey

Maybe ExifTool already does what you want.  ExifTool extracts all metadata from MP4 videos, included the GPS position if written to the metadata.

The initial post is requesting extraction of the full GPS track, which is embedded in the video stream.  Extracting anything from the video stream is difficult.  I have done this H264 stream in a M2TS container, and it was a real pain (lack of documentation, complex format, etc).  Naively I would have thought that this would be easy to apply to the H264 stream in MP4 videos, but sadly this was not the case.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

DJPhrost

Oh.. I guess I misread the initial post.. Sorry!
I've not slept one wink since the 28th of last month, when I found out about this, more or less. Heh.

Let me post my own thread as to not hijack this one, sorry!

jmurch

#24
Hi Phil,

I've been following this thread because this is pretty much the same thing I need to do re: extract the ongoing gps info from the mp4 stream.  I did go what I think is the obvious easy route that being use ffmeg to convert the mp4 to m2ts and then try to extract the gps info from the mt2s stream. So.... how do I use xiftool to do that?

Thanks, Jeff


OK RTFM.... found it I think but I get the following message:

exiftool -ee -p '$gpslatitude, $gpslongitude, $gpstimestamp' apgar.m2ts

Warning: [Minor] Tag 'gpslatitude' not defined - apgar.m2ts


#3:   I guess the tags are contingent on what they are named in the stream?  Is there anything I can use for a wildcard?   Here is the gpx that was extracetd by virb:

<trk>
    <name>apgar area</name>
    <extensions>
      <gpxx:TrackExtension>
        <gpxx:DisplayColor>DarkGray</gpxx:DisplayColor>
      </gpxx:TrackExtension>
    </extensions>
    <trkseg>
      <trkpt lat="48.521992899477482" lon="-113.98851854726672">
        <ele>989.4000244140625</ele>
        <time>2015-09-22T22:34:34Z</time>
      </trkpt>

#4 When this does work it just appears to be that same info from the metadata not the stream.

StarGeek

Quote from: jmurch on August 25, 2016, 04:05:44 PMIs there anything I can use for a wildcard?

Try
exiftool -gps* File

The tags may not be named gpslatitude, gpslongitude, etc.  Some video files have a single tag with all the info. 
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Victor

I faced a similar requirement and have opted for a rather brute force solution.  Instead of reverse engineering the video stream I have extracted the GPS information from the video overlay (of course this assumes that the GPS information is being shown overlayed on the video frame itself).  The extracted data is saved to a GPX file.  The advantage of this method is that it can easily be customised to any video file, the disadvantage is that it is slower to extract the data.  If you are interested, you can download the software from here http://bigbugisoftware.jigsy.com/gpx-extractor.

Phil Harvey

ExifTool 10.72 (just released) has the ability to extract GPS from MOV/MP4 videos using the -ee option.  Please send me a sample if it doesn't extract it for your camera (philharvey66 at gmail.com).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Insta

Quote from: Phil Harvey on January 04, 2018, 04:44:02 PM
ExifTool 10.72 (just released) has the ability to extract GPS from MOV/MP4 videos using the -ee option.  Please send me a sample if it doesn't extract it for your camera (philharvey66 at gmail.com).

- Phil

Hello! Can you help me to extract GPS data drom mp4 video using -ee processing feature? what should i insert? exiftool -ee 1.mp4?

Phil Harvey

Yes.  If that doesn't work, send me a sample video and I'll see what I can do to extract the GPS.  (my email is philharvey66 at gmail.com)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).