Sha256: 17a35a5094a6d9b11c4c89e336efdc0d3d6f19665609c6fe9bdf4859a3dc4472

Contents?: true

Size: 765 Bytes

Versions: 5

Compression:

Stored size: 765 Bytes

Contents

module Tlapse
  class Video

    attr_accessor *%i(size framerate codec outfile)

    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

    def create!
      command = "ffmpeg"
      command += " -pattern_type glob"
      command += " -i '*.jpg'"
      command += " -s #{@size}"
      command += " -r #{@framerate}"
      command += " -vcodec #{@codec}"
      command += " #{@outfile}"
      puts command
      exec command
    end

    ##
    # @return whether the output file already exists
    def outfile_exists?
      File.exist? @outfile
    end

  end # Video
end # Tlapse

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tlapse-0.2.1 lib/tlapse/video.rb
tlapse-0.2.0 lib/tlapse/video.rb
tlapse-0.1.2 lib/tlapse/video.rb
tlapse-0.1.1 lib/tlapse/video.rb
tlapse-0.1.0 lib/tlapse/video.rb