0

I'm using ExifTool on Linux and am working with some MP4 video files. I want to add each file's respective filename as a metadata comment (using the -Comment tag). For example, suppose I have a file called winter.mp4, I want to add the comment "winter" to the file's -Comment metadata tag. Notice that the comment does not include the file's extension (i.e., it doesn't include the .mp4).

How can I accomplish this?

I tried using the command exiftool '-Comment<FileName' 'winter.mp4' but this includes the ".mp4" extension, so I see the -Comment tag populated with "winter.mp4", instead of just "winter". I tried looking for a solution online, but to no avail.

1 Answer 1

1

Make sure you're using exiftool ver 12.22+ and change Filename to BaseName.

exiftool '-Comment<BaseName' winter.mp4

If you have to use an older version, you can use regex to remove the extension

exiftool '-Comment<${Filename;s/\.[^\.]+$//}' winter.mp4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .