Created
September 6, 2020 11:16
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.