GPS-info in .MP4 and .JPG-files

Advanced Renamer forum
#1 : 15/08-18 16:20
Guy
Guy
Posts: 7
Hello Kim (and many others)

I use Advanced Renamer because it is the best program to include the gps-coordinates in the filename.

For pictures, there is no problem and I can use <GPS Lat> and <GPS Lng>. These return the GPS-coordinates in decimal format, which I like.

For movies, the only thing I can imagine is to use <ExifTool:GPSLatitude> and <ExifTool:GPSLongitude> (or <ExifTool:GPSPosition>), but this gives non-decimal output (with text).

@Kim: Is there a possibility to include a function that can do this automatically, because I'm not able to program this in JavaScript?

Thanks and greetings from Belgium

Guy, Belgium


15/08-18 16:20 - edited 15/08-18 17:51
#2 : 16/08-18 09:26
Kim Jensen
Kim Jensen
Administrator
Posts: 883
Reply to #1:
I think the format of the ouput of these fields from vidoes differ from camera to camera. Can you give me an example of the output you get?


16/08-18 09:26
#3 : 16/08-18 12:37
Guy
Guy
Posts: 7
Reply to #2:

Hello Kim, thanks for your reply.

Here you can find a picture and a movie, made with my mobile phone. The movie has only 3 GPS properties (as seen in ExifTools; see file "ExifTools properties"), whereas the picture has a little bit more. But neither of them (as far as I can see) has the GPS-coordinates in decimal output, so I think it is Advanced Renamer that produces them.

https://drive.google.com/drive/folders/1nwDfzfvU oO-gdDcme9UucjLM7rmiacCN?usp=sharing

Thanks and greetings, Guy


16/08-18 12:37
#4 : 23/08-18 08:08
Guy
Guy
Posts: 7
Reply to #3:

Hi Kim

By any chance, were you able to find some solution for my question (see previous posts)?

Thanks and greetings, Guy


23/08-18 08:08
#5 : 23/08-18 15:24
Kim Jensen
Kim Jensen
Administrator
Posts: 883
Reply to #4:
No, sorry, not yet. But I haven't given up.


23/08-18 15:24
#6 : 29/08-18 18:19
Guy
Guy
Posts: 7
Reply to #5:

Hello Kim

Please could you let me know: is it more a problem of knowledge or is it more a problem of lack of time? Do you think a solution could be found in the near-by or in the far-away future?

I'm asking this with all respect to your efforts; it's just to be able to make some sort of planning for myself.

Thanks and greetings, Guy


29/08-18 18:19
#7 : 24/09-18 21:04
Guy
Guy
Posts: 7
Reply to #6:

Hello Kim

Any progress in this matter please?

Thanks and greetings, Guy


24/09-18 21:04
#9 : 26/09-18 12:38
David Lee
David Lee
Posts: 1125
Reply to #1:

EDIT: A better solution, using Advanced Renamer, is the script in the following reply.

Hi Guy

Exiftool outputs coordinates in DMS format by default. To obtain co-ordinates in decimal degrees would require ARen to run the exiftool with the "-n" flag, which probably will require Kim to modify the program.

However you can use exiftool itself to rename your files. Documentation is a bit obscure but I have never looked at exiftool before and it didn't take me very long to sort it out.

As a quick and dirty test I copied exiftool.exe to the same folder as your video file and ran exiftool from a command prompt opened in the same folder.

To replace the filename with the gps tag, run:

exiftool "-filename<$gpsposition.%e" -n VID_20180816_120625.mp4

this will rename VID_20180816_120625.mp4 to 50.9561 5.1733.mp4


If you want to add the GPS tag to the end of the existing filename then use:

exiftool "-filename<%f_$gpsposition.%e" -n VID_20180816_120625.mp4

to return: VID_20180816_120625_50.9561 5.1733.mp4


Finally - to rename all .mp4 files in a directory named "dir":

exiftool "-filename<%f_$gpsposition.%e" -n dir

Hope this helps you to get started.




26/09-18 12:38 - edited 26/09-18 18:49
#10 : 26/09-18 16:11
David Lee
David Lee
Posts: 1125
Reply to #9:

Guy

Here is a script that will parse ExifTool Lat & Lon values to decimal degrees in Advanced Renamer, using the Script method.

Just copy all the code below the line into a Script Window.

As-is it will return decimal degrees in the format N50.9561 E5.1733.

If you would prefer signed decimal degrees (ie negative values for S and W coordinates) then un-comment the two "if" statements and use the alternative return statement.

Coordinates are returned to 4 decimal places - you can change this by editing the values in the two ".toFixed(4)" methods

___________________________________________________________
// ExifTool GPSLat/Lon to Decimal Degrees

Lat = item.exifToolValue('GPSLatitude');
Lon = item.exifToolValue('GPSLongitude');

LatD = parseInt(Lat);
LatM = parseInt(Lat.slice(Lat.indexOf("deg")+3));
LatS = parseFloat(Lat.slice(Lat.indexOf("'")+1));
LatH = Lat.slice(-1)
LatDD = (LatD+LatM/60.0+LatS/3600.0).toFixed(4);
// if (LatH == "S") LatDD = -1.0 * LatDD;

LonD = parseInt(Lon);
LonM = parseInt(Lon.slice(Lon.indexOf("deg")+3));
LonS = parseFloat(Lon.slice(Lon.indexOf("'")+1));
LonH = Lon.slice(-1)
LonDD = (LonD+LonM/60.0+LonS/3600.0).toFixed(4);
// if (LonH == 'W') LonDD = -1.0 * LonDD;

return LatH + LatDD.toString() + " " + LonH + LonDD.toString();
//return LatDD.toString() + " " + LonDD.toString();


26/09-18 16:11 - edited 26/09-18 18:38