Author Topic: Extracting GPS Information from .MP4?  (Read 33562 times)

Genesis

  • Newbie
  • *
  • Posts: 8
Extracting GPS Information from .MP4?
« on: June 13, 2013, 03:10:39 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14405
    • ExifTool Home Page
Re: Extracting GPS Information from .MP4?
« Reply #1 on: June 13, 2013, 07:17:45 AM »
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 (phil at owl.phy.queensu.ca).

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

Genesis

  • Newbie
  • *
  • Posts: 8
Re: Extracting GPS Information from .MP4?
« Reply #2 on: June 13, 2013, 07:16:21 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14405
    • ExifTool Home Page
Re: Extracting GPS Information from .MP4?
« Reply #3 on: June 13, 2013, 07:46:12 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Genesis

  • Newbie
  • *
  • Posts: 8
Re: Extracting GPS Information from .MP4?
« Reply #4 on: June 13, 2013, 08:54:33 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14405
    • ExifTool Home Page
Re: Extracting GPS Information from .MP4?
« Reply #5 on: June 14, 2013, 07:31:07 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Genesis

  • Newbie
  • *
  • Posts: 8
Re: Extracting GPS Information from .MP4?
« Reply #6 on: June 15, 2013, 07:38:11 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14405
    • ExifTool Home Page
Re: Extracting GPS Information from .MP4?
« Reply #7 on: June 17, 2013, 08:04:03 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Genesis

  • Newbie
  • *
  • Posts: 8
Re: Extracting GPS Information from .MP4?
« Reply #8 on: June 18, 2013, 04:19:31 AM »
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

  • Newbie
  • *
  • Posts: 3
Re: Extracting GPS Information from .MP4?
« Reply #9 on: July 17, 2013, 09:29:39 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14405
    • ExifTool Home Page
Re: Extracting GPS Information from .MP4?
« Reply #10 on: July 17, 2013, 09:48:22 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

sergey_ardrone

  • Newbie
  • *
  • Posts: 3
Re: Extracting GPS Information from .MP4?
« Reply #11 on: July 17, 2013, 10:33:26 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14405
    • ExifTool Home Page
Re: Extracting GPS Information from .MP4?
« Reply #12 on: July 17, 2013, 10:49:53 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

sergey_ardrone

  • Newbie
  • *
  • Posts: 3
Re: Extracting GPS Information from .MP4?
« Reply #13 on: July 18, 2013, 03:50:29 AM »
Hi Phil

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

Cheers

Sergey

amal

  • Newbie
  • *
  • Posts: 2
Re: Extracting GPS Information from .MP4?
« Reply #14 on: November 21, 2013, 05:48:38 AM »
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.