-
-
Save carlzulauf/341db0b070977f233f738c46e0fc4d3d to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
# Tool to convert Google motion JPGs (MVIMG) to MP4 video files. | |
# | |
# requires exiftool utility (ie: `apt install exiftool`) | |
# requires exiftool gem (ie: `gem install exiftool`) | |
# | |
require 'exiftool' | |
files = Dir['*.jpg'] | |
files.each do |file| | |
exif = Exiftool.new(file) | |
offset = exif[:micro_video_offset] | |
next unless 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