How to edit "kMDItemXxx" file metadata on macOS?
The Spotlight system collects a variety of types of metadata about files. Some kinds of metadata are what I'd call &quot;superficial&quot;, and can be easily changed by changing the file properties; but some &quot;deeper&quot; ones depend on the contents of the file, and cannot be changed without significant changes to the file itself.
kMDItemFSName is an example of a &quot;superficial&quot; attribute -- it's just the filename, so renaming the file will change it. kMDItemBitsPerSample, on the other hand, is a property of the data in the file (it's the bit depth of an image or audio file). Changing kMDItemBitsPerSample would involve some sort of recoding of the image or audio file.
Mind you, there are some attributes that are in-between in superficiality. For example, mp3 files include metadata like the album name (kMDItemAlbum) and track number (kMDItemAudioTrackNumber) that are part of the file's contents, but can be edited (by some apps, like the old iTunes) without touching the audio content of the file.