m2ts files GPSAltitudeRef

Started by RailFoto, November 10, 2020, 11:28:29 AM

Previous topic - Next topic

RailFoto

Hello,

first of all thank you for this great tool.

Tinkering with the Python code for a project to manipulate the GPSdata in m2ts-files I found a weird behavior with reference to GPSAltitude and GPSAltitudeRef:

I apply ExifTool version 12.09.

mts-file with tag 0xb9 (-GPSAltitudeRef) and value (next byte after the tag) 0x01 (->below sea level)
command:
exiftool -GPSAltitude -GPSAltitudeRef "testnewGPS.MTS"
returns
GPS Altitude Ref                : Below Sea Level

Same file with value 0x00 (above sea level)
returns:
GPS Altitude                    : 437 m Above Sea Level
GPS Altitude Ref                : Above Sea Level


Exiftool seems to fail in case of m2ts with altitudes below sea level.

Please have a look of it.

Best regards, Bernd
Say what you think - but think firstly!

Phil Harvey

Hi Bernd?

Are you saying that ExifTool doesn't report the GPSAltitude value if GPSAltitudeRef is "Below sea level"?

Could you provide a sample?

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

RailFoto

Hi Phil,

yes, I'm saying this. The samples I attached are cutted from a video with a bigger size but it works with exiftool. The GPS position in the files does not match the altitude set in the files!

The only difference in the files is the first byte after the tag 0xb9. In testbelow = 0x01 and in testabove = 0x00.

Best regards, Bernd
Say what you think - but think firstly!

Phil Harvey

The MDPM is not formatted properly in testbelow.MTS

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

RailFoto

Sorry, please find attached the changed testbelow.MTS

By the way - I tested exiftool with a *.jpg image and tried to set altitude below sea level and it failed also.

Bernd
Say what you think - but think firstly!

Phil Harvey

Same problem.  This isn't an ExifTool problem, and I don't have time to debug problems in other applications.

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

StarGeek

Quote from: RailFoto on November 11, 2020, 11:04:30 AM
By the way - I tested exiftool with a *.jpg image and tried to set altitude below sea level and it failed also.

I can't comment on the MTS file, but setting an altitude below sea level works find on a jpg here
C:\>exiftool -P -overwrite_original -GPSAltitude=-50 -GPSAltitudeRef=-50 y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -GPSAltitude* y:\!temp\Test4.jpg
---- GPS ----
GPSAltitudeRef                  : Below Sea Level
GPSAltitude                     : 50 m
---- Composite ----
GPSAltitude                     : 50 m Below Sea Level
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

RailFoto

Phil, thanks for the answer but I'm not convinced. I will solve the problem otherwise.

StarGeek,
thank you for the sample. It works as long as the value in GPSAltitude meets the type intu8.
But the docu https://exiftool.org/TagNames/GPS.html says

GPSAltitudeRef    int8u   0 = Above Sea Level
                                           1 = Below Sea Level
and the a additional comment: ExifTool will also accept number when writing this tag, with negative numbers indicating below sea leve


But all cases I tried failed with GPSAltitudeRef = 1.
Setting GPSAltitude = -1 solves the problem always. The GPSAltitude type is rational64u - that means in my understanding it's positive and so only the GPSAltitudeRef indicates the see level. If you set in your sample

exiftool -P -overwrite_original -GPSAltitude=50 -GPSAltitudeRef=-1 y:\!temp\Test4.jpg

it should work.

Bernd
Say what you think - but think firstly!

Phil Harvey

Hi Bernd,

See FAQ 6 and the GPS Tags documentation for writing GPSAltitudeRef.

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

RailFoto

Hi Phil,
FAQ 6 did it. For the images it's solved for me.
Thank you, Bernd
Say what you think - but think firstly!

RailFoto

Hi Phil,

in the meantime I tried to find the reason why exiftool did not detect the GPSAltitudeRef in my m2ts dummy video. Because of the lack of m2ts video taken in a region below sea level I have set the byte I assume it's the right one.

I own to Sony cameras and both write with an active GPS in the GPSAltitudeRef for positions above sea level

B9 00 00 03 00 00 (in hex format)

That means there are 5 bytes following the tag. The Github repo of your exiftool contents a Perl script H264.pm. I'm not familiar with Perl but my interpretation of the code according to 0xb9 is you try to ask the 4. byte (one based counting) for GPSAltitudeRef. If I set this byte to 0x01 in my dummy video the exiftool says "below sea level".

But I interprete all the documents, I did read again and again, say the first byte after 0xb9 is the right one to detect GPSAltitudeRef. Why I think so?

Both the GPSLatitudeRef and the GPSLongitudeRef set the first byte to identify the reference. One byte definitely describe the value in the mentioned refs. In Patent US  8,466,985 (Jun 18, 2013) the Fig. 18B says GPS ALTITUDE REF has a length of 1 BIT (seems to be byte?). If this is true then it should be the first byte that has the information. Furthermore the *.cpi- files in the AVCHD - BDMV - CLIPINF directory written by the camera have GPS refs also and they use only one byte for them.

I would appreciate if you could check this.

Thanks, Bernd
Say what you think - but think firstly!

Phil Harvey

Hi Bernd,

The entries in the MDPM record must be 5 bytes long.

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