exiftool_vendored 11.96.0 → 12.08.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of exiftool_vendored might be problematic. Click here for more details.

Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/bin/Changes +172 -2
  3. data/bin/MANIFEST +8 -0
  4. data/bin/META.json +1 -1
  5. data/bin/META.yml +1 -1
  6. data/bin/README +43 -42
  7. data/bin/exiftool +148 -69
  8. data/bin/lib/Image/ExifTool.pm +159 -110
  9. data/bin/lib/Image/ExifTool.pod +114 -87
  10. data/bin/lib/Image/ExifTool/AIFF.pm +2 -2
  11. data/bin/lib/Image/ExifTool/APE.pm +2 -2
  12. data/bin/lib/Image/ExifTool/BuildTagLookup.pm +13 -7
  13. data/bin/lib/Image/ExifTool/Canon.pm +37 -11
  14. data/bin/lib/Image/ExifTool/CanonCustom.pm +82 -16
  15. data/bin/lib/Image/ExifTool/DPX.pm +56 -2
  16. data/bin/lib/Image/ExifTool/DarwinCore.pm +20 -3
  17. data/bin/lib/Image/ExifTool/EXE.pm +8 -5
  18. data/bin/lib/Image/ExifTool/Exif.pm +15 -6
  19. data/bin/lib/Image/ExifTool/Font.pm +9 -2
  20. data/bin/lib/Image/ExifTool/GIF.pm +5 -0
  21. data/bin/lib/Image/ExifTool/GeoTiff.pm +2 -0
  22. data/bin/lib/Image/ExifTool/Geotag.pm +2 -2
  23. data/bin/lib/Image/ExifTool/GoPro.pm +56 -22
  24. data/bin/lib/Image/ExifTool/H264.pm +1 -1
  25. data/bin/lib/Image/ExifTool/HtmlDump.pm +2 -2
  26. data/bin/lib/Image/ExifTool/ID3.pm +91 -12
  27. data/bin/lib/Image/ExifTool/IPTC.pm +1 -0
  28. data/bin/lib/Image/ExifTool/Lang/de.pm +3 -1
  29. data/bin/lib/Image/ExifTool/Lang/es.pm +1 -1
  30. data/bin/lib/Image/ExifTool/M2TS.pm +44 -24
  31. data/bin/lib/Image/ExifTool/MacOS.pm +152 -38
  32. data/bin/lib/Image/ExifTool/Minolta.pm +6 -2
  33. data/bin/lib/Image/ExifTool/MinoltaRaw.pm +11 -10
  34. data/bin/lib/Image/ExifTool/Nikon.pm +162 -18
  35. data/bin/lib/Image/ExifTool/Olympus.pm +39 -17
  36. data/bin/lib/Image/ExifTool/PNG.pm +14 -3
  37. data/bin/lib/Image/ExifTool/PPM.pm +5 -5
  38. data/bin/lib/Image/ExifTool/Panasonic.pm +148 -14
  39. data/bin/lib/Image/ExifTool/PanasonicRaw.pm +33 -0
  40. data/bin/lib/Image/ExifTool/Parrot.pm +2 -1
  41. data/bin/lib/Image/ExifTool/Pentax.pm +3 -1
  42. data/bin/lib/Image/ExifTool/Photoshop.pm +2 -1
  43. data/bin/lib/Image/ExifTool/QuickTime.pm +269 -29
  44. data/bin/lib/Image/ExifTool/QuickTimeStream.pl +463 -75
  45. data/bin/lib/Image/ExifTool/README +21 -20
  46. data/bin/lib/Image/ExifTool/RIFF.pm +15 -3
  47. data/bin/lib/Image/ExifTool/RSRC.pm +17 -11
  48. data/bin/lib/Image/ExifTool/RTF.pm +12 -7
  49. data/bin/lib/Image/ExifTool/Ricoh.pm +19 -1
  50. data/bin/lib/Image/ExifTool/Shift.pl +1 -0
  51. data/bin/lib/Image/ExifTool/SigmaRaw.pm +40 -33
  52. data/bin/lib/Image/ExifTool/Sony.pm +425 -34
  53. data/bin/lib/Image/ExifTool/TagLookup.pm +1961 -1874
  54. data/bin/lib/Image/ExifTool/TagNames.pod +394 -86
  55. data/bin/lib/Image/ExifTool/Validate.pm +4 -4
  56. data/bin/lib/Image/ExifTool/WriteExif.pl +3 -2
  57. data/bin/lib/Image/ExifTool/WriteQuickTime.pl +23 -15
  58. data/bin/lib/Image/ExifTool/Writer.pl +44 -21
  59. data/bin/lib/Image/ExifTool/XMP.pm +42 -5
  60. data/bin/lib/Image/ExifTool/XMPStruct.pl +3 -1
  61. data/bin/lib/Image/ExifTool/ZISRAW.pm +123 -0
  62. data/bin/perl-Image-ExifTool.spec +42 -41
  63. data/lib/exiftool_vendored/version.rb +1 -1
  64. metadata +8 -7
@@ -10,6 +10,7 @@
10
10
  # 3) https://forum.flitsservice.nl/dashcam-info/dod-ls460w-gps-data-uit-mov-bestand-lezen-t87926.html
11
11
  # 4) https://developers.google.com/streetview/publish/camm-spec
12
12
  # 5) https://sergei.nz/extracting-gps-data-from-viofo-a119-and-other-novatek-powered-cameras/
13
+ # 6) Thomas Allen https://github.com/exiftool/exiftool/pull/62
13
14
  #------------------------------------------------------------------------------
14
15
  package Image::ExifTool::QuickTime;
15
16
 
@@ -19,9 +20,11 @@ use Image::ExifTool qw(:DataAccess :Utils);
19
20
  use Image::ExifTool::QuickTime;
20
21
 
21
22
  sub Process_tx3g($$$);
23
+ sub Process_marl($$$);
22
24
  sub Process_mebx($$$);
23
25
  sub ProcessFreeGPS($$$);
24
26
  sub ProcessFreeGPS2($$$);
27
+ sub Process360Fly($$$);
25
28
 
26
29
  # QuickTime data types that have ExifTool equivalents
27
30
  # (ref https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW35)
@@ -70,12 +73,14 @@ my %processByMetaFormat = (
70
73
  meta => 1, # ('CTMD' in CR3 images, 'priv' unknown in DJI video)
71
74
  data => 1, # ('RVMI')
72
75
  sbtl => 1, # (subtitle; 'tx3g' in Yuneec drone videos)
76
+ ctbx => 1, # ('marl' in GM videos)
73
77
  );
74
78
 
75
79
  # data lengths for each INSV record type
76
80
  my %insvDataLen = (
77
81
  0x300 => 56, # accelerometer
78
- 0x400 => 16, # unknown
82
+ 0x400 => 16, # exposure (ref 6)
83
+ 0x600 => 8, # timestamps (ref 6)
79
84
  0x700 => 53, # GPS
80
85
  );
81
86
 
@@ -91,7 +96,7 @@ my %insvLimit = (
91
96
  NOTES => q{
92
97
  Timed metadata extracted from QuickTime media data and some AVI videos when
93
98
  the ExtractEmbedded option is used. Although most of these tags are
94
- combined into the single table below, ExifTool currently reads 37 different
99
+ combined into the single table below, ExifTool currently reads 46 different
95
100
  formats of timed GPS metadata from video files.
96
101
  },
97
102
  VARS => { NO_ID => 1 },
@@ -118,6 +123,7 @@ my %insvLimit = (
118
123
  ExposureCompensation => { PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)', Groups => { 2 => 'Camera' } },
119
124
  ISO => { Groups => { 2 => 'Camera' } },
120
125
  CameraDateTime=>{ PrintConv => '$self->ConvertDateTime($val)', Groups => { 2 => 'Time' } },
126
+ VideoTimeStamp => { Groups => { 2 => 'Video' } },
121
127
  Accelerometer=> { Notes => '3-axis acceleration in units of g' },
122
128
  AccelerometerData => { },
123
129
  AngularVelocity => { },
@@ -173,6 +179,10 @@ my %insvLimit = (
173
179
  Name => 'rtmd',
174
180
  SubDirectory => { TagTable => 'Image::ExifTool::Sony::rtmd' },
175
181
  },
182
+ marl => {
183
+ Name => 'marl',
184
+ SubDirectory => { TagTable => 'Image::ExifTool::QuickTime::marl' },
185
+ },
176
186
  CTMD => { # (Canon Timed MetaData)
177
187
  Name => 'CTMD',
178
188
  SubDirectory => { TagTable => 'Image::ExifTool::Canon::CTMD' },
@@ -548,6 +558,137 @@ my %insvLimit = (
548
558
  },
549
559
  );
550
560
 
561
+ %Image::ExifTool::QuickTime::Tags360Fly = (
562
+ PROCESS_PROC => \&Process360Fly,
563
+ NOTES => 'Timed metadata found in MP4 videos from the 360Fly.',
564
+ 1 => {
565
+ Name => 'Accel360Fly',
566
+ SubDirectory => { TagTable => 'Image::ExifTool::QuickTime::Accel360Fly' },
567
+ },
568
+ 2 => {
569
+ Name => 'Gyro360Fly',
570
+ SubDirectory => { TagTable => 'Image::ExifTool::QuickTime::Gyro360Fly' },
571
+ },
572
+ 3 => {
573
+ Name => 'Mag360Fly',
574
+ SubDirectory => { TagTable => 'Image::ExifTool::QuickTime::Mag360Fly' },
575
+ },
576
+ 5 => {
577
+ Name => 'GPS360Fly',
578
+ SubDirectory => { TagTable => 'Image::ExifTool::QuickTime::GPS360Fly' },
579
+ },
580
+ 6 => {
581
+ Name => 'Rot360Fly',
582
+ SubDirectory => { TagTable => 'Image::ExifTool::QuickTime::Rot360Fly' },
583
+ },
584
+ 250 => {
585
+ Name => 'Fusion360Fly',
586
+ SubDirectory => { TagTable => 'Image::ExifTool::QuickTime::Fusion360Fly' },
587
+ },
588
+ );
589
+
590
+ %Image::ExifTool::QuickTime::Accel360Fly = (
591
+ PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
592
+ GROUPS => { 2 => 'Location' },
593
+ 1 => { Name => 'AccelMode', Unknown => 1 }, # (always 2 in my sample)
594
+ 2 => {
595
+ Name => 'SampleTime',
596
+ Groups => { 2 => 'Video' },
597
+ Format => 'int64u',
598
+ ValueConv => '$val / 1e6',
599
+ PrintConv => 'ConvertDuration($val)',
600
+ },
601
+ 10 => { Name => 'AccelYPR', Format => 'float[3]' },
602
+ );
603
+
604
+ %Image::ExifTool::QuickTime::Gyro360Fly = (
605
+ PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
606
+ GROUPS => { 2 => 'Location' },
607
+ 1 => { Name => 'GyroMode', Unknown => 1 }, # (always 1 in my sample)
608
+ 2 => {
609
+ Name => 'SampleTime',
610
+ Groups => { 2 => 'Video' },
611
+ Format => 'int64u',
612
+ ValueConv => '$val / 1e6',
613
+ PrintConv => 'ConvertDuration($val)',
614
+ },
615
+ 10 => { Name => 'GyroYPR', Format => 'float[3]' },
616
+ );
617
+
618
+ %Image::ExifTool::QuickTime::Mag360Fly = (
619
+ PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
620
+ GROUPS => { 2 => 'Location' },
621
+ 1 => { Name => 'MagMode', Unknown => 1 }, # (always 1 in my sample)
622
+ 2 => {
623
+ Name => 'SampleTime',
624
+ Groups => { 2 => 'Video' },
625
+ Format => 'int64u',
626
+ ValueConv => '$val / 1e6',
627
+ PrintConv => 'ConvertDuration($val)',
628
+ },
629
+ 10 => { Name => 'MagnetometerXYZ', Format => 'float[3]' },
630
+ );
631
+
632
+ %Image::ExifTool::QuickTime::GPS360Fly = (
633
+ PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
634
+ GROUPS => { 2 => 'Location' },
635
+ 1 => { Name => 'GPSMode', Unknown => 1 }, # (always 16 in my sample)
636
+ 2 => {
637
+ Name => 'SampleTime',
638
+ Groups => { 2 => 'Video' },
639
+ Format => 'int64u',
640
+ ValueConv => '$val / 1e6',
641
+ PrintConv => 'ConvertDuration($val)',
642
+ },
643
+ 10 => { Name => 'GPSLatitude', Format => 'float', PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "N")' },
644
+ 14 => { Name => 'GPSLongitude', Format => 'float', PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")' },
645
+ 18 => { Name => 'GPSAltitude', Format => 'float', PrintConv => '"$val m"' }, # (questionable accuracy)
646
+ 22 => {
647
+ Name => 'GPSSpeed',
648
+ Notes => 'converted to km/hr',
649
+ Format => 'int16u',
650
+ ValueConv => '$val * 0.036',
651
+ PrintConv => 'sprintf("%.1f",$val)',
652
+ },
653
+ 24 => { Name => 'GPSTrack', Format => 'int16u', ValueConv => '$val / 100' },
654
+ 26 => { Name => 'Acceleration', Format => 'int16u', ValueConv => '$val / 1000' },
655
+ );
656
+
657
+ %Image::ExifTool::QuickTime::Rot360Fly = (
658
+ PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
659
+ GROUPS => { 2 => 'Location' },
660
+ 1 => { Name => 'RotMode', Unknown => 1 }, # (always 1 in my sample)
661
+ 2 => {
662
+ Name => 'SampleTime',
663
+ Groups => { 2 => 'Video' },
664
+ Format => 'int64u',
665
+ ValueConv => '$val / 1e6',
666
+ PrintConv => 'ConvertDuration($val)',
667
+ },
668
+ 10 => { Name => 'RotationXYZ', Format => 'float[3]' },
669
+ );
670
+
671
+ %Image::ExifTool::QuickTime::Fusion360Fly = (
672
+ PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
673
+ GROUPS => { 2 => 'Location' },
674
+ 1 => { Name => 'FusionMode', Unknown => 1 }, # (always 0 in my sample)
675
+ 2 => {
676
+ Name => 'SampleTime',
677
+ Groups => { 2 => 'Video' },
678
+ Format => 'int64u',
679
+ ValueConv => '$val / 1e6',
680
+ PrintConv => 'ConvertDuration($val)',
681
+ },
682
+ 10 => { Name => 'FusionYPR', Format => 'float[3]' },
683
+ );
684
+
685
+ # tags found in 'marl' ctbx timed metadata (ref PH)
686
+ %Image::ExifTool::QuickTime::marl = (
687
+ PROCESS_PROC => \&Process_marl,
688
+ GROUPS => { 2 => 'Other' },
689
+ NOTES => 'Tags extracted from the marl ctbx timed metadata of GM cars.',
690
+ );
691
+
551
692
  #------------------------------------------------------------------------------
552
693
  # Save information from keys in OtherSampleDesc directory for processing timed metadata
553
694
  # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
@@ -648,7 +789,7 @@ sub FoundSomething($$;$$)
648
789
 
649
790
  #------------------------------------------------------------------------------
650
791
  # Approximate GPSDateTime value from sample time and CreateDate
651
- # Inputs: 0) ExifTool ref, 1) tag table ptr, 2) sample time (ms)
792
+ # Inputs: 0) ExifTool ref, 1) tag table ptr, 2) sample time (s)
652
793
  # 3) true if CreateDate is at end of video
653
794
  # Notes: Uses ExifTool CreateDateAtEnd as flag to subtract video duration
654
795
  sub SetGPSDateTime($$$)
@@ -678,48 +819,89 @@ sub SetGPSDateTime($$$)
678
819
  }
679
820
  }
680
821
 
822
+ #------------------------------------------------------------------------------
823
+ # Handle tags that we found in the subtitle 'text'
824
+ # Inputs: 0) ExifTool ref, 1) tag table ref, 2) hash of tag names/values
825
+ sub HandleTextTags($$$)
826
+ {
827
+ my ($et, $tagTbl, $tags) = @_;
828
+ my $tag;
829
+ delete $$tags{done};
830
+ delete $$tags{GPSTimeStamp} if $$tags{GPSDateTime};
831
+ foreach $tag (sort keys %$tags) {
832
+ $et->HandleTag($tagTbl, $tag => $$tags{$tag});
833
+ }
834
+ $$et{UnknownTextCount} = 0;
835
+ undef %$tags; # clear the hash
836
+ }
837
+
681
838
  #------------------------------------------------------------------------------
682
839
  # Process subtitle 'text'
683
- # Inputs: 0) ExifTool ref, 1) tag table ref, 2) data ref, 3) optional sample time
840
+ # Inputs: 0) ExifTool ref, 1) tag table ref, 2) data ref
684
841
  sub Process_text($$$)
685
842
  {
686
843
  my ($et, $tagTbl, $buffPt) = @_;
687
- my ($found, $val, %tags, $tag);
844
+ my %tags;
688
845
 
689
846
  return if $$et{NoMoreTextDecoding};
690
847
 
691
848
  while ($$buffPt =~ /\$(\w+)([^\$]*)/g) {
692
849
  my ($tag, $dat) = ($1, $2);
693
- if ($tag =~ /^[A-Z]{2}RMC$/ and $dat =~ /^,(\d{2})(\d{2})(\d+)(\.\d*)?,A?,(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),(\d*\.?\d*),(\d*\.?\d*),(\d{2})(\d{2})(\d+)/) {
694
- my $year = $15 + ($15 >= 70 ? 1900 : 2000);
695
- my $str = sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d%sZ', $year, $14, $13, $1, $2, $3, $4 || '');
696
- $et->HandleTag($tagTbl, GPSDateTime => $str);
697
- $et->HandleTag($tagTbl, GPSLatitude => (($5 || 0) + $6/60) * ($7 eq 'N' ? 1 : -1));
698
- $et->HandleTag($tagTbl, GPSLongitude => (($8 || 0) + $9/60) * ($10 eq 'E' ? 1 : -1));
850
+ if ($tag =~ /^[A-Z]{2}RMC$/ and $dat =~ /^,(\d{2})(\d{2})(\d+(?:\.\d*)),A?,(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),(\d*\.?\d*),(\d*\.?\d*),(\d{2})(\d{2})(\d+)/) {
851
+ my $time = "$1:$2:$3";
852
+ if ($$et{LastTime}) {
853
+ if ($$et{LastTime} eq $time) {
854
+ $$et{DOC_NUM} = $$et{LastDoc};
855
+ } elsif (%tags) {
856
+ HandleTextTags($et, $tagTbl, \%tags);
857
+ $$et{DOC_NUM} = ++$$et{DOC_COUNT};
858
+ }
859
+ }
860
+ $$et{LastTime} = $time;
861
+ $$et{LastDoc} = $$et{DOC_NUM};
862
+ my $year = $14 + ($14 >= 70 ? 1900 : 2000);
863
+ my $dateTime = sprintf('%.4d:%.2d:%.2d %sZ', $year, $13, $12, $time);
864
+ $tags{GPSDateTime} = $dateTime;
865
+ $tags{GPSLatitude} = (($4 || 0) + $5/60) * ($6 eq 'N' ? 1 : -1);
866
+ $tags{GPSLongitude} = (($7 || 0) + $8/60) * ($9 eq 'E' ? 1 : -1);
867
+ if (length $10) {
868
+ $tags{GPSSpeed} = $10 * $knotsToKph;
869
+ $tags{GPSSpeedRef} = 'K';
870
+ }
699
871
  if (length $11) {
700
- $et->HandleTag($tagTbl, GPSSpeed => $11 * $knotsToKph);
701
- $et->HandleTag($tagTbl, GPSSpeedRef => 'K');
872
+ $tags{GPSTrack} = $11;
873
+ $tags{GPSTrackRef} = 'T';
702
874
  }
703
- if (length $12) {
704
- $et->HandleTag($tagTbl, GPSTrack => $12);
705
- $et->HandleTag($tagTbl, GPSTrackRef => 'T');
875
+ } elsif ($tag =~ /^[A-Z]{2}GGA$/ and $dat =~ /^,(\d{2})(\d{2})(\d+(?:\.\d*)?),(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),[1-6]?,(\d+)?,(\.\d+|\d+\.?\d*)?,(-?\d+\.?\d*)?,M?/s) {
876
+ my $time = "$1:$2:$3";
877
+ if ($$et{LastTime}) {
878
+ if ($$et{LastTime} eq $time) {
879
+ $$et{DOC_NUM} = $$et{LastDoc};
880
+ } elsif (%tags) {
881
+ HandleTextTags($et, $tagTbl, \%tags);
882
+ $$et{DOC_NUM} = ++$$et{DOC_COUNT};
883
+ }
706
884
  }
707
- $found = 1;
885
+ $$et{LastTime} = $time;
886
+ $$et{LastDoc} = $$et{DOC_NUM};
887
+ $tags{GPSTimeStamp} = $time;
888
+ $tags{GPSLatitude} = (($4 || 0) + $5/60) * ($6 eq 'N' ? 1 : -1);
889
+ $tags{GPSLongitude} = (($7 || 0) + $8/60) * ($9 eq 'E' ? 1 : -1);
890
+ $tags{GPSSatellites} = $10 if defined $10;
891
+ $tags{GPSDOP} = $11 if defined $11;
892
+ $tags{GPSAltitude} = $12 if defined $12;
708
893
  } elsif ($tag eq 'BEGINGSENSOR' and $dat =~ /^:([-+]\d+\.\d+):([-+]\d+\.\d+):([-+]\d+\.\d+)/) {
709
- $et->HandleTag($tagTbl, Accelerometer => "$1 $2 $3");
710
- $found = 1;
894
+ $tags{Accelerometer} = "$1 $2 $3";
711
895
  } elsif ($tag eq 'TIME' and $dat =~ /^:(\d+)/) {
712
- $et->HandleTag($tagTbl, TimeCode => $1 / ($$et{MediaTS} || 1));
713
- $found = 1;
896
+ $tags{TimeCode} = $1 / ($$et{MediaTS} || 1);
714
897
  } elsif ($tag eq 'BEGIN') {
715
- $et->HandleTag($tagTbl, Text => $dat) if length $dat;
716
- $found = 1;
898
+ $tags{Text} = $dat if length $dat;
899
+ $tags{done} = 1;
717
900
  } elsif ($tag ne 'END') {
718
- $et->HandleTag($tagTbl, Text => "\$$tag$dat");
719
- $found = 1;
901
+ $tags{Text} = "\$$tag$dat";
720
902
  }
721
903
  }
722
- return if $found;
904
+ %tags and HandleTextTags($et, $tagTbl, \%tags), return;
723
905
 
724
906
  # check for enciphered binary GPS data
725
907
  # BlueSkySea:
@@ -755,7 +937,7 @@ sub Process_text($$$)
755
937
  # 0120: 58 00 58 00 58 00 58 00 00 00 00 00 00 00 00 00 [X.X.X.X.........]
756
938
  # 0130: 00 00 00 00 00 00 00 [.......]
757
939
  if ($$buffPt =~ /^\0\0(..\xaa\xaa|\xf2\xe1\xf0\xee)/s and length $$buffPt >= 282) {
758
- $val = pack('C*', map { $_ ^ 0xaa } unpack('C*', substr($$buffPt, 8, 14)));
940
+ my $val = pack('C*', map { $_ ^ 0xaa } unpack('C*', substr($$buffPt, 8, 14)));
759
941
  if ($val =~ /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/) {
760
942
  $tags{GPSDateTime} = "$1:$2:$3 $4:$5:$6";
761
943
  $val = pack('C*', map { $_ ^ 0xaa } unpack('C*', substr($$buffPt, 38, 9)));
@@ -792,12 +974,13 @@ sub Process_text($$$)
792
974
  $tags{Accelerometer} = "@acc" if @acc;
793
975
  }
794
976
  }
977
+ %tags and HandleTextTags($et, $tagTbl, \%tags), return;
795
978
  }
796
979
 
797
980
  # check for DJI telemetry data, eg:
798
981
  # "F/3.5, SS 1000, ISO 100, EV 0, GPS (8.6499, 53.1665, 18), D 24.26m,
799
982
  # H 6.00m, H.S 2.10m/s, V.S 0.00m/s \n"
800
- if (not %tags and $$buffPt =~ /GPS \(([-+]?\d*\.\d+),\s*([-+]?\d*\.\d+)/) {
983
+ if ($$buffPt =~ /GPS \(([-+]?\d*\.\d+),\s*([-+]?\d*\.\d+)/) {
801
984
  $$et{CreateDateAtEnd} = 1; # set flag indicating the file creation date is at the end
802
985
  $tags{GPSLatitude} = $2;
803
986
  $tags{GPSLongitude} = $1;
@@ -812,11 +995,13 @@ sub Process_text($$$)
812
995
  $tags{ExposureTime} = 1 / $1 if $$buffPt =~ /\bSS\s+(\d+\.?\d*)/;
813
996
  $tags{ExposureCompensation} = ($1 / ($2 || 1)) if $$buffPt =~ /\bEV\s+([-+]?\d+\.?\d*)(\/\d+)?/;
814
997
  $tags{ISO} = $1 if $$buffPt =~ /\bISO\s+(\d+\.?\d*)/;
998
+ HandleTextTags($et, $tagTbl, \%tags);
999
+ return;
815
1000
  }
816
1001
 
817
1002
  # check for Mini 0806 dashcam GPS, eg:
818
1003
  # "A,270519,201555.000,3356.8925,N,08420.2071,W,000.0,331.0M,+01.84,-09.80,-00.61;\n"
819
- if (not %tags and $$buffPt =~ /^A,(\d{2})(\d{2})(\d{2}),(\d{2})(\d{2})(\d{2}(\.\d+)?)/) {
1004
+ if ($$buffPt =~ /^A,(\d{2})(\d{2})(\d{2}),(\d{2})(\d{2})(\d{2}(\.\d+)?)/) {
820
1005
  $tags{GPSDateTime} = "20$3:$2:$1 $4:$5:$6Z";
821
1006
  if ($$buffPt =~ /^A,.*?,.*?,(\d{2})(\d+\.\d+),([NS])/) {
822
1007
  $tags{GPSLatitude} = ($1 + $2/60) * ($3 eq 'S' ? -1 : 1);
@@ -828,37 +1013,56 @@ sub Process_text($$$)
828
1013
  $tags{GPSAltitude} = $a[8] if $a[8] and $a[8] =~ s/M$//;
829
1014
  $tags{GPSSpeed} = $a[7] if $a[7] and $a[7] =~ /^\d+\.\d+$/; # (NC)
830
1015
  $tags{Accelerometer} = "$a[9] $a[10] $a[11]" if $a[11] and $a[11] =~ s/;\s*$//;
1016
+ HandleTextTags($et, $tagTbl, \%tags);
1017
+ return;
1018
+ }
1019
+
1020
+ # check for Roadhawk dashcam text
1021
+ # ".;;;;D?JL;6+;;;D;R?;4;;;;DBB;;O;;;=D;L;;HO71G>F;-?=J-F:FNJJ;DPP-JF3F;;PL=DBRLBF0F;=?DNF-RD-PF;N;?=JF;;?D=F:*6F~"
1022
+ # decoded:
1023
+ # "X0000.2340Y-000.0720Z0000.9900G0001.0400$GPRMC,082138,A,5330.6683,N,00641.9749,W,012.5,87.86,050213,002.1,A"
1024
+ # (note: "002.1" is magnetic variation and is not decoded; it should have ",E" or ",W" afterward for direction)
1025
+ if ($$buffPt =~ /\*[0-9A-F]{2}~$/) {
1026
+ # (ref https://reverseengineering.stackexchange.com/questions/11582/how-to-reverse-engineer-dash-cam-metadata)
1027
+ my @decode = unpack 'C*', '-I8XQWRVNZOYPUTA0B1C2SJ9K.L,M$D3E4F5G6H7';
1028
+ my @chars = unpack 'C*', substr($$buffPt, 0, -4);
1029
+ foreach (@chars) {
1030
+ my $n = $_ - 43;
1031
+ $_ = $decode[$n] if $n >= 0 and defined $decode[$n];
1032
+ }
1033
+ my $buff = pack 'C*', @chars;
1034
+ if ($buff =~ /X(.*?)Y(.*?)Z(.*?)G(.*?)\$/) {
1035
+ # yup. the decoding worked out
1036
+ $tags{Accelerometer} = "$1 $2 $3 $4";
1037
+ $$buffPt = $buff; # (process GPRMC below)
1038
+ }
831
1039
  }
832
1040
 
833
- # check for Thinkware format, eg:
1041
+ # check for Thinkware format (and other NMEA RMC), eg:
834
1042
  # "gsensori,4,512,-67,-12,100;GNRMC,161313.00,A,4529.87489,N,07337.01215,W,6.225,35.34,310819,,,A*52..;
835
1043
  # CAR,0,0,0,0.0,0,0,0,0,0,0,0,0"
836
- unless (%tags) {
837
- if ($$buffPt =~ /[A-Z]{2}RMC,(\d{2})(\d{2})(\d+(\.\d*)?),A?,(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),(\d*\.?\d*),(\d*\.?\d*),(\d{2})(\d{2})(\d+)/ and
838
- # do some basic sanity checks on the date
839
- $13 <= 31 and $14 <= 12 and $15 <= 99)
840
- {
841
- my $year = $15 + ($15 >= 70 ? 1900 : 2000);
842
- $tags{GPSDateTime} = sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2dZ', $year, $14, $13, $1, $2, $3);
843
- $tags{GPSLatitude} = (($5 || 0) + $6/60) * ($7 eq 'N' ? 1 : -1);
844
- $tags{GPSLongitude} = (($8 || 0) + $9/60) * ($10 eq 'E' ? 1 : -1);
845
- if (length $11) {
846
- $tags{GPSSpeed} = $11 * $knotsToKph;
847
- $tags{GPSSpeedRef} = 'K';
848
- }
849
- if (length $12) {
850
- $tags{GPSTrack} = $12;
851
- $tags{GPSTrackRef} = 'T';
852
- }
1044
+ if ($$buffPt =~ /[A-Z]{2}RMC,(\d{2})(\d{2})(\d+(\.\d*)?),A?,(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),(\d*\.?\d*),(\d*\.?\d*),(\d{2})(\d{2})(\d+)/ and
1045
+ # do some basic sanity checks on the date
1046
+ $13 <= 31 and $14 <= 12 and $15 <= 99)
1047
+ {
1048
+ my $year = $15 + ($15 >= 70 ? 1900 : 2000);
1049
+ $tags{GPSDateTime} = sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2dZ', $year, $14, $13, $1, $2, $3);
1050
+ $tags{GPSLatitude} = (($5 || 0) + $6/60) * ($7 eq 'N' ? 1 : -1);
1051
+ $tags{GPSLongitude} = (($8 || 0) + $9/60) * ($10 eq 'E' ? 1 : -1);
1052
+ if (length $11) {
1053
+ $tags{GPSSpeed} = $11 * $knotsToKph;
1054
+ $tags{GPSSpeedRef} = 'K';
1055
+ }
1056
+ if (length $12) {
1057
+ $tags{GPSTrack} = $12;
1058
+ $tags{GPSTrackRef} = 'T';
853
1059
  }
854
- $tags{GSensor} = $1 if $$buffPt =~ /\bgsensori,(.*?)(;|$)/;
855
- $tags{Car} = $1 if $$buffPt =~ /\bCAR,(.*?)(;|$)/;
856
1060
  }
1061
+ $tags{GSensor} = $1 if $$buffPt =~ /\bgsensori,(.*?)(;|$)/;
1062
+ $tags{Car} = $1 if $$buffPt =~ /\bCAR,(.*?)(;|$)/;
1063
+
857
1064
  if (%tags) {
858
- foreach $tag (sort keys %tags) {
859
- $et->HandleTag($tagTbl, $tag => $tags{$tag});
860
- }
861
- $$et{UnknownTextCount} = 0;
1065
+ HandleTextTags($et, $tagTbl, \%tags);
862
1066
  } else {
863
1067
  $$et{UnknownTextCount} = ($$et{UnknownTextCount} || 0) + 1;
864
1068
  # give up trying to decode useful information if we haven't found anything for a while
@@ -911,7 +1115,7 @@ sub ProcessSamples($)
911
1115
  ($startChunk, $samplesPerChunk, $descIdx) = @{shift @$stsc};
912
1116
  $nextChunk = $$stsc[0][0] if @$stsc;
913
1117
  }
914
- @$size < @$start + $samplesPerChunk and $et->WarnOnce('Sample size error'), return;
1118
+ @$size < @$start + $samplesPerChunk and $et->WarnOnce('Sample size error'), last;
915
1119
  my $sampleStart = $chunkStart;
916
1120
  for ($i=0; ; ) {
917
1121
  push @$start, $sampleStart;
@@ -1014,11 +1218,13 @@ sub ProcessSamples($)
1014
1218
  $val =~ tr/\t/ /;
1015
1219
  $et->HandleTag($tagTbl, RawGSensor => $val) if length $val;
1016
1220
  }
1017
- } elsif ($buff =~ /^PNDM/ and length $buff >= 20) {
1221
+ } elsif ($buff =~ /^(\0.{3})?PNDM/s) {
1018
1222
  # Garmin Dashcam format (actually binary, not text)
1019
- $et->HandleTag($tagTbl, GPSLatitude => Get32s(\$buff, 12) * 180/0x80000000);
1020
- $et->HandleTag($tagTbl, GPSLongitude => Get32s(\$buff, 16) * 180/0x80000000);
1021
- $et->HandleTag($tagTbl, GPSSpeed => Get16u(\$buff, 8));
1223
+ my $n = $1 ? 4 : 0; # skip leading 4-byte size word if it exists
1224
+ next if length($buff) < 20 + $n;
1225
+ $et->HandleTag($tagTbl, GPSLatitude => Get32s(\$buff, 12+$n) * 180/0x80000000);
1226
+ $et->HandleTag($tagTbl, GPSLongitude => Get32s(\$buff, 16+$n) * 180/0x80000000);
1227
+ $et->HandleTag($tagTbl, GPSSpeed => Get16u(\$buff, 8+$n));
1022
1228
  $et->HandleTag($tagTbl, GPSSpeedRef => 'M');
1023
1229
  SetGPSDateTime($et, $tagTbl, $time[$i]);
1024
1230
  next; # all done (don't store/process as text)
@@ -1038,8 +1244,8 @@ sub ProcessSamples($)
1038
1244
  $$et{ee} = $ee; # need ee information for 'keys'
1039
1245
  $et->HandleTag($tagTbl, $metaFormat, undef,
1040
1246
  DataPt => \$buff,
1041
- DataPos => $$start[$i],
1042
- Base => $$start[$i],
1247
+ DataPos => 0,
1248
+ Base => $$start[$i], # (Base must be set for CR3 files)
1043
1249
  TagInfo => $tagInfo,
1044
1250
  );
1045
1251
  delete $$et{ee};
@@ -1051,7 +1257,7 @@ sub ProcessSamples($)
1051
1257
  Process_text($et, $tagTbl, \$buff);
1052
1258
  }
1053
1259
  } elsif ($verbose) {
1054
- $et->VPrint(0, "Unknown meta format ($metaFormat)");
1260
+ $et->VPrint(0, "Unknown $type format ($metaFormat)");
1055
1261
  }
1056
1262
 
1057
1263
  } elsif ($type eq 'gps ') { # (ie. GPSDataList tag)
@@ -1073,8 +1279,8 @@ sub ProcessSamples($)
1073
1279
  FoundSomething($et, $tagTbl, $time[$i], $dur[$i]);
1074
1280
  $et->HandleTag($tagTbl, $type, undef,
1075
1281
  DataPt => \$buff,
1076
- DataPos => $$start[$i],
1077
- Base => $$start[$i],
1282
+ DataPos => 0,
1283
+ Base => $$start[$i], # (Base must be set for CR3 files)
1078
1284
  TagInfo => $tagInfo,
1079
1285
  );
1080
1286
  }
@@ -1108,13 +1314,35 @@ sub ProcessFreeGPS($$$)
1108
1314
 
1109
1315
  return 0 if $dirLen < 92;
1110
1316
 
1111
- if (substr($$dataPt,12,1) eq "\x05") {
1317
+ if (substr($$dataPt,18,8) eq "\xaa\xaa\xf2\xe1\xf0\xee\x54\x54") {
1112
1318
 
1319
+ # (this is very similar to the encrypted text format)
1113
1320
  # decode encrypted ASCII-based GPS (DashCam Azdome GS63H, ref 5)
1114
1321
  # header looks like this in my sample:
1115
1322
  # 0000: 00 00 80 00 66 72 65 65 47 50 53 20 05 01 00 00 [....freeGPS ....]
1116
1323
  # 0010: 01 03 aa aa f2 e1 f0 ee 54 54 98 9a 9b 92 9a 93 [........TT......]
1117
1324
  # 0020: 98 9e 98 98 9e 93 98 92 a6 9f 9f 9c 9d ed fa 8a [................]
1325
+ # decrypted (from byte 18):
1326
+ # 0000: 00 00 58 4b 5a 44 fe fe 32 30 31 38 30 39 32 34 [..XKZD..20180924]
1327
+ # 0010: 32 32 34 39 32 38 0c 35 35 36 37 47 50 20 20 20 [224928.5567GP ]
1328
+ # 0020: 00 00 00 00 00 03 4e 34 30 34 36 34 33 35 30 57 [......N40464350W]
1329
+ # 0030: 30 30 37 30 34 30 33 30 38 30 30 30 30 30 30 30 [0070403080000000]
1330
+ # 0040: 37 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [7...............]
1331
+ # [...]
1332
+ # 00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 2b 30 39 [.............+09]
1333
+ # 00b0: 33 2d 30 30 33 2d 30 30 35 00 00 00 00 00 00 00 [3-003-005.......]
1334
+ # header looks like this for EEEkit gps:
1335
+ # 0000: 00 00 04 00 66 72 65 65 47 50 53 20 f0 03 00 00 [....freeGPS ....]
1336
+ # 0010: 01 03 aa aa f2 e1 f0 ee 54 54 98 9a 98 9a 9a 9f [........TT......]
1337
+ # 0020: 9b 93 9b 9c 98 99 99 9f a6 9a 9a 98 9a 9a 9f 9b [................]
1338
+ # 0030: 93 9b 9c 98 99 99 9c a9 e4 99 9d 9e 9f 98 9e 9b [................]
1339
+ # 0040: 9c fd 9b 98 98 98 9f 9f 9a 9a 93 81 9a 9b 9d 9f [................]
1340
+ # decrypted (from byte 18):
1341
+ # 0000: 00 00 58 4b 5a 44 fe fe 32 30 32 30 30 35 31 39 [..XKZD..20200519]
1342
+ # 0010: 31 36 32 33 33 35 0c 30 30 32 30 30 35 31 39 31 [162335.002005191]
1343
+ # 0020: 36 32 33 33 36 03 4e 33 37 34 35 32 34 31 36 57 [62336.N37452416W]
1344
+ # 0030: 31 32 32 32 35 35 30 30 39 2b 30 31 37 35 30 31 [122255009+017501]
1345
+ # 0040: 31 2b 30 31 34 2b 30 30 32 2b 30 32 36 2b 30 31 [1+014+002+026+01]
1118
1346
  my $n = $dirLen - 18;
1119
1347
  $n = 0x101 if $n > 0x101;
1120
1348
  my $buf2 = pack 'C*', map { $_ ^ 0xaa } unpack 'C*', substr($$dataPt,18,$n);
@@ -1123,13 +1351,25 @@ sub ProcessFreeGPS($$$)
1123
1351
  $et->VerboseDump(\$buf2);
1124
1352
  }
1125
1353
  # (extract longitude as 9 digits, not 8, ref PH)
1126
- return 0 unless $buf2 =~ /^.{8}(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2}).(.{15})([NS])(\d{8})([EW])(\d{9})(\d{8})/s;
1354
+ return 0 unless $buf2 =~ /^.{8}(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2}).(.{15})([NS])(\d{8})([EW])(\d{9})(\d{8})?/s;
1127
1355
  ($yr,$mon,$day,$hr,$min,$sec,$lbl,$latRef,$lat,$lonRef,$lon,$spd) = ($1,$2,$3,$4,$5,$6,$7,$8,$9/1e4,$10,$11/1e4,$12);
1128
- $spd += 0; # remove leading 0's
1356
+ if (defined $spd) { # (Azdome)
1357
+ $spd += 0; # remove leading 0's
1358
+ } elsif ($buf2 =~ /^.{57}([-+]\d{4})(\d{3})/s) { # (EEEkit)
1359
+ # $alt = $1 + 0; (doesn't look right for my sample, but the Ambarella A12 text has this)
1360
+ $spd = $2 + 0;
1361
+ }
1129
1362
  $lbl =~ s/\0.*//s; $lbl =~ s/\s+$//; # truncate at null and remove trailing spaces
1130
1363
  push @xtra, UserLabel => $lbl if length $lbl;
1131
1364
  # extract accelerometer data (ref PH)
1132
- @acc = ($1/100,$2/100,$3/100) if $buf2 =~ /^.{173}([-+]\d{3})([-+]\d{3})([-+]\d{3})/s;
1365
+ if ($buf2 =~ /^.{65}(([-+]\d{3})([-+]\d{3})([-+]\d{3})([-+]\d{3})*)/s) {
1366
+ $_ = $1;
1367
+ @acc = ($2/100, $3/100, $4/100);
1368
+ s/([-+])/ $1/g; s/^ //;
1369
+ push @xtra, AccelerometerData => $_;
1370
+ } elsif ($buf2 =~ /^.{173}([-+]\d{3})([-+]\d{3})([-+]\d{3})/s) { # (Azdome)
1371
+ @acc = ($1/100, $2/100, $3/100);
1372
+ }
1133
1373
 
1134
1374
  } elsif ($$dataPt =~ /^.{52}(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/s) {
1135
1375
 
@@ -1180,12 +1420,12 @@ sub ProcessFreeGPS($$$)
1180
1420
 
1181
1421
  # decode freeGPS from Akaso dashcam
1182
1422
  # 0000: 00 00 80 00 66 72 65 65 47 50 53 20 60 00 00 00 [....freeGPS `...]
1183
- # 0000: 78 2e 78 78 00 00 00 00 00 00 00 00 00 00 00 00 [x.xx............]
1184
- # 0000: 30 30 30 30 30 00 00 00 00 00 00 00 00 00 00 00 [00000...........]
1185
- # 0000: 12 00 00 00 2f 00 00 00 19 00 00 00 41 00 00 00 [..../.......A...]
1186
- # 0000: 13 b3 ca 44 4e 00 00 00 29 92 fb 45 45 00 00 00 [...DN...)..EE...]
1187
- # 0000: d9 ee b4 41 ec d1 d3 42 e4 07 00 00 01 00 00 00 [...A...B........]
1188
- # 0000: 0c 00 00 00 01 00 00 00 05 00 00 00 00 00 00 00 [................]
1423
+ # 0010: 78 2e 78 78 00 00 00 00 00 00 00 00 00 00 00 00 [x.xx............]
1424
+ # 0020: 30 30 30 30 30 00 00 00 00 00 00 00 00 00 00 00 [00000...........]
1425
+ # 0030: 12 00 00 00 2f 00 00 00 19 00 00 00 41 00 00 00 [..../.......A...]
1426
+ # 0040: 13 b3 ca 44 4e 00 00 00 29 92 fb 45 45 00 00 00 [...DN...)..EE...]
1427
+ # 0050: d9 ee b4 41 ec d1 d3 42 e4 07 00 00 01 00 00 00 [...A...B........]
1428
+ # 0060: 0c 00 00 00 01 00 00 00 05 00 00 00 00 00 00 00 [................]
1189
1429
  ($latRef, $lonRef) = ($1, $2);
1190
1430
  ($hr, $min, $sec, $yr, $mon, $day) = unpack('x48V3x28V3', $$dataPt);
1191
1431
  SetByteOrder('II');
@@ -1196,6 +1436,56 @@ sub ProcessFreeGPS($$$)
1196
1436
  $trk -= 360 if $trk >= 360;
1197
1437
  SetByteOrder('MM');
1198
1438
 
1439
+ } elsif ($$dataPt =~ /^.{16}YndAkasoCar/s) {
1440
+
1441
+ # Akaso V1 dascham
1442
+ # 0000: 00 00 80 00 66 72 65 65 47 50 53 20 78 00 00 00 [....freeGPS x...]
1443
+ # 0010: 59 6e 64 41 6b 61 73 6f 43 61 72 00 00 00 00 00 [YndAkasoCar.....]
1444
+ # 0020: 30 30 30 30 30 00 00 00 00 00 00 00 00 00 00 00 [00000...........]
1445
+ # 0030: 0e 00 00 00 27 00 00 00 2c 00 00 00 e3 07 00 00 [....'...,.......]
1446
+ # 0040: 05 00 00 00 1d 00 00 00 41 4e 45 00 00 00 00 00 [........ANE.....]
1447
+ # 0050: f1 4e 3e 3d 90 df ca 40 e3 50 bf 0b 0b 31 a0 40 [.N>=...@.P...1.@]
1448
+ # 0060: 4b dc c8 41 9a 79 a7 43 34 58 43 31 4f 37 31 35 [K..A.y.C4XC1O715]
1449
+ # 0070: 35 31 32 36 36 35 37 35 59 4e 44 53 0d e7 cc f9 [51266575YNDS....]
1450
+ # 0080: 00 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00 [................]
1451
+ ($hr,$min,$sec,$yr,$mon,$day,$stat,$latRef,$lonRef) =
1452
+ unpack('x48V6a1a1a1x1', $$dataPt);
1453
+ # ignore invalid fixes
1454
+ return 0 unless $stat eq 'A' and ($latRef eq 'N' or $latRef eq 'S') and
1455
+ ($lonRef eq 'E' or $lonRef eq 'W');
1456
+
1457
+ $et->WarnOnce("Can't yet decrypt Akaso V1 timed GPS", 1);
1458
+ # (see https://exiftool.org/forum/index.php?topic=11320.0)
1459
+ return 1;
1460
+
1461
+ SetByteOrder('II');
1462
+ $lat = GetDouble($dataPt, 0x50); # latitude is here, but encrypted somehow
1463
+ $lon = GetDouble($dataPt, 0x58); # longitude is here, but encrypted somehow
1464
+ SetByteOrder('MM');
1465
+ #my $serialNum = substr($$dataPt, 0x68, 20);
1466
+
1467
+ } elsif ($$dataPt =~ /^.{12}\xac\0\0\0.{44}(.{72})/s) {
1468
+
1469
+ # EACHPAI dash cam
1470
+ # 0000: 00 00 80 00 66 72 65 65 47 50 53 20 ac 00 00 00 [....freeGPS ....]
1471
+ # 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
1472
+ # 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
1473
+ # 0030: 00 00 00 00 00 00 00 00 00 00 00 00 34 57 60 62 [............4W`b]
1474
+ # 0040: 5d 53 3c 41 47 45 45 42 42 3e 40 40 40 3c 51 3c []S<AGEEBB>@@@<Q<]
1475
+ # 0050: 44 42 44 40 3e 48 46 43 45 3c 5e 3c 40 48 43 41 [DBD@>HFCE<^<@HCA]
1476
+ # 0060: 42 3e 46 42 47 48 3c 67 3c 40 3e 40 42 3c 43 3e [B>FBGH<g<@>@B<C>]
1477
+ # 0070: 43 41 3c 40 42 40 46 42 40 3c 3c 3c 51 3a 47 46 [CA<@B@FB@<<<Q:GF]
1478
+ # 0080: 00 2a 36 35 00 00 00 00 00 00 00 00 00 00 00 00 [.*65............]
1479
+
1480
+ $et->WarnOnce("Can't yet decrypt EACHPAI timed GPS", 1);
1481
+ # (see https://exiftool.org/forum/index.php?topic=5095.msg61266#msg61266)
1482
+ return 1;
1483
+
1484
+ my $time = pack 'C*', map { $_ ^= 0 } unpack 'C*', $1;
1485
+ # bytes 7-12 are the timestamp in ASCII HHMMSS after xor-ing with 0x70
1486
+ substr($time,7,6) = pack 'C*', map { $_ ^= 0x70 } unpack 'C*', substr($time,7,6);
1487
+ # (other values are currently unknown)
1488
+
1199
1489
  } else {
1200
1490
 
1201
1491
  # decode binary GPS format (Viofo A119S, ref 2)
@@ -1210,6 +1500,21 @@ sub ProcessFreeGPS($$$)
1210
1500
  return 0 unless $stat eq 'A' and ($latRef eq 'N' or $latRef eq 'S') and
1211
1501
  ($lonRef eq 'E' or $lonRef eq 'W');
1212
1502
  ($lat,$lon,$spd,$trk) = unpack 'f*', pack 'L*', $lat, $lon, $spd, $trk;
1503
+ # lat/lon also stored as doubles by Transcend Driver Pro 230 (ref PH)
1504
+ SetByteOrder('II');
1505
+ my ($lat2, $lon2, $alt2) = (
1506
+ GetDouble($dataPt, 0x70),
1507
+ GetDouble($dataPt, 0x80),
1508
+ # GetDouble($dataPt, 0x98), # (don't know what this is)
1509
+ GetDouble($dataPt,0xa0),
1510
+ # GetDouble($dataPt,0xa8)) # (don't know what this is)
1511
+ );
1512
+ if (abs($lat2-$lat) < 0.001 and abs($lon2-$lon) < 0.001) {
1513
+ $lat = $lat2;
1514
+ $lon = $lon2;
1515
+ $alt = $alt2;
1516
+ }
1517
+ SetByteOrder('MM');
1213
1518
  $yr += 2000 if $yr < 2000;
1214
1519
  $spd *= $knotsToKph; # convert speed to km/h
1215
1520
  # ($trk is not confirmed; may be GPSImageDirection, ref PH)
@@ -1602,6 +1907,33 @@ sub ParseTag($$$)
1602
1907
  }
1603
1908
  $$et{HandlerType} = $tag; # fake handler type
1604
1909
  ProcessSamples($et); # we have all we need to process sample data now
1910
+ } elsif ($tag eq 'GPS ') {
1911
+ my $pos = 0;
1912
+ my $tagTbl = GetTagTable('Image::ExifTool::QuickTime::Stream');
1913
+ SetByteOrder('II');
1914
+ while ($pos + 36 < $dataLen) {
1915
+ my $dat = substr($$dataPt, $pos, 36);
1916
+ last if $dat eq "\x0" x 36;
1917
+ my @a = unpack 'VVVVCVCV', $dat;
1918
+ $$et{DOC_NUM} = ++$$et{DOC_COUNT};
1919
+ # 0=1, 1=1, 2=secs, 3=?
1920
+ SetGPSDateTime($et, $tagTbl, $a[2]);
1921
+ my $lat = $a[5] / 1e3;
1922
+ my $lon = $a[7] / 1e3;
1923
+ my $deg = int($lat / 100);
1924
+ $lat = $deg + ($lat - $deg * 100) / 60;
1925
+ $deg = int($lon / 100);
1926
+ $lon = $deg + ($lon - $deg * 100) / 60;
1927
+ $lat = -$lat if $a[4] eq 'S';
1928
+ $lon = -$lon if $a[6] eq 'W';
1929
+ $et->HandleTag($tagTbl, GPSLatitude => $lat);
1930
+ $et->HandleTag($tagTbl, GPSLongitude => $lon);
1931
+ $et->HandleTag($tagTbl, GPSSpeed => $a[3] / 1e3);
1932
+ $et->HandleTag($tagTbl, GPSSpeedRef => 'K');
1933
+ $pos += 36;
1934
+ }
1935
+ SetByteOrder('MM');
1936
+ delete $$et{DOC_NUM};
1605
1937
  }
1606
1938
  }
1607
1939
 
@@ -1619,6 +1951,26 @@ sub Process_tx3g($$$)
1619
1951
  return 1;
1620
1952
  }
1621
1953
 
1954
+ #------------------------------------------------------------------------------
1955
+ # Process GM 'marl' ctbx metadata (ref PH)
1956
+ # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
1957
+ # Returns: 1 on success
1958
+ sub Process_marl($$$)
1959
+ {
1960
+ my ($et, $dirInfo, $tagTablePtr) = @_;
1961
+ my $dataPt = $$dirInfo{DataPt};
1962
+ return 0 if length $$dataPt < 2;
1963
+
1964
+ # 8-byte records:
1965
+ # byte 0 seems to be tag ID (0=timestamp in sec * 1e7)
1966
+ # bytes 1-3 seem to be 24-bit signed integer (unknown meaning)
1967
+ # bytes 4-7 are an int32u value, usually a multiple of 10000
1968
+
1969
+ $et->WarnOnce("Can't yet decode timed GM data", 1);
1970
+ # (see https://exiftool.org/forum/index.php?topic=11335.msg61393#msg61393)
1971
+ return 1;
1972
+ }
1973
+
1622
1974
  #------------------------------------------------------------------------------
1623
1975
  # Process QuickTime 'mebx' timed metadata
1624
1976
  # Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) tag table ref
@@ -2097,11 +2449,16 @@ sub ProcessInsta360($;$)
2097
2449
  $et->HandleTag($tagTbl, Accelerometer => "@a[0..2]"); # (NC)
2098
2450
  $et->HandleTag($tagTbl, AngularVelocity => "@a[3..5]"); # (NC)
2099
2451
  }
2100
- } elsif ($id == 0x400 and $unknown) {
2452
+ } elsif ($id == 0x400) {
2101
2453
  for ($p=0; $p<$len; $p+=$dlen) {
2102
2454
  $$et{DOC_NUM} = ++$$et{DOC_COUNT};
2103
2455
  $et->HandleTag($tagTbl, TimeCode => sprintf('%.3f', Get64u(\$buff, $p) / 1000));
2104
- $et->HandleTag($tagTbl, Unknown01 => GetDouble(\$buff, $p + 8));
2456
+ $et->HandleTag($tagTbl, ExposureTime => GetDouble(\$buff, $p + 8)); #6
2457
+ }
2458
+ } elsif ($id == 0x600) { #6
2459
+ for ($p=0; $p<$len; $p+=$dlen) {
2460
+ $$et{DOC_NUM} = ++$$et{DOC_COUNT};
2461
+ $et->HandleTag($tagTbl, VideoTimeStamp => sprintf('%.3f', Get64u(\$buff, $p) / 1000));
2105
2462
  }
2106
2463
  } elsif ($id == 0x700) {
2107
2464
  for ($p=0; $p<$len; $p+=$dlen) {
@@ -2147,6 +2504,37 @@ sub ProcessInsta360($;$)
2147
2504
  return 1;
2148
2505
  }
2149
2506
 
2507
+ #------------------------------------------------------------------------------
2508
+ # Process 360Fly 'uuid' atom containing sensor data
2509
+ # (ref https://github.com/JamesHeinrich/getID3/blob/master/getid3/module.audio-video.quicktime.php)
2510
+ # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
2511
+ # Returns: 1 on success
2512
+ sub Process360Fly($$$)
2513
+ {
2514
+ my ($et, $dirInfo, $tagTbl) = @_;
2515
+ my $dataPt = $$dirInfo{DataPt};
2516
+ my $dataLen = length $$dataPt;
2517
+ my $pos = 16;
2518
+ my $lastTime = -1;
2519
+ my $streamTbl = GetTagTable('Image::ExifTool::QuickTime::Stream');
2520
+ while ($pos + 32 <= $dataLen) {
2521
+ my $type = ord substr $$dataPt, $pos, 1;
2522
+ my $time = Get64u($dataPt, $pos + 2); # (only valid for some types)
2523
+ if ($$tagTbl{$type}) {
2524
+ if ($time != $lastTime) {
2525
+ $$et{DOC_NUM} = ++$$et{DOC_COUNT};
2526
+ $lastTime = $time;
2527
+ }
2528
+ }
2529
+ $et->HandleTag($tagTbl, $type, undef, DataPt => $dataPt, Start => $pos, Size => 32);
2530
+ # synthesize GPSDateTime from the timestamp for GPS records
2531
+ SetGPSDateTime($et, $streamTbl, $time / 1e6) if $type == 5;
2532
+ $pos += 32;
2533
+ }
2534
+ delete $$et{DOC_NUM};
2535
+ return 1;
2536
+ }
2537
+
2150
2538
  #------------------------------------------------------------------------------
2151
2539
  # Scan media data for "freeGPS" metadata if not found already (ref PH)
2152
2540
  # Inputs: 0) ExifTool ref