Skip to content

Commit

Permalink
Upgrading to exiftool v12.96
Browse files Browse the repository at this point in the history
  • Loading branch information
morozgrafix committed Sep 9, 2024
1 parent 978dcbb commit c52f69c
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 60 deletions.
6 changes: 6 additions & 0 deletions bin/Changes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ RSS feed: https://exiftool.org/rss.xml
Note: The most recent production release is Version 12.76. (Other versions are
considered development releases, and are not uploaded to MetaCPAN.)

Sept. 1, 2024 - Version 12.96

- More improvements to handling of trailers on video files (and add ability to
write videos which have an unknown trailer)
- Fixed problem geotagging from some newer Google Takeout files

Aug. 30, 2024 - Version 12.95

- Added a couple of new CanonModelID values
Expand Down
2 changes: 1 addition & 1 deletion bin/META.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@
}
},
"release_status" : "stable",
"version" : "12.95"
"version" : "12.96"
}
2 changes: 1 addition & 1 deletion bin/META.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ recommends:
Time::HiRes: '0'
requires:
perl: '5.004'
version: '12.95'
version: '12.96'
4 changes: 2 additions & 2 deletions bin/README
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ your home directory, then you would type the following commands in a
terminal window to extract and run ExifTool:

cd ~/Desktop
gzip -dc Image-ExifTool-12.95.tar.gz | tar -xf -
cd Image-ExifTool-12.95
gzip -dc Image-ExifTool-12.96.tar.gz | tar -xf -
cd Image-ExifTool-12.96
./exiftool t/images/ExifTool.jpg

Note: These commands extract meta information from one of the test images.
Expand Down
4 changes: 2 additions & 2 deletions bin/exiftool
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use strict;
use warnings;
require 5.004;

my $version = '12.95';
my $version = '12.96';

# add our 'lib' directory to the include list BEFORE 'use Image::ExifTool'
my $exePath;
Expand Down Expand Up @@ -5655,7 +5655,7 @@ with this command:
produces output like this:
-- Generated by ExifTool 12.95 --
-- Generated by ExifTool 12.96 --
File: a.jpg - 2003:10:31 15:44:19
(f/5.6, 1/60s, ISO 100)
File: b.jpg - 2006:05:23 11:57:38
Expand Down
2 changes: 1 addition & 1 deletion bin/lib/Image/ExifTool.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use vars qw($VERSION $RELEASE @ISA @EXPORT_OK %EXPORT_TAGS $AUTOLOAD @fileTypes
%jpegMarker %specialTags %fileTypeLookup $testLen $exeDir
%static_vars $advFmtSelf);

$VERSION = '12.95';
$VERSION = '12.96';
$RELEASE = '';
@ISA = qw(Exporter);
%EXPORT_TAGS = (
Expand Down
4 changes: 2 additions & 2 deletions bin/lib/Image/ExifTool/Geotag.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use vars qw($VERSION);
use Image::ExifTool qw(:Public);
use Image::ExifTool::GPS;

$VERSION = '1.77';
$VERSION = '1.78';

sub JITTER() { return 2 } # maximum time jitter

Expand Down Expand Up @@ -323,7 +323,7 @@ sub LoadTrackLog($$;$)
# Google Takeout JSON format
$format = 'JSON';
$sortFixes = 1; # (fixes are not all in order for this format)
} elsif (/"durationMinutesOffsetFromStartTime"\s*:/) {
} elsif (/"(durationMinutesOffsetFromStartTime|startTime)"\s*:/) {
$format = 'JSON'; # new Google Takeout JSON format (fixes seem to be in order)
$raf->Seek(0,0); # rewind to start of file
} else {
Expand Down
34 changes: 20 additions & 14 deletions bin/lib/Image/ExifTool/QuickTime.pm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use Image::ExifTool qw(:DataAccess :Utils);
use Image::ExifTool::Exif;
use Image::ExifTool::GPS;

$VERSION = '3.01';
$VERSION = '3.02';

sub ProcessMOV($$;$);
sub ProcessKeys($$$);
Expand Down Expand Up @@ -9528,7 +9528,7 @@ sub ProcessMOV($$;$)
my $dirID = $$dirInfo{DirID} || '';
my $charsetQuickTime = $et->Options('CharsetQuickTime');
my ($buff, $tag, $size, $track, $isUserData, %triplet, $doDefaultLang, $index);
my ($dirEnd, $unkOpt, %saveOptions, $atomCount, $warnStr);
my ($dirEnd, $unkOpt, %saveOptions, $atomCount, $warnStr, $trailer);

my $topLevel = not $$et{InQuickTime};
$$et{InQuickTime} = 1;
Expand Down Expand Up @@ -9557,6 +9557,17 @@ sub ProcessMOV($$;$)
$tagTablePtr = GetTagTable('Image::ExifTool::QuickTime::Main');
}
($size, $tag) = unpack('Na4', $buff);
my $fast = $$et{OPTIONS}{FastScan} || 0;
# check for Insta360 trailer
if ($topLevel and not $fast) {
my $pos = $raf->Tell();
if ($raf->Seek(-40, 2) and $raf->Read($buff, 40) == 40 and
substr($buff, 8) eq '8db42d694ccc418790edff439fe026bf')
{
$trailer = [ 'Insta360', $raf->Tell() - unpack('V',$buff) ];
}
$raf->Seek($pos,0) or return 0;
}
if ($dataPt) {
$verbose and $et->VerboseDir($$dirInfo{DirName});
} else {
Expand Down Expand Up @@ -9595,7 +9606,6 @@ sub ProcessMOV($$;$)
# have XMP take priority except for HEIC
$$et{PRIORITY_DIR} = 'XMP' unless $fileType and $fileType eq 'HEIC';
}
my $fast = $$et{OPTIONS}{FastScan} || 0;
$$raf{NoBuffer} = 1 if $fast; # disable buffering in FastScan mode

my $ee = $$et{OPTIONS}{ExtractEmbedded};
Expand Down Expand Up @@ -10136,26 +10146,22 @@ ItemID: foreach $id (reverse sort { $a <=> $b } keys %$items) {
$dataPos += $size + 8; # point to start of next atom data
last if $dirEnd and $dataPos >= $dirEnd; # (note: ignores last value if 0 bytes)
$lastPos = $raf->Tell() + $dirBase;
if ($trailer and $lastPos >= $$trailer[1]) {
$et->Warn(sprintf('%s trailer at offset 0x%x', @$trailer), 1);
last;
}
$raf->Read($buff, 8) == 8 or last;
$lastTag = $tag if $$tagTablePtr{$tag} and $tag ne 'free'; # (Insta360 sometimes puts free block before trailer)
($size, $tag) = unpack('Na4', $buff);
++$index if defined $index;
}
if ($warnStr) {
# assume this is an unknown trailer if it comes immediately after
# mdat or moov or free and has a tag name we don't recognize
# (Insta360 can write trailer after a 'free' atom)
if (($lastTag eq 'mdat' or $lastTag eq 'moov' or $lastTag eq 'free') and
# mdat or moov and has a tag name we don't recognize
if (($lastTag eq 'mdat' or $lastTag eq 'moov') and
(not $$tagTablePtr{$tag} or ref $$tagTablePtr{$tag} eq 'HASH' and $$tagTablePtr{$tag}{Unknown}))
{
if ($raf->Seek(-40, 2) and $raf->Read($buff, 40) == 40 and
substr($buff, 8) eq '8db42d694ccc418790edff439fe026bf' and
$lastPos == $raf->Tell() - unpack('V',$buff))
{
$et->Warn(sprintf('Insta360 trailer at offset 0x%x', $lastPos), 1);
} else {
$et->Warn('Unknown trailer with '.lcfirst($warnStr));
}
$et->Warn('Unknown trailer with '.lcfirst($warnStr));
} else {
$et->Warn($warnStr);
}
Expand Down
69 changes: 34 additions & 35 deletions bin/lib/Image/ExifTool/WriteQuickTime.pl
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ ($$$)
$et or return 1; # allow dummy access to autoload this package
my ($mdat, @mdat, @mdatEdit, $edit, $track, $outBuff, $co, $term, $delCount);
my (%langTags, $canCreate, $delGrp, %boxPos, %didDir, $writeLast, $err, $atomCount);
my ($tag, $lastTag, $lastPos, $errStr, $copyTrailer, $buf2);
my ($tag, $lastTag, $lastPos, $errStr, $trailer, $buf2);
my $outfile = $$dirInfo{OutFile} || return 0;
my $raf = $$dirInfo{RAF}; # (will be null for lower-level atoms)
my $dataPt = $$dirInfo{DataPt}; # (will be null for top-level atoms)
Expand All @@ -860,6 +860,16 @@ ($$$)
my $createKeys = 0;
my ($rtnVal, $rtnErr) = $dataPt ? (undef, undef) : (1, 0);

# check for Insta360 trailer at top level
if ($raf) {
my $pos = $raf->Tell();
if ($raf->Seek(-40, 2) and $raf->Read($buf2, 40) == 40 and
substr($buf2, 8) eq '8db42d694ccc418790edff439fe026bf')
{
$trailer = [ 'Insta360', $raf->Tell() - unpack('V',$buf2) ];
}
$raf->Seek($pos, 0) or return 0;
}
if ($dataPt) {
$raf = File::RandomAccess->new($dataPt);
} else {
Expand Down Expand Up @@ -924,6 +934,11 @@ ($$$)

for (;;) { # loop through all atoms at this level
$lastPos = $raf->Tell();
# stop processing if we reached a known trailer
if ($trailer and $lastPos >= $$trailer[1]) {
$errStr = "Corrupted $$trailer[0] trailer" if $lastPos != $$trailer[1];
last;
}
$lastTag = $tag if $$tagTablePtr{$tag}; # keep track of last known tag
if (defined $atomCount and --$atomCount < 0 and $dataPt) {
# stop processing now and just copy the rest of the atom
Expand Down Expand Up @@ -1524,38 +1539,18 @@ ($$$)
}
# ($errStr is set if there was an error that could possibly be due to an unknown trailer)
if ($errStr) {
if (($lastTag eq 'mdat' or $lastTag eq 'moov' or ($lastTag eq 'free' and @mdat)) and not $dataPt and
(not $$tagTablePtr{$tag} or ref $$tagTablePtr{$tag} eq 'HASH' and $$tagTablePtr{$tag}{Unknown}))
if (($lastTag eq 'mdat' or $lastTag eq 'moov') and not $dataPt and (not $$tagTablePtr{$tag} or
ref $$tagTablePtr{$tag} eq 'HASH' and $$tagTablePtr{$tag}{Unknown}))
{
# identify known trailers
if ($raf->Seek(-40,2) and $raf->Read($buf2,40)==40 and
substr($buf2, 8) eq '8db42d694ccc418790edff439fe026bf' and
$lastPos == $raf->Tell() - unpack('V',$buf2))
{
$copyTrailer = [ $lastPos, 'Insta360' ];
# identify other known trailers
$buf2 = '';
$raf->Seek($lastPos,0) and $raf->Read($buf2,8);
if ($buf2 eq 'CCCCCCCC') {
$trailer = [ 'Kenwood', $lastPos ];
} elsif ($buf2 =~ /^(gpsa|gps0|gsen|gsea)...\0/s) {
$trailer = [ 'RIFF', $lastPos ];
} else {
$buf2 = '';
$raf->Seek($lastPos,0) and $raf->Read($buf2,8);
if ($buf2 eq 'CCCCCCCC') {
$copyTrailer = [ $lastPos, 'Kenwood' ];
} elsif ($buf2 =~ /^(gpsa|gps0|gsen|gsea)...\0/s) {
$copyTrailer = [ $lastPos, 'RIFF' ];
}
}
# are we deleting the trailer?
my $nvTrail = $et->GetNewValueHash($Image::ExifTool::Extra{Trailer});
if ($$et{DEL_GROUP}{Trailer} or ($nvTrail and not ($$nvTrail{Value} and $$nvTrail{Value}[0]))) {
$errStr =~ s/ is too large.*//;
if ($copyTrailer) {
$et->Warn("Deleted $$copyTrailer[1] trailer", 1);
undef $copyTrailer;
} else {
$et->Warn('Deleted unknown trailer with ' . lcfirst($errStr), 1);
}
} elsif (not $copyTrailer) {
$et->Warn('Unknown trailer with ' . lcfirst($errStr));
$et->Error('Use "-trailer=" to delete unknown trailer');
# (we don't currently copy an unknown trailer due to the chance it could be corrupted data)
$trailer = [ 'Unknown', $lastPos ];
}
} else {
$et->Error($errStr);
Expand Down Expand Up @@ -2011,16 +2006,20 @@ ($$$)
Write($outfile, $writeLast) or $rtnVal = 0 if $writeLast;

# copy trailer if necessary
if ($copyTrailer) {
if ($raf->Seek($$copyTrailer[0])) {
$et->Warn(sprintf('Copying %s trailer from offset 0x%x', $$copyTrailer[1], $lastPos), 1);
if ($rtnVal and $trailer) {
# are we deleting the trailer?
my $nvTrail = $et->GetNewValueHash($Image::ExifTool::Extra{Trailer});
if ($$et{DEL_GROUP}{Trailer} or ($nvTrail and not ($$nvTrail{Value} and $$nvTrail{Value}[0]))) {
$et->Warn("Deleted $$trailer[0] trailer", 1);
} elsif ($raf->Seek($$trailer[1])) {
$et->Warn(sprintf('Copying %s trailer from offset 0x%x', @$trailer), 1);
while ($raf->Read($buf2, 65536)) {
Write($outfile, $buf2) or $rtnVal = 0, last;
}
} else {
$et->Error('Error copying Insta360 trailer');
$rtnVal = 0;
}
$rtnVal or $et->Error("Error copying $$trailer[0] trailer");
}
return $rtnVal;
}
Expand Down
2 changes: 1 addition & 1 deletion bin/perl-Image-ExifTool.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Summary: perl module for image data extraction
Name: perl-Image-ExifTool
Version: 12.95
Version: 12.96
Release: 1
License: Artistic/GPL
Group: Development/Libraries/Perl
Expand Down
2 changes: 1 addition & 1 deletion lib/exiftool_vendored/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module ExiftoolVendored
VERSION = Gem::Version.new('12.95.0')
VERSION = Gem::Version.new('12.96.0')
end

0 comments on commit c52f69c

Please sign in to comment.