Created
November 24, 2016 20:24
-
-
Save thinkerbot/926c10b9811b4b067d55fbd07b74f343 to your computer and use it in GitHub Desktop.
Google Uploader
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
#!/bin/bash | |
# Google Uploader looks at a file timestamp not the video metadata. Run | |
# this to get the right timestamp to appear on the video. Requires | |
# exiftool. https://productforums.google.com/forum/#!topic/photos/oj96JZK14Fs | |
# | |
# brew install exiftool | |
# ./fix_timestamps.sh | |
# | |
cd "DIR_WITH_THE_m4v_VIDEO_FILES" | |
ruby -rtime -ryaml -rshellwords -e ' | |
files = ARGV.dup | |
ARGV.clear | |
metadata = `exiftool -j #{Shellwords.shelljoin(files)}` | |
data = YAML.load(metadata) | |
files.zip(data).each do |file, data| | |
rawdate, rawtime = data["CreationDate"].split(" ") | |
creation_date = Time.parse "#{rawdate.tr(":", "/")}T#{rawtime}" | |
puts "utime: #{creation_date.iso8601} #{file}" | |
File.utime(creation_date, creation_date, file, file) | |
end | |
' *.m4v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment