I'm using exiftool to fix metadata on some of my photos from Google Takeout using the JSON metadata file they provide. Overall it works really well, but I noticed I was getting errors on certain files.
For reference, this is the command I am running:
exiftool -d "%s" -tagsfromfile %d%f.%e.json "-DateTimeOriginal<PhotoTakenTimeTimestamp" "-FileCreateDate<PhotoTakenTimeTimestamp" "-FileModifyDate<PhotoTakenTimeTimestamp" -overwrite_original -ext mp4 -ext jpg -ext heic -ext mov -ext jpeg -ext png -ext gif -ext webp -r <filename> -progress
I noticed that for some of the images I get this error:
======== IMG_20240716_114215_778.jpg [1/1]
Error: Not a valid JPG (looks more like a RIFF) - IMG_20240716_114215_778.jpg
0 image files updated
1 files weren't updated due to errors
Error: Not a valid JPG (looks more like a RIFF) - IMG_20240720_184642_988.jpg
0 image files updated
1 files weren't updated due to errors
I'm not sure what a RIFF is, but is there any way to bypass this error and update the file with the metadata from the JSON anyways?
You can't bypass this, as treating a RIFF file type as a JPEG would irrevocably corrupt it.
RIFF covers a variety of file types, most notably WEBP, WAV and AVI files. You need to figure out the file type and rename it with the correct extension. And you probably have to rename the matching JSON file as well.
Once that is done, if it's a file type exiftool can edit (WebP), then the command would work correctly.
Thanks for the info, I had never seen a RIFF file type before so I was confused.
Do you know if its possible to figure out the correct file type extension with exiftool? I'm not sure if there is metadata property which encodes the correct file type.
Try
exiftool -filetype /path/to/files/
exiftool -filetype IMG_20240716_114215_778.jpg
File Type : Extended WEBP
Does this mean just renaming it to end in .webp should do the trick? And updating the associated JSON file to match?
Yes.