Sha256: 2a1b7ff18ce1f421c2a41fa7dd4f278c4f77a6c7ff2c90a71aef8212dae7c086
Contents?: true
Size: 637 Bytes
Versions: 1
Compression:
Stored size: 637 Bytes
Contents
require 'shellwords' module Audiomator # Options which convert audio to class Options < Struct.new(:start_time, :end_time, :bitrate, :sample_rate, :metadata) def initialize(start_time, end_time, bitrate = '96k', sample_rate = '44100', metadata = {}) super end # see http://multimedia.cx/eggs/supplying-ffmpeg-with-metadata/ for metadata def metadata_string return '' if metadata.empty? metadata.map { |k, v| "-metadata #{k}=#{Shellwords.escape(v)}" }.join(' ') end def to_s "-b:a #{bitrate} -ar #{sample_rate} -ss #{start_time} -to #{end_time} #{metadata_string}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
audiomator-0.3.0 | lib/audiomator/options.rb |