Created
January 25, 2013 09:17
-
-
Save hisasann/4633024 to your computer and use it in GitHub Desktop.
画像を動画にする
This file contains 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
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