Class: Tlapse::Video
- Inherits:
-
Object
- Object
- Tlapse::Video
- Defined in:
- lib/tlapse/video.rb
Instance Method Summary collapse
- #create! ⇒ Object
- #create_command ⇒ Object
-
#initialize(opts) ⇒ Video
constructor
A new instance of Video.
- #outfile_exists? ⇒ Boolean
Constructor Details
#initialize(opts) ⇒ Video
Returns a new instance of Video.
5 6 7 8 9 10 |
# File 'lib/tlapse/video.rb', line 5 def initialize(opts) @size = opts.fetch :size, "1920x1080" @framerate = opts.fetch :framerate, "60" @codec = opts.fetch :codec, "libx264" @outfile = opts.fetch :out, "out.mkv" end |
Instance Method Details
#create! ⇒ Object
23 24 25 26 27 |
# File 'lib/tlapse/video.rb', line 23 def create! cmd = create_command puts cmd exec cmd end |
#create_command ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tlapse/video.rb', line 12 def create_command command = "ffmpeg" command += " -pattern_type glob" command += " -i '*.jpg'" command += " -s #{@size}" command += " -r #{@framerate}" command += " -vcodec #{@codec}" command += " #{@outfile}" command end |
#outfile_exists? ⇒ Boolean
29 30 31 |
# File 'lib/tlapse/video.rb', line 29 def outfile_exists? File.exist? @outfile end |