Created
June 13, 2019 05:22
-
-
Save asm/3b43e6de9c4ce99aea9f3e18b0efed57 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. | |
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