Ruby script to convert Panasonic videos to iPhoto
Just a small Ruby script that converts Panasonic DMC-TZ10 videos to MP4, to import into iPhoto. Keeps the original file's timestamps. Requires ffmpeg (for converting) running on a Mac (for the GetFileInfo and SetFile utilities to maintain timestamps)
def convert_panasonic_video(*files)
files.flatten.each do |file|
original_file = file.gsub(/\s/, "\\ ")
converted_file = original_file.gsub(/\.MTS$/i, ".mp4")
`ffmpeg -y -i #{original_file} -vcodec copy -acodec libfaac #{converted_file}`
timestamp = `GetFileInfo -m #{original_file}`.chomp
`SetFile -d "#{timestamp}" -m "#{timestamp}" #{converted_file}`
end
end
Written by Pedro Rodrigues
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#