News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Extract raw exif data for analysis by libexif

Started by RawJunkie, April 14, 2019, 07:25:19 AM

Previous topic - Next topic

RawJunkie

I would like to extend an existing C application to analyze the Exif data from video files. Up to now only JPEG files are examined what can be done directly by libexif functions.

Is it possible to extract the raw Exif data from (video) files with exiftool(1p) so that the data can be read by
ExifData* exif_data_new_from_data (const unsigned char *data, unsigned int size)?


https://libexif.github.io/api/exif-data_8h.html#66a30ece3bdb6cfd8f2692df27ea2b87

I have already tried to analyze the content of dsc0005.exif (see below) but libexif found no Exif entries in this data.

exiftool -b dsc0005.mov > dsc0005.exif

By the way, why do I get an empty output by the following command?

exiftool -exif -b dsc0005.mov > dsc0005.exif

Hayo Baan

The reason why you don't get any output in either is simply because there is no exif information in the file. Run exiftool -G0:1 dsc0005.mov to see what groups have information. Likely you'll only see QuickTime data.
Hayo Baan – Photography
Web: www.hayobaan.nl

RawJunkie

Many thanks for this hint. There is no Exif section indeed. But a lot of information is compiled in a different format within the video. Mainly, I am interested in the GPS data. I get for instance:

exiftool -G0:1 -a dsc0005.mov

(...)
[MakerNotes:GPS] GPS Altitude                   : 110.1 m
[MakerNotes:GPS] GPS Time Stamp                 : 09:34:45
(...)
[MakerNotes:GPS] GPS Map Datum                  : WGS84
[MakerNotes:GPS] GPS Date Stamp                 : 2015:11:28
(...)


For comparison, it follows the output of a JPEG file which can by analyzed by my application with libexif:

exiftool -G0:1 -a dsc0004.jpg

(...)
[EXIF:GPS]      GPS Altitude                    : 648 m
[EXIF:GPS]      GPS Time Stamp                  : 10:26:01
[EXIF:GPS]      GPS Date Stamp                  : 2015:01:12
(...)


So the existing C code cannot be applied to video files. :-\

Hayo Baan

Quote from: RawJunkie on April 14, 2019, 07:57:17 AM
So the existing C code cannot be applied to video files. :-\

No, you'll need to write additional code to be able to do so. But since you seem to be using exiftool from within the C code already, it should be doable to make use of exiftool to do the heavy lifting. In fact have you already had a look at the exiftool C++ interface?  Perhaps you can use that to do all/most of the work already.

Cheers,
Hayo
Hayo Baan – Photography
Web: www.hayobaan.nl