Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
画像を動画にする
class Movie
attr_accessor :image_path
attr_accessor :movie_path
def initialize(image_path="~/", movie_path="~/")
@image_path = image_path
@movie_path = movie_path
end
public
def capture
filename = movie_path + now() + ".avi"
save(filename)
end
private
def save(filename)
command = "ffmpeg -y -f image2 -r 5 -i #{@image_path}#{now()}-%08d.png -s 720x450 #{filename}"
system(command)
end
def now
Time.now.strftime("%Y-%m-%d")
end
end
capture = Movie.new("/Users/hisamatsu/capture/image/", "/Users/hisamatsu/capture/movie/")
capture.capture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment