Skip to content

Instantly share code, notes, and snippets.

@asm
Created June 13, 2019 05:22
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save asm/3b43e6de9c4ce99aea9f3e18b0efed57 to your computer and use it in GitHub Desktop.
Save asm/3b43e6de9c4ce99aea9f3e18b0efed57 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Tool to convert Google motion JPGs (MVIMG) to MP4 video files.
require 'exiftool'
files = Dir['*.jpg']
files.each do |file|
exif = Exiftool.new(file)
offset = exif[:micro_video_offset]
file_size = File.new(file).size
start = file_size - offset
out_file = File.basename(file, '.jpg') + '.mp4'
puts "Writing " + out_file
IO.copy_stream(file, out_file, file_size, start)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment