Updated: 05.03.2017
Some random commands and one-liners that I use when dealing with missing photo metadata, video orientation etc.
ExifTool Command-Line Examples
Copy all metadata from original file to target file:
$ exiftool -TagsFromFile sourceimage.jpg targetimage.jpg
Copy photo DateTimeOriginal value to FileModifyDate:
$ exiftool "-fileModifyDate<DateTimeOriginal" targetimage.jpg
Copy DateTimeOriginal
value to FileModifyDate
:
$ for c in *.MP4; do exiftool "-fileModifyDate<CreateDate" "$c"; done
Copy CreateDate
value to FileModifyDate
(GoPro edition):
$ for c in *.MP4; do exiftool "-fileModifyDate<CreateDate" "$c"; done
Copy all video metadata from original file (.MOV) to target file (.mp4):
$ for c in *.MOV; do exiftool -tagsFromFile "$c" "${c%.MOV}.mp4"; done
Case where photo is missing dateTimeOriginal tag.
First copy FileModifyDate value to DateTimeOriginal:
$ for c in *.JPG; do exiftool "-dateTimeOriginal<fileModifyDate" "$c"; done
Then copy original value back to FileModifyDate:
$ for c in *.JPG; do exiftool "-fileModifyDate<DateTimeOriginal" "$c"; done
Find all portrait iPhone videos in current folder:
$ find . -name '*.mov' -exec bash -c '[ $(exiftool -s -s -s -Rotation "$1") == "90" ]' bash {} \; -print
Rotate video, portrait to landscape:
$ HandBrakeCLI -i source.mov -o target.mov --preset="High Profile" --rotate="angle=0:hflip=0"