module Bagel::Video::FFMPEG

Constants

INDEX_VIDEO
LABEL_OVERLAY
LABEL_VIDEO

Public Class Methods

concat(source:, destination:, transcode: false) click to toggle source
# File lib/bagel/video/ffmpeg.rb, line 9
def self.concat(source:, destination:, transcode: false)
  ConcatFile.create(source) do |path|
    command = "ffmpeg -y -f concat -safe 0"
    command << " -i #{path}"
    command << " -c copy" unless transcode
    command << " #{destination}"
    system(command)
  end
end
filter(inputs:, filters:, destination:) click to toggle source
# File lib/bagel/video/ffmpeg.rb, line 29
def self.filter(inputs:, filters:, destination:)
  inputs = inputs.map { |input| "-i #{input} -loop 1" }.join(' ')
  filters = filters.join(';')

  command = "ffmpeg -y"
  command << " #{inputs}"
  command << " -filter_complex \"#{filters}\""
  command << " -c:a copy"
  command << " #{destination}"
  system(command)
end
trim(start:, source:, duration:, transcode: false, destination:) click to toggle source
# File lib/bagel/video/ffmpeg.rb, line 19
def self.trim(start:, source:, duration:, transcode: false, destination:)
  command = "ffmpeg -y"
  command << " -ss #{start}"
  command << " -i #{source}"
  command << " -to #{duration}"
  command << " -c copy" unless transcode
  command << " -avoid_negative_ts make_zero #{destination}"
  system(command)
end