News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Extracting GPS Information from .MP4?

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

Previous topic - Next topic

Genesis

Gday,

I am new to the forum and am trying to extract the GPS track information from a captured .MP4 file.
Has anyone done this before? if so how?

Thank you in advance (Even if there is no solution  :P)

Murray

Phil Harvey

Hi Murray,

ExifTool will extract this information if it is stored as metadata in the MP4 container:

exiftool -location:all some_file.mp4

However, ExifTool will not yet extract this information if it is embedded in the video stream.  I have this on my list of things to do.  If you would like to have this ability, it would help if you could send me a sample (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 ($).

Genesis

Phil,

Firstly thank you, I tried the command line it seemed to process the file fine but I cannot seem to get this to pipe into a file for viewing?.

I tried -w filenamt.txt also the > filename.txt etc with no luck, any ideas ?

Murray

Phil Harvey

Hi Murray,

If you use this command:

exiftool -w txt -g2 some_file.mp4

A ".txt" file will be created in the same directory and with the same name as your .mp4 file.

Here I changed "-location:all" to "-g2" so you will get all of the information, grouped by type.  You are looking for the "Location" group.

- 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 ($).

Genesis

Phil,

That worked, I managed to generate an output with that string but alas no "--- Location ---" group in sight, the Geocoding must be embedded in the video stream.
I have attached the file for you. I will keep a keen eye on your new versions for this functionality.

Thanks again

Murray

Phil Harvey

Hi Murray,

Sorry, I meant that it would be useful if you could email me an MP4.  The output .txt doesn't help me in decoding the GPS from the video stream.

- 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 ($).

Genesis

Phil,

Yeah... Sorry about that. I will send you one first thing Monday. I might have to drop box it to you as the file size might make an email impossible.
I will see how I go.

Murray

Phil Harvey

Hi Murray,

I got the file, thanks, and I've taken a quick look to see what is involved.  This will be a bit of work since it requires that I write my own codec to parse the video stream, but I'll see what I can do.

- 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 ($).

Genesis

Phil,

Thank you for even taking a look, if do end up building a parser then hats off to you my friend. I would be grateful!

Murray

sergey_ardrone

Hi everybody

I'm having the same issue as Genesis. I would like to extract the position metadata (GPS and Inertial Measurement Unit data) from a mp4 video. However, it does not seem to be stored in the header file.

The attached video was recorded with an AR. Drone together with a GPS receiver. My goal is it to get the position metadata for every frame of the video.

Can anybody point me out how to do that? I know that this metadata must be stored in the video file.

The video can be found here:

https://www.dropbox.com/s/tx39axrjgxvs9ml/video_20130717_145730.mp4

and here the header info:

exiftool video_drone.mp4
ExifTool Version Number         : 9.33
File Name                       : video_drone.mp4
Directory                       : .
File Size                       : 6.7 MB
File Modification Date/Time     : 2013:07:17 14:57:48+02:00
File Access Date/Time           : 2013:07:17 15:21:19+02:00
File Inode Change Date/Time     : 2013:07:17 15:21:08+02:00
File Permissions                : rwxrwxrwx
File Type                       : MP4
MIME Type                       : video/mp4
Major Brand                     : MP4  Base Media v1 [IS0 14496-12:2003]
Minor Version                   : 0.2.0
Compatible Brands               : isom, iso2, avc1, mp41
Movie Data Size                 : 6978856
Movie Header Version            : 0
Modify Date                     : 2013:07:17 14:57:31
Time Scale                      : 1000
Duration                        : 17.00 s
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 2
Track Header Version            : 0
Track Create Date               : 2013:07:17 14:57:31
Track Modify Date               : 2013:07:17 14:57:31
Track ID                        : 1
Track Duration                  : 17.00 s
Track Layer                     : 0
Track Volume                    : 0.00%
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Image Width                     : 1280
Image Height                    : 720
Media Header Version            : 0
Media Create Date               : 2013:07:17 14:57:31
Media Modify Date               : 2013:07:17 14:57:31
Media Time Scale                : 30
Media Duration                  : 17.00 s
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Handler Class                   : Data Handler
Handler Type                    : URL
Handler Description             : DataHandler
Other Format                    : avc1
Software Version                : AR.Drone 2.0
Create Date                     : 2013:07:17 14:57:31+00:00
Avg Bitrate                     : 3.28 Mbps
Image Size                      : 1280x720
Rotation                        : 0

Cheers

Sergey

Phil Harvey

Hi Sergey,

I agree.  The GPS is stored in the video stream.  I haven't found enough time yet to extract this with ExifTool, but it is on my list of things to do.  ExifTool currently extracts GPS from M2TS videos, which use the H.264 codec, same as your MP4, so I'm thinking that I've probably already done most of the hard work.

- 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 ($).

sergey_ardrone

Hi Phil

Thanks for the fast reply. Would be great to have this feature in ExifTool! 

Can you in the meanwhile give me some hint if there is an other way to get the stored metadata? I'm totally new to codecs/video parsing and I need the data for a research project. I have some programming experience so if you can point out some APIs I can try to get it running by myself.

Cheers

Sergey   

Phil Harvey

Hi Sergey,

Sorry, I don't know of any other utilities or API's that have this functionality.

- 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 ($).

sergey_ardrone

Hi Phil

Ok thanks for your interest. I'll keep an eye on updates for ExifTool.

Cheers

Sergey

amal

Hi everybody,

I'm new in media, and exiftool, and i need the same things 'extract GPS data from video (.MP4, .TS)'.
i wonder if the new version is not ready yet  :).

Amal.