Adding tags to JPG files that correspond to WAV with same name

Started by BrentTT, July 06, 2022, 09:48:28 PM

Previous topic - Next topic

BrentTT

I have a new camera that can attach a voice memo to an image.  Windows Photo Gallery does not show WAV files.  I have found a way around this.  I can use "Open With ..." on a JPG that points at a batch file that will open a WAV file instead of the JPG.  But I need a way to make the JPG aware that a WAV file of the same name exists.  So I am writing a batch file that will import the pictures from the camera and write a few tags to the JPGs with associated WAV files (XPKeywords=Sound, XPComment=Sound).

I thought something like this might work, but it can't find the WAV file.
exiftool XPKeywords=Sound %d%f.WAV -ext JPG -r

I also thought if a list of all the WAV files were made I could use that to write the tags to the JPG files could work.  But I am not sure how to make this work either.

I could use Visual Studio and do a bunch of string manipulations, but I could save time to there was a easy way to do it in ExifTool.

Thanks for any help, cheers, Brent


StarGeek

Are you trying to set XPKeywords equal to "Sound" or "Sound /path/to/file.wav" ?

Assuming the latter, try this
exiftool -r -ext Jpg -TagsFromFile %d%f.wav "-XPkeywords<Sound $Filepath" /path/to/files/

You'll get an error in cases were there isn't a matching wav file, but this can be ignored.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

BrentTT

I wanted the XPKeywords to equal Sound.

I tried the line:
c:\exiftool -r -ext jpg -TagsFromFile %d%f.wav "-XPKeywords=Sound" "C:\My Pictures\2022\06\2022-06-25 D Atlas Stuff"

The result was the string "Sound " written to the tag "XPKeywords" was written to all the JPG files in the directory instead of only the JPG files that have a corresponding WAV file of the same name.
Also it created a whole bunch of files with an extension JPG_original and put up errors for WAV files that don't exist.

Phil Harvey

You need to copy a tag from the .wav file if you want it to only get written if the file exists.  But there is a better way to do it:  Run the command on the .wav files but process the corresponding .jpg

exiftool -r -ext wav -xpkeywords=Sound -srcfile %d%f.jpg DIR

Add -overwrite_original to prevent saving the .jpg_original files.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).