ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Milk and Coffee on October 14, 2024, 12:24:04 AM

Title: Failing to copy tags from a text file
Post by: Milk and Coffee on October 14, 2024, 12:24:04 AM
Hey all, I am trying to copy tags from a text file to all files in a folder and subfolders.

Context: I shoot RAW cinema DNG footage on my Sigma FP. This makes for massive amounts of DNG files (one for each frame at 24fps). The camera renders a different color matrix if I have a picture profile enabled in camera, vs. not having one enabled. This is giving me far different saturation, and hue shifts compared to clips shot with no picture profile enabled.

I'd like to copy certain tags from clips with no picture profile enabled, to clips shot with a picture profile enabled. I've extracted those tags to a text file (attached to this post), as well as binary data for some tags; as I'd like to keep this text file on my hard drive for future use. I also want the command to look in subfolders so I don't have to run it several times for each folder.

My command then, is as follows:
exiftool TagsFromFile @ -srcfile=/Users/xxxxxxx/Desktop/Sigma-FP-Picture-Mode-OFF-EXIF.txt -ext dng -overwrite_original -r target_folder /Volumes/Untitled
When running the command I get:
"Warning: Tag 'srcfile' is not defined".

So I modified the command to this:
exiftool TagsFromFile @ /Users/xxxxxxx/Desktop/Sigma-FP-Picture-Mode-OFF-EXIF.txt -ext dng -overwrite_original -r target_folder /Volumes/Untitled
It returns this message:
"5 directories scanned"
"498 image files read"

But no tags have been copied over to the files after checking. The metadata stays the same.

Can someone help me with my command?

Thanks all!
Title: Re: Failing to copy tags from a text file
Post by: StarGeek on October 14, 2024, 12:49:17 AM
Exiftool can't read data from a file formatted like that, which appears to be simple exiftool output.

If you want to output data in a form that exiftool can read back in, then you would use the -args (-argFormat) option (https://exiftool.org/exiftool_pod.html#args--argFormat). You would then use the -@ (Argfile) option (https://exiftool.org/exiftool_pod.html#ARGFILE) to read the commands in and write the data to the file.

A better choice would be to output the data as a CSV file or JSON file, make the changes, then read that back in. See the -csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE)/-j (-json) option (https://exiftool.org/exiftool_pod.html#j-JSONFILE--json) and FAQ #26, "How do I import information from a database?" (https://exiftool.org/faq.html#Q26).

Example, after editing your text file.
C:\>type Y:\!temp\x\y\Sigma-FP-Picture-Mode-OFF-EXIF.txt
-PictureMode=OFF
-ColorMatrix1=1.5405 -0.7307 -0.237 -1.1733 2.271 0.0503 0.0867 -0.3182 1.6491
-ColorMatrix2=1.5804 -0.7496 -0.2431 -0.9692 1.876 0.0415 0.0358 -0.1316 0.6819
-ProfileHueSatMapData1=<snipped>
-ProfileHueSatMapData2=<snipped>
-ProfileToneCurve=<snipped>

C:\>exiftool -P -overwrite_original -@ Y:\!temp\x\y\Sigma-FP-Picture-Mode-OFF-EXIF.txt y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -P -overwrite_original -PictureMode -ColorMatrix1 -ColorMatrix2 -ProfileHueSatMapData1 -ProfileHueSatMapData2 -ProfileToneCurve y:\!temp\Test4.jpg
Color Matrix 1                  : 1.5405 -0.7307 -0.237 -1.1733 2.271 0.0503 0.0867 -0.3182 1.6491
Color Matrix 2                  : 1.5804 -0.7496 -0.2431 -0.9692 1.876 0.0415 0.0358 -0.1316 0.6819
Profile Hue Sat Map Data 1      : (Binary data 431 bytes, use -b option to extract)
Profile Hue Sat Map Data 2      : (Binary data 431 bytes, use -b option to extract)
Profile Tone Curve              : (Binary data 4125 bytes, use -b option to extract)
Title: Re: Failing to copy tags from a text file
Post by: Milk and Coffee on October 14, 2024, 08:18:34 PM
Thank you StarGeek! If I use the args function, will it get the job done?
Title: Re: Failing to copy tags from a text file
Post by: StarGeek on October 15, 2024, 09:45:01 AM
You will have to test it to see if the results are what you need.
Title: Re: Failing to copy tags from a text file
Post by: Milk and Coffee on October 15, 2024, 10:16:59 PM
Okay so I've got it working just fine!

Updated:
exiftool -@ /Users/devonstanczyk/Desktop/Sigma-FP-Picture-Mode-OFF-EXIF.args /Volumes/Untitled/EXIF
args file is attached.

I do get an error: "Warning: [minor] Oversized IFD0 StripByteCounts (12551292 bytes, but expected 12551280)". From some googling, it seems I shouldn't worry about it?

I have noticed that the rendering of the updated images in my editing software (DaVinci Resolve) is different than before modifying, but they still do not match against their unmodified originals. The goal is to have them match.

After comparing metadata for differences between the original and updated images, I have noticed that after running my args file, it's seeming to change my "Strip Offsets" values from "78848" to "78742" even though my args file does not contain a change of this tag. What does this tag refer to? Is it causing the images not to match?
Title: Re: Failing to copy tags from a text file
Post by: Phil Harvey on October 15, 2024, 10:29:41 PM
Quote from: Milk and Coffee on October 15, 2024, 10:16:59 PMI do get an error: "Warning: [minor] Oversized IFD0 StripByteCounts (12551292 bytes, but expected 12551280)". From some googling, it seems I shouldn't worry about it?

Minor warnings may be ignored in general, but it is best to check the edited file to be sure it is still OK when read by your other software.

Quoteit's seeming to change my "Strip Offsets" values from "78848" to "78742" even though my args file does not contain a change of this tag.

FAQ 13 (https://exiftool.org/faq.html#Q13) explains this.

QuoteIs it causing the images not to match?

No, an offset change shouldn't be significant, except in the case of very poorly written software that doesn't parse the file properly.

- Phil
Title: Re: Failing to copy tags from a text file
Post by: Milk and Coffee on October 17, 2024, 12:27:15 AM
Thanks Phil!

I've noticed that when changing white balance to "as shot" in DaVinci resolve may not change the actual kelvin and tint values. So it is either normal behavior or a bug isolated in DaVinci Resolve. I've got my commands working.

Thanks Phil for such a useful working piece of software!
Title: Re: Failing to copy tags from a text file
Post by: Milk and Coffee on October 24, 2024, 11:56:51 PM
When I use
-b to extract binary data, I get many numbers.

Just to double check with you all; when copying these tags to other images, I need to list the raw binary data, correct?

Example binary extracted from a .DNG image. Tag is
-profiletonecurve
0 0 0.0123290996998549 0.00469970982521772 0.0247192401438951 0.0124511700123549 0.03704833984375 0.0266113299876451 0.0494384802877903 0.0441894493997097 0.0618286095559597 0.06341552734375 0.0741577222943306 0.0855712890625 0.0865478515625 0.1121826171875 0.098876953125 0.14031982421875 0.11126708984375 0.16796875 0.12359619140625 0.1943359375 0.135986328125 0.2213134765625 0.14837646484375 0.24700927734375 0.1607666015625 0.27093505859375 0.173095703125 0.29345703125 0.1854248046875 0.31549072265625 0.19781494140625 0.337158203125 0.210205078125 0.3585205078125 0.2225341796875 0.3800048828125 0.23492431640625 0.4017333984375 0.247314453125 0.4237060546875 0.25860595703125 0.44403076171875 0.26983642578125 0.46435546875 0.281005859375 0.48455810546875 0.29205322265625 0.50439453125 0.302978515625 0.52117919921875 0.3138427734375 0.53759765625 0.32452392578125 0.553466796875 0.335205078125 0.5689697265625 0.34576416015625 0.5841064453125 0.35614013671875 0.5986328125 0.36651611328125 0.6129150390625 0.3768310546875 0.62677001953125 0.386962890625 0.64019775390625 0.39703369140625 0.65325927734375 0.40692138671875 0.66583251953125 0.41680908203125 0.67816162109375 0.42657470703125 0.69012451171875 0.43621826171875 0.70166015625 0.44580078125 0.712890625 0.45526123046875 0.7237548828125 0.46673583984375 0.7366943359375 0.47821044921875 0.749267578125 0.48974609375 0.76153564453125 0.501220703125 0.77349853515625 0.51275634765625 0.78515625 0.5242919921875 0.79644775390625 0.5357666015625 0.80767822265625 0.54730224609375 0.81842041015625 0.558837890625 0.8287353515625 0.5704345703125 0.8385009765625 0.58197021484375 0.8477783203125 0.593505859375 0.8565673828125 0.6051025390625 0.8648681640625 0.61663818359375 0.87274169921875 0.62823486328125 0.88018798828125 0.6397705078125 0.88720703125 0.65142822265625 0.89385986328125 0.6629638671875 0.9000244140625 0.67462158203125 0.9058837890625 0.68621826171875 0.91131591796875 0.69439697265625 0.9158935546875 0.702392578125 0.9202880859375 0.7103271484375 0.924560546875 0.7181396484375 0.9285888671875 0.725830078125 0.93255615234375 0.73345947265625 0.93634033203125 0.74090576171875 0.94036865234375 0.748291015625 0.9442138671875 0.75555419921875 0.9478759765625 0.76275634765625 0.9512939453125 0.769775390625 0.9544677734375 0.7767333984375 0.95745849609375 0.7835693359375 0.9603271484375 0.79034423828125 0.96295166015625 0.79693603515625 0.9654541015625 0.803466796875 0.9677734375 0.80987548828125 0.96990966796875 0.816162109375 0.971923828125 0.82232666015625 0.97381591796875 0.82843017578125 0.9755859375 0.83441162109375 0.9771728515625 0.84027099609375 0.979736328125 0.84600830078125 0.98199462890625 0.8516845703125 0.9840087890625 0.857177734375 0.98577880859375 0.86260986328125 0.9874267578125 0.86798095703125 0.9888916015625 0.8731689453125 0.99017333984375 0.8782958984375 0.99139404296875 0.88330078125 0.992431640625 0.88818359375 0.993408203125 0.8929443359375 0.99420166015625 0.89764404296875 0.9949951171875 0.9022216796875 0.99566650390625 0.90667724609375 0.99627685546875 0.9110107421875 0.996826171875 0.91522216796875 0.997314453125 0.91937255859375 0.99774169921875 0.92340087890625 0.9981689453125 0.92730712890625 0.99853515625 0.9296875 0.99871826171875 0.934814453125 0.9989013671875 0.93841552734375 0.9990234375 0.94189453125 0.9991455078125 0.94525146484375 0.999267578125 0.94854736328125 0.9993896484375 0.95172119140625 0.99945068359375 0.95477294921875 0.99951171875 0.95770263671875 0.99957275390625 0.96051025390625 0.9996337890625 0.9632568359375 0.9996337890625 0.96588134765625 0.99969482421875 0.9683837890625 0.99969482421875 0.97076416015625 0.99969482421875 0.97308349609375 0.99969482421875 0.97528076171875 0.999755859375 0.97735595703125 0.999755859375 0.97930908203125 0.999755859375 0.98114013671875 0.999755859375 0.98291015625 0.99981689453125 0.98455810546875 0.99981689453125 0.986083984375 0.99981689453125 0.987548828125 0.99981689453125 0.98883056640625 0.9998779296875 0.99005126953125 0.9998779296875 0.99114990234375 0.9998779296875 1 1
Title: Re: Failing to copy tags from a text file
Post by: Phil Harvey on October 25, 2024, 07:00:11 AM
No, you don't need to use -b when copying tags.

- Phil
Title: Re: Failing to copy tags from a text file
Post by: Milk and Coffee on October 25, 2024, 01:00:57 PM
Thank you! I only used -b to extract the binary data once. My final command does not include -b. It includes the long list of binary data. That's the way to copy the binary correct?
Title: Re: Failing to copy tags from a text file
Post by: Phil Harvey on October 25, 2024, 02:39:18 PM
I can answer that if you show me the command you are using

- Phil
Title: Re: Failing to copy tags from a text file
Post by: Milk and Coffee on October 25, 2024, 07:07:54 PM
This is the terminal command: exiftool -@ /Users/devonstanczyk/Desktop/EXIFTool-Sigma-FP-Picture-Mode-OFF.args /Volumes/Untitled/Cinema
Attached is the .args file it's referencing.
Title: Re: Failing to copy tags from a text file
Post by: Phil Harvey on October 26, 2024, 07:50:38 AM
I see.  You're not copying a tag, you're assigning a new tag value.  This will work fine but if you are using the value of a tag from another file it may be easier to copy it using -tagsFromFile

- Phil
Title: Re: Failing to copy tags from a text file
Post by: Milk and Coffee on October 26, 2024, 11:42:13 PM
Thanks Phil!