Skip to content

Instantly share code, notes, and snippets.

@hisasann
Created January 25, 2013 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hisasann/4633024 to your computer and use it in GitHub Desktop.
Save hisasann/4633024 to your computer and use it in GitHub Desktop.
画像を動画にする
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