Extract metadata and embedded information

Started by hcoj, November 18, 2022, 10:02:34 AM

Previous topic - Next topic

hcoj

Hello,

my goal is to extract a number of frames with a certain timestamp from a thermal .seq file into separate .tiff files.
Until now I'm extracting all the frames from this .seq file manually into a bunch of .fff files.
Then I'm using exiftool to extract the metadata from these .fff files and only pick out
those files I need and convert them with exiftool to .tiff files.

I just stumpled about the -ee2 option in the most recent version to extract the metadata directly
from the .seq file without splitting it into separate files.

My questions are:

1. I can extract the metadata of all files with the -ee2 option with
  exiftool -ee2 c:\temp\DJI_0001.SEQ
  This gives a long list, with all the information for every frame.
  Using the -T this normally gives a nice table - in combination with the
  -ee2 option it gives a long line.
  exiftool -ee2 -T c:\temp\DJI_0001.SEQ
  Is there an option to give it as a table view or can it only be done manually?

2. As far as I can see the -ee2 option can be combined with the -b option to extract the embedded data (is that correct?)
  exiftool -ee2 -b c:\temp\DJI_0001.SEQ >c:\temp\outputfile
  Is there a way to put each frame directly into a separate file (.fff or .tiff)?

Thanks and best regards.

StarGeek

Quote from: hcoj on November 18, 2022, 10:02:34 AMIs there an option to give it as a table view or can it only be done manually?

You can structure the output as you want using the -p (-printFormat) option, though it might be difficult if the length off the data isn't fairly standard.  Exiftool makes only 1 pass through the data, so it can't know about how long data is in files it hasn't processed yet.  You might also look into the -csv option, which you could then load into a spreadsheet program.

Ah, there is also the -h (-htmlFormat) option.  There's an option I've never linked before.  Though of course, you would have to view the data in a browser.

QuoteAs far as I can see the -ee2 option can be combined with the -b option to extract the embedded data (is that correct?)
  exiftool -ee2 -b c:\temp\DJI_0001.SEQ >c:\temp\outputfile
  Is there a way to put each frame directly into a separate file (.fff or .tiff)?

You would use the -W (-tagOut) option.  You can see an example in this post.  Even though that post deals with PDFs, the process is the same.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

hcoj

Hi,
thanks for your really fast reply. That helped me a lot further.

For the -W option:

To extract the frames I used now
exiftool -ee2 -b -W c:\temp\fff\%t%c.%s c:\temp\DJI_0001.SEQ
My testfile has 11 frames in total. The output is 757 files, one file for each tag/embedded information.

[...]
GPSLongitude.txt
GPSLongitude1.txt
GPSLongitude2.txt
[...]
GPSLongitude11.txt
[...]
RawThermalImage.tiff
RawThermalImage1.tiff
RawThermalImage2.tiff
[...]
RawThermalImage11.tiff
[...]

That's nearly good, though the .tiff files are all the same.
They are all the last frame. The txt files, for example the "GPSLogitude" or "DateTimeOriginal" differ though. They have the correct values as expected.

* Am I missing another option so the frames are not all the same?
* Why are there 12 files instead of 11 for each group (the additional file without number)?
* Can I omit the rest of the tags with some option, so I only get the RawThermalImage1-11.tiff and store them as image1-11.tiff?

Thanks for your help.

Phil Harvey

#3
Quote from: hcoj on November 18, 2022, 11:51:37 AMthe .tiff files are all the same.
They are all the last frame.

Wow.  Good point.  I'll fix this in 12.51, which should be released next week sometime.

If you are running the pure Perl version, you can patch this by changing this line in lib/Image/ExifTool/FLIR.pm:

        RawConv => '\$$self{RawThermalImage}',
to this:

        RawConv => 'my $copy = $$self{RawThermalImage}; \$copy',
- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

#4
...and to answer your other questions:

Quote from: hcoj on November 18, 2022, 11:51:37 AM* Why are there 12 files instead of 11 for each group (the additional file without number)?

Use %.nc instead of %c if you want to number all the files starting from 1.

Quote* Can I omit the rest of the tags with some option, so I only get the RawThermalImage1-11.tiff and store them as image1-11.tiff?

exiftool -ee2 -b -rawthermalimage -W c:\temp\fff\image%.nc.%s c:\temp\DJI_0001.SEQ

This will give image1-12.tiff

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

hcoj

Thanks Phil,

running the last line it does exactly what I wanted to do. I'll wait for the new version then to get the right images. Thanks.
For the numbering I was wrong, my testfile had 12 frames, so yes the numbering should go up to 12.

Regarding my other question to generate a file with the exif data:

Running the following line gives a text file with all the exif data in one file:
!exiftool -ee2 -n c:\temp\DJI_0001.SEQ >c:\temp\exif.txt
The output file looks like that:
ExifTool Version Number         : 12.50
File Name                       : DJI_0001.SEQ
Directory                       : c:/temp
File Size                       : 7902768
File Modification Date/Time     : 2022:05:19 16:48:22+02:00
File Access Date/Time           : 2022:11:21 04:57:23+01:00
File Creation Date/Time         : 2022:11:18 14:39:56+01:00
File Permissions                : 100666
File Type                       : SEQ
File Type Extension             : SEQ
MIME Type                       : image/x-flir-seq
Creator Software                : DJI
Raw Thermal Image Width         : 640
[...]
GPS Img Direction               : 0
GPS Map Datum                   : WGS84
Creator Software                : DJI
Raw Thermal Image Width         : 640
[...]
GPS Img Direction               : 0
GPS Map Datum                   : WGS84
Creator Software                : DJI
Raw Thermal Image Width         : 640
[... the same for the rest of the frames]
GPS Img Direction               : 0
GPS Map Datum                   : WGS84
Peak Spectral Sensitivity       : 10.0753862044818
GPS Position                    : 99.123456 99.123456

The two last lines (Peak Spectral Sensitivity and GPS Position) are only given for the last frame though they have the values of the first frame. (I changed the GPS Position value here). Extracting the frames manually and running exiftool on the .fff files these two fields exist in all frames.

The same happens when I use the tabular view:
!exiftool -ee2 -n -T c:\temp\DJI_0001.SEQ >c:\temp\exif2.txt(can the tabular view be generated in a more tabular way?)

Trying the .csv option the get the header naming it stops after the the first frame.
The last two fields are given though.
!exiftool -ee2 -n -csv c:\temp\DJI_0001.SEQ >c:\temp\exif3.csv
or
!exiftool -ee2 -n -csv -T c:\temp\DJI_0001.SEQ >c:\temp\exif4.csv

Using the -G4 option I get all frames (with the last two fields directly after the first frame, but only there)
!exiftool -ee2 -n -csv -G4 c:\temp\DJI_0001.SEQ >c:\temp\exif4.csv
Maybe hard to tell without the right .seq file?

Thanks and best regards.

Phil Harvey

The -csv option does not deal with embedded documents.

Use the -G3 option to see which frame the information comes from.  The PeakSpectralSensitivity and GPSPosition aren't coming from a frame.

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

hcoj

Hi,

The output...
[...]
[Main]          GPS Img Direction               : 0
[Main]          GPS Map Datum                   : WGS84
[Main]          Peak Spectral Sensitivity       : 10.0753862044818
[Main]          GPS Position                    : 99.123456 99.123456
[...Doc1 - Doc11]

So it's located under "Main".

What do you mean -csv doesn't handle embedded documents?
It works fine beside it gives everything in one long line instead putting all the same fields of the same type into the same column.

Thanks and best regards.


Phil Harvey

Yes, that's what I mean.  -csv puts everything on one line -- sub-documents don't get their own row.

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

hcoj

Perfect, thanks. That one line can be handled.

Another question:
Is it possible to get the raw .fff files as they are stored in the .seq file?

This gives me all the data already converted to tiff already:
exiftool -ee2 -b -rawthermalimage -W c:\temp\tiff\frame%.nc.%s c:\temp\DJI_0001.SEQ