Last active
September 14, 2022 12:26
-
-
Save tralston/4b8779e016a49ed73ba3466ae319e143 to your computer and use it in GitHub Desktop.
[Change video/photo timestamp to date recorded or taken]
This file contains hidden or 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
# For mp4, the recorded date can exist as Recorded date or Tagged date. If you want to do this for all the files in a folder, use the following command: | |
for file in *.mp4; do touch -t "$(mediainfo "$file" | grep --color=never -iEm 1 '(Recorded date|Tagged date)' | sed -r 's/.*([0-9]{4})-([0-9]{2})-([0-9]{2})[T ]([0-9]{2}):([0-9]{2}):([0-9]{2}).*/\1\2\3\4\5.\6/')" "$file"; done | |
# Some videos will not have that date in the metadata, so you'll have to correct it yourself | |
touch -t CCYYMMDDHHMM[.ss] file.ext |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment