ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: banana123 on October 04, 2023, 04:02:32 AM

Title: Copy MakerNotes tag
Post by: banana123 on October 04, 2023, 04:02:32 AM
Hi
I have difficult time copying MakerNotes tags from one image to another.
I tried using the command exiftool -tagsfromfile image_with_makernotes_tag.jpg -makernotes:timestamp -all:all image_without_makernotes_tag.jpgbut it didnt work.

i also tried exiftool -tagsfromfile source.jpg -makernotes -all:all target.jpg
but it eneded up copying all metadata except makernotes.
Tried both cmd command and Python ExfiTool

Any help here?

thanks!
Title: Re: Copy MakerNotes tag
Post by: greybeard on October 04, 2023, 08:45:45 AM
Have you read FAQ #8?

https://exiftool.org/faq.html#Q8

Maybe:

exiftool -tagsfromfile src.jpg -makernotes -make -model dst.jpg

Otherwise posting some sample files would help
Title: Re: Copy MakerNotes tag
Post by: banana123 on October 04, 2023, 10:32:52 AM
Quote from: greybeard on October 04, 2023, 08:45:45 AMHave you read FAQ #8?

https://exiftool.org/faq.html#Q8

Maybe:

exiftool -tagsfromfile src.jpg -makernotes -make -model dst.jpg

Otherwise posting some sample files would help


sure
tried that command (sorry for not mentioning).
It copies the make and model only, without the makernotes.


Title: Re: Copy MakerNotes tag
Post by: StarGeek on October 04, 2023, 11:01:45 AM
It's a Samsung trailer.  It's not located within the EXIF block where it should be, it has been appended to the end of the file.

<insert rant about companies not following standards here>

Use
exiftool -TagsFromFile source.jpg -Trailer target.jpg

Example
C:\>exiftool -P -overwrite_original -Samsung:all Y:\!temp\x\y\image_with_makernotes_tag.jpg Y:\!temp\x\y\test.jpg
======== Y:/!temp/x/y/image_with_makernotes_tag.jpg
Time Stamp                      : 2023:09:23 21:54:15.249-07:00
======== Y:/!temp/x/y/test.jpg
    2 image files read

C:\>exiftool -P -overwrite_original -TagsFromFile Y:\!temp\x\y\image_with_makernotes_tag.jpg -trailer Y:\!temp\x\y\test.jpg
    1 image files updated

C:\>exiftool -P -overwrite_original -Samsung:all Y:\!temp\x\y\image_with_makernotes_tag.jpg Y:\!temp\x\y\test.jpg
======== Y:/!temp/x/y/image_with_makernotes_tag.jpg
Time Stamp                      : 2023:09:23 21:54:15.249-07:00
======== Y:/!temp/x/y/test.jpg
Time Stamp                      : 2023:09:23 21:54:15.249-07:00
Title: Re: Copy MakerNotes tag
Post by: banana123 on October 04, 2023, 11:12:23 AM
Quote from: StarGeek on October 04, 2023, 11:01:45 AMIt's a Samsung trailer.  It's not located within the EXIF block where it should be, it has been appended to the end of the file.

<insert rant about companies not following standards here>

Use
exiftool -TagsFromFile source.jpg -Trailer target.jpg

Example
C:\>exiftool -P -overwrite_original -Samsung:all Y:\!temp\x\y\image_with_makernotes_tag.jpg Y:\!temp\x\y\test.jpg
======== Y:/!temp/x/y/image_with_makernotes_tag.jpg
Time Stamp                      : 2023:09:23 21:54:15.249-07:00
======== Y:/!temp/x/y/test.jpg
    2 image files read

C:\>exiftool -P -overwrite_original -TagsFromFile Y:\!temp\x\y\image_with_makernotes_tag.jpg -trailer Y:\!temp\x\y\test.jpg
    1 image files updated

C:\>exiftool -P -overwrite_original -Samsung:all Y:\!temp\x\y\image_with_makernotes_tag.jpg Y:\!temp\x\y\test.jpg
======== Y:/!temp/x/y/image_with_makernotes_tag.jpg
Time Stamp                      : 2023:09:23 21:54:15.249-07:00
======== Y:/!temp/x/y/test.jpg
Time Stamp                      : 2023:09:23 21:54:15.249-07:00


wow you are greats! thanks a lot!
how did you find that the makernote data is a trailer?
how can i detect the makernote independently in a bytes stream or hex representation?
Title: Re: Copy MakerNotes tag
Post by: StarGeek on October 04, 2023, 11:28:17 AM
Quote from: banana123 on October 04, 2023, 11:12:23 AMhow did you find that the makernote data is a trailer?

I didn't.  The issue has come up before and Phil gave a solution.  I simply filed it away in my notes for the next time it comes up.

Quotehow can i detect the makernote independently in a bytes stream or hex representation?

You can add the -v3 (-verbose3) option (https://exiftool.org/exiftool_pod.html#v-NUM--verbose) to your command and exiftool will print out a lot more details.  For example, a snippet from your file.  JPEG EOI stands for End of Image
JPEG SOS
JPEG RST0
JPEG RST1
JPEG RST2
JPEG EOI
Samsung trailer (174 bytes at offset 0x194716):
  194716: 00 00 01 0a 0e 00 00 00 49 6d 61 67 65 5f 55 54 [........Image_UT]
  194726: 43 5f 44 61 74 61 31 36 39 35 35 33 31 32 35 35 [C_Data1695531255]
  194736: 32 34 39 00 00 61 0c 18 00 00 00 43 61 6d 65 72 [249..a.....Camer]
  194746: 61 5f 43 61 70 74 75 72 65 5f 4d 6f 64 65 5f 49 [a_Capture_Mode_I]
  194756: 6e 66 6f 31 00 00 10 09 15 00 00 00 46 72 6f 6e [nfo1........Fron]
  194766: 74 5f 43 61 6d 5f 53 65 6c 66 69 65 5f 49 6e 66 [t_Cam_Selfie_Inf]
  194776: 6f 46 72 6f 6e 74 5f 43 61 6d 5f 53 65 6c 66 69 [oFront_Cam_Selfi]
  194786: 65 5f 49 6e 66 6f 53 45 46 48 6b 00 00 00 03 00 [e_InfoSEFHk.....]
  194796: 00 00 00 00 01 0a 76 00 00 00 23 00 00 00 00 00 [......v...#.....]
  1947a6: 61 0c 53 00 00 00 21 00 00 00 00 00 10 09 32 00 [a.S...!.......2.]
  1947b6: 00 00 32 00 00 00 30 00 00 00 53 45 46 54      [..2...0...SEFT]
  SamsungTrailer_0x0a01Name = Image_UTC_Data
  - Tag '0x0a01-name' (14 bytes):
    19471e: 49 6d 61 67 65 5f 55 54 43 5f 44 61 74 61      [Image_UTC_Data]
  TimeStamp = 1695531255249
  - Tag '0x0a01' (13 bytes):
    19472c: 31 36 39 35 35 33 31 32 35 35 32 34 39          [1695531255249]
  SamsungTrailer_0x0c61Name = Camera_Capture_Mode_Info
  - Tag '0x0c61-name' (24 bytes):
    194741: 43 61 6d 65 72 61 5f 43 61 70 74 75 72 65 5f 4d [Camera_Capture_M]
    194751: 6f 64 65 5f 49 6e 66 6f                        [ode_Info]
  SamsungTrailer_0x0c61 = 1
  - Tag '0x0c61' (1 bytes):
    194759: 31                                              [1]
  SamsungTrailer_0x0910Name = Front_Cam_Selfie_Info
  - Tag '0x0910-name' (21 bytes):
    194762: 46 72 6f 6e 74 5f 43 61 6d 5f 53 65 6c 66 69 65 [Front_Cam_Selfie]
    194772: 5f 49 6e 66 6f                                  [_Info]
  SamsungTrailer_0x0910 = Front_Cam_Selfie_Info
  - Tag '0x0910' (21 bytes):
    194777: 46 72 6f 6e 74 5f 43 61 6d 5f 53 65 6c 66 69 65 [Front_Cam_Selfie]
    194787: 5f 49 6e 66 6f                                  [_Info]/code]
Title: Re: Copy MakerNotes tag
Post by: banana123 on October 04, 2023, 01:13:50 PM
Quote from: StarGeek on October 04, 2023, 11:28:17 AM
Quote from: banana123 on October 04, 2023, 11:12:23 AMhow did you find that the makernote data is a trailer?

I didn't.  The issue has come up before and Phil gave a solution.  I simply filed it away in my notes for the next time it comes up.

Quotehow can i detect the makernote independently in a bytes stream or hex representation?

You can add the -v3 (-verbose3) option (https://exiftool.org/exiftool_pod.html#v-NUM--verbose) to your command and exiftool will print out a lot more details.  For example, a snippet from your file.  JPEG EOI stands for End of Image
JPEG SOS
JPEG RST0
JPEG RST1
JPEG RST2
JPEG EOI
Samsung trailer (174 bytes at offset 0x194716):
  194716: 00 00 01 0a 0e 00 00 00 49 6d 61 67 65 5f 55 54 [........Image_UT]
  194726: 43 5f 44 61 74 61 31 36 39 35 35 33 31 32 35 35 [C_Data1695531255]
  194736: 32 34 39 00 00 61 0c 18 00 00 00 43 61 6d 65 72 [249..a.....Camer]
  194746: 61 5f 43 61 70 74 75 72 65 5f 4d 6f 64 65 5f 49 [a_Capture_Mode_I]
  194756: 6e 66 6f 31 00 00 10 09 15 00 00 00 46 72 6f 6e [nfo1........Fron]
  194766: 74 5f 43 61 6d 5f 53 65 6c 66 69 65 5f 49 6e 66 [t_Cam_Selfie_Inf]
  194776: 6f 46 72 6f 6e 74 5f 43 61 6d 5f 53 65 6c 66 69 [oFront_Cam_Selfi]
  194786: 65 5f 49 6e 66 6f 53 45 46 48 6b 00 00 00 03 00 [e_InfoSEFHk.....]
  194796: 00 00 00 00 01 0a 76 00 00 00 23 00 00 00 00 00 [......v...#.....]
  1947a6: 61 0c 53 00 00 00 21 00 00 00 00 00 10 09 32 00 [a.S...!.......2.]
  1947b6: 00 00 32 00 00 00 30 00 00 00 53 45 46 54      [..2...0...SEFT]
  SamsungTrailer_0x0a01Name = Image_UTC_Data
  - Tag '0x0a01-name' (14 bytes):
    19471e: 49 6d 61 67 65 5f 55 54 43 5f 44 61 74 61      [Image_UTC_Data]
  TimeStamp = 1695531255249
  - Tag '0x0a01' (13 bytes):
    19472c: 31 36 39 35 35 33 31 32 35 35 32 34 39          [1695531255249]
  SamsungTrailer_0x0c61Name = Camera_Capture_Mode_Info
  - Tag '0x0c61-name' (24 bytes):
    194741: 43 61 6d 65 72 61 5f 43 61 70 74 75 72 65 5f 4d [Camera_Capture_M]
    194751: 6f 64 65 5f 49 6e 66 6f                        [ode_Info]
  SamsungTrailer_0x0c61 = 1
  - Tag '0x0c61' (1 bytes):
    194759: 31                                              [1]
  SamsungTrailer_0x0910Name = Front_Cam_Selfie_Info
  - Tag '0x0910-name' (21 bytes):
    194762: 46 72 6f 6e 74 5f 43 61 6d 5f 53 65 6c 66 69 65 [Front_Cam_Selfie]
    194772: 5f 49 6e 66 6f                                  [_Info]
  SamsungTrailer_0x0910 = Front_Cam_Selfie_Info
  - Tag '0x0910' (21 bytes):
    194777: 46 72 6f 6e 74 5f 43 61 6d 5f 53 65 6c 66 69 65 [Front_Cam_Selfie]
    194787: 5f 49 6e 66 6f                                  [_Info]/code]

Been trying to find it all day, across the forum also, but couldn't find anything..

Can I edit the makernotes data?
Maybe open the image binary and find it somehow would be a great deal

Anyway thanks again for your help, I'm learning a lot!
Title: Re: Copy MakerNotes tag
Post by: StarGeek on October 04, 2023, 01:50:12 PM
Quote from: banana123 on October 04, 2023, 01:13:50 PMBeen trying to find it all day, across the forum also, but couldn't find anything..

Part of the problem is knowing what are the correct words to search for.  The search function in most forums (this one and others) usually aren't great and it doesn't help at all that Google does an absolute shit job of indexing this forum.  I get better results using Bing (who would have thought?) and Yandex using the Site:exiftool.org keyword.

QuoteCan I edit the makernotes data?

It depends.  Some can be and some can't.  Unfortunately, none of the Samsung Trailer MakerNotes (https://exiftool.org/TagNames/Samsung.html#Trailer) can be edited.  But overall, it doesn't matter because the exiftool and exiv2 (I'm assuming) are about the only programs that will be able to read them in the first place.
Title: Re: Copy MakerNotes tag
Post by: banana123 on October 05, 2023, 04:53:44 AM
Quote from: StarGeek on October 04, 2023, 01:50:12 PM
Quote from: banana123 on October 04, 2023, 01:13:50 PMBeen trying to find it all day, across the forum also, but couldn't find anything..

Part of the problem is knowing what are the correct words to search for.  The search function in most forums (this one and others) usually aren't great and it doesn't help at all that Google does an absolute shit job of indexing this forum.  I get better results using Bing (who would have thought?) and Yandex using the Site:exiftool.org keyword.

QuoteCan I edit the makernotes data?

It depends.  Some can be and some can't.  Unfortunately, none of the Samsung Trailer MakerNotes (https://exiftool.org/TagNames/Samsung.html#Trailer) can be edited.  But overall, it doesn't matter because the exiftool and exiv2 (I'm assuming) are about the only programs that will be able to read them in the first place.

Do you where i can find what i can or cannot edit?

And another question if you dont mind;
Do you know how can i detect the makernotes segment in the image file?
Maybe the header name or bytes representation?
Title: Re: Copy MakerNotes tag
Post by: greybeard on October 05, 2023, 09:57:09 AM
Quote from: banana123 on October 05, 2023, 04:53:44 AMDo you where i can find what i can or cannot edit?

Its in the online documentation - follow the link StarGeek included in his answer - if it shows Writable as "no" then you can't edit the tag

https://exiftool.org/TagNames/Samsung.html#Trailer
Title: Re: Copy MakerNotes tag
Post by: StarGeek on October 05, 2023, 10:56:39 AM
Quote from: banana123 on October 05, 2023, 04:53:44 AMDo you where i can find what i can or cannot edit?

All 26,993 tags that exiftool knows can be found through the Tags Names page (https://exiftool.org/TagNames/).  On each subpage it lists whether a tag can be written to or not.  I tend to use the Tag Names PDF (https://exiftool.org/TagNames.pdf) as it lists all the tags and is easier to do a search on.

QuoteDo you know how can i detect the makernotes segment in the image file?

Using exiftool, you can use
exiftool -if "$MakerNotes" -MakerNotes:all /path/to/files/
Change the double quotes to single quotes on Mac/Linux

QuoteMaybe the header name or bytes representation?

Using exiftool, you can look at the format using the -v3 option shown above.  If your planning on programming something yourself, then you'll have to read the EXIF standard.  There's  link to the standard on the EXIF Tags page (https://exiftool.org/TagNames/EXIF.html).  But this doesn't cover things that don't follow the standard, such as these Samsung trailer MakerNotes.
Title: Re: Copy MakerNotes tag
Post by: banana123 on October 09, 2023, 07:33:54 AM
Quote from: StarGeek on October 05, 2023, 10:56:39 AM
Quote from: banana123 on October 05, 2023, 04:53:44 AMDo you where i can find what i can or cannot edit?

All 26,993 tags that exiftool knows can be found through the Tags Names page (https://exiftool.org/TagNames/).  On each subpage it lists whether a tag can be written to or not.  I tend to use the Tag Names PDF (https://exiftool.org/TagNames.pdf) as it lists all the tags and is easier to do a search on.

QuoteDo you know how can i detect the makernotes segment in the image file?

Using exiftool, you can use
exiftool -if "$MakerNotes" -MakerNotes:all /path/to/files/
Change the double quotes to single quotes on Mac/Linux

QuoteMaybe the header name or bytes representation?

Using exiftool, you can look at the format using the -v3 option shown above.  If your planning on programming something yourself, then you'll have to read the EXIF standard.  There's  link to the standard on the EXIF Tags page (https://exiftool.org/TagNames/EXIF.html).  But this doesn't cover things that don't follow the standard, such as these Samsung trailer MakerNotes.

Thanks a lot my friend!
I learned a lot from you, will implement it shortly.