rqtrotate
Pure ruby library to detect and affect rotation of ISO Base Media Format files such as Apple QuickTime and 3gp.
Credits
The logical core of this library is a port of Daniel G. Taylor’s qtrotate python library(github.com/danielgtaylor/qtrotate). Many, MANY thanks to him!
Usage
Ruby
require 'rubygems'
require 'rqtrotate'
include RQTRotate
# block style
Movie.open(:file_name => ARGV[0]) do |movie|
degrees = movie.rotation
puts "rotation is #{degrees}"
movie.rotation = degrees + 90
end
# stream style
File.open(ARGV[0], File::RDWR) do |f|
movie = Movie.new(f)
degrees = movie.rotation
puts "rotation is #{degrees}"
f.seek(0, IO::SEEK_SET)
movie.rotation = degrees + 90
end
Command Line
# see if a file is rotated
$ qtrotate_get ./test.mov
90
# rotate to 0 degrees
$ qtrotate_set ./test.mov 0
Copyright
Copyright 2011 The Skunkworx.