Sha256: 848857ba2feb834671e965ba8177da97b931e9a38b8c750daa14ce15b06767a1

Contents?: true

Size: 751 Bytes

Versions: 3

Compression:

Stored size: 751 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
      command = "ffmpeg"
      command += " -pattern_type glob"
      command += " -i '*.jpg'"
      command += " -s #{@size}"
      command += " -r #{@framerate}"
      command += " -vcodec #{@codec}"
      command += " #{@outfile}"
      command
    end

    def create!
      cmd = create_command
      puts cmd
      exec cmd
    end

    def outfile_exists?
      File.exist? @outfile
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tlapse-0.9.0 lib/tlapse/video.rb
tlapse-0.8.0 lib/tlapse/video.rb
tlapse-0.7.0 lib/tlapse/video.rb