drewnoakes / metadata-extractor

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Apache License 2.0
2.59k stars 480 forks source link

Support for Samsung Trailer Tags #319

Open oneroman opened 6 years ago

oneroman commented 6 years ago

Hi there,

I would like to read Samsung specific tag from the attached photo captured by Samsung Galaxy S8 smartphone. The issue that ExifTool is able to read them and shows as:

screen shot 2018-01-30 at 10 02 45 am

But when I call getDirectories() then I could not find that Samsung directory, therefore I am not able to read all those tags.

Please guide me how to solve my issue if that's possible.

drewnoakes commented 6 years ago

What exactly did you want to read from the above? The binary data?

Here are some details of ExifTool's support for Samsung-specific data:

This library does have some support for Samsung makernotes, though they are not found in this image:

[JPEG] Compression Type = Baseline
[JPEG] Data Precision = 8 bits
[JPEG] Image Height = 3024 pixels
[JPEG] Image Width = 4032 pixels
[JPEG] Number of Components = 3
[JPEG] Component 1 = Y component: Quantization table 0, Sampling factors 2 horiz/2 vert
[JPEG] Component 2 = Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
[JPEG] Component 3 = Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert
[JFIF] Version = 1.1
[JFIF] Resolution Units = centimetre
[JFIF] X Resolution = 59 dots
[JFIF] Y Resolution = 59 dots
[JFIF] Thumbnail Width Pixels = 0
[JFIF] Thumbnail Height Pixels = 0
[Exif IFD0] Image Width = 4032 pixels
[Exif IFD0] Image Height = 3024 pixels
[Exif IFD0] Make = samsung
[Exif IFD0] Model = SM-G950F
[Exif IFD0] Orientation = Right side, top (Rotate 90 CW)
[Exif IFD0] X Resolution = 72 dots per inch
[Exif IFD0] Y Resolution = 72 dots per inch
[Exif IFD0] Resolution Unit = Inch
[Exif IFD0] Software = G950FXXU1AQL5
[Exif IFD0] Date/Time = 2018:01:30 09:55:19
[Exif IFD0] YCbCr Positioning = Center of pixel array
[Exif SubIFD] Exposure Time = 1/40 sec
[Exif SubIFD] F-Number = f/1.7
[Exif SubIFD] Exposure Program = Program normal
[Exif SubIFD] ISO Speed Ratings = 200
[Exif SubIFD] Exif Version = 2.20
[Exif SubIFD] Date/Time Original = 2018:01:30 09:55:19
[Exif SubIFD] Date/Time Digitized = 2018:01:30 09:55:19
[Exif SubIFD] Max Aperture Value = f/1.7
[Exif SubIFD] Metering Mode = Center weighted average
[Exif SubIFD] Flash = Flash did not fire
[Exif SubIFD] Focal Length = 4.2 mm
[Exif SubIFD] Makernote = [98 values]
[Exif SubIFD] Color Space = sRGB
[Exif SubIFD] Exif Image Width = 4032 pixels
[Exif SubIFD] Exif Image Height = 3024 pixels
[Exif SubIFD] Exposure Mode = Auto exposure
[Exif SubIFD] White Balance Mode = Auto white balance
[Exif SubIFD] Focal Length 35 = 26 mm
[Exif SubIFD] Scene Capture Type = Unknown (4)
[Exif SubIFD] Unique Image ID = F12LLJA00VM F12LLKG01GM

[Huffman] Number of Tables = 4 Huffman tables
[File Type] Detected File Type Name = JPEG
[File Type] Detected File Type Long Name = Joint Photographic Experts Group
[File Type] Detected MIME Type = image/jpeg
[File Type] Expected File Name Extension = jpg
[File] File Name = Samsung SM-G950F (Galaxy S8).jpg
[File] File Size = 22965268 bytes
[File] File Modified Date = Tue Jan 30 18:40:43 +00:00 2018

The fact that [Exif SubIFD] Makernote = [98 values] is shown means that the makernote was not decoded. That would be where I'd start my investigation.

Your screenshot suggests the Samsung Trailer Tags section is present and available for decoding (maybe via the makernote, maybe in a different JPEG segment), though it would give access to potentially large binary blobs. We've decided that such blobs shouldn't be loaded into memory in the general case. Until we have a way to support extracting these embedded data blobs, the best we would do would be to print out the number of bytes present in the file.

oneroman commented 6 years ago

@drewnoakes thanks for the info.

I do not want to read blob data, I wish to know value for Samsung Trailer name tag. So, do you recommend me to move forward with adding new parsing logic into Samsung marketnote if I want to read that info?

drewnoakes commented 6 years ago

Sounds like a good place to start. I wouldn't reuse the same directory. Instead, try to work out whether those 98 bytes contain the data you need (seems likely) and then look at ExifTiffHandler and work out what's needed to correctly parse out the data. There are plenty of examples there to help you get started, though it's quite a large file unfortunately.

oneroman commented 6 years ago

@drewnoakes I have found that my captured photos have cameraMake tag with lower case, therefore that line has false value and SamsungType2MakernoteDirectory is not involved in the process at all.