Skip to content

Instantly share code, notes, and snippets.

@farshidhss
Created September 6, 2020 11:16
Show Gist options
  • Save farshidhss/d0a725c8b98900af1d59f0ada3e81ec8 to your computer and use it in GitHub Desktop.
Save farshidhss/d0a725c8b98900af1d59f0ada3e81ec8 to your computer and use it in GitHub Desktop.
Add filename to the title metadata for all video files in a directory
#!/usr/local/bin/zsh
for entry in *."$1"
do
Filename=${entry%.*}
echo "setting title -> " $Filename
FileTitle=$(exiftool -s -Title "$entry" | awk '{print $3}');
echo "file title: " $FileTitle
if [ "$FileTitle" = "$Filename" ]; then
echo "File title is the same as filename, skipping..."
else
exiftool -P -overwrite_original -Title="$Filename" $entry
fi
done
@farshidhss
Copy link
Author

farshidhss commented Sep 6, 2020

This needs exiftool which can be downloaded from https://exiftool.org/
Call this file inside a folder with all your video files with the extension of the files. For example, if extension is mp4 then run:
-> ./setTitleFromFilename.sh mp4

Should also work for any other type of file that has Title in metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment