Sha256: 31ea326f41ffe49b4e1b1e411a8dc0a7faa302b11036cf2e29de6076f4d8729a

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

module Ffmprb

  class Process

    class Input

      # TODO? speed-up/slow-down
      def pace(ratio)
        Paced.new self, pace: ratio
      end

      class Paced < ChainBase

        attr_reader :ratio

        def initialize(unfiltered, pace:)
          super unfiltered
          @ratio = pace
        end

        def filters_for(lbl, video:, audio:)
          fail Error, "pacing requires fps"  unless
            video.fps

          # Pacing

          lbl_aux = "pc#{lbl}"
          super(lbl_aux, video: video, audio: audio) +
            [
              *((video && channel?(:video))? Filter.setpts_framerate(@ratio, video.fps, "#{lbl_aux}:v", "#{lbl}:v"): nil),
              *((audio && channel?(:audio))? Filter.atempo(@ratio, "#{lbl_aux}:a", "#{lbl}:a"): nil)
            ]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffmprb-0.12.3 lib/ffmprb/process/input/paced.rb
ffmprb-0.12.2 lib/ffmprb/process/input/paced.rb