Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google Uploader
#!/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
You can’t perform that action at this time.