lib/abrizer/ffmpeg_processor.rb in abrizer-0.4.0 vs lib/abrizer/ffmpeg_processor.rb in abrizer-0.5.0
- old
+ new
@@ -3,14 +3,14 @@
class FfmpegProcessor
include FilepathHelpers
include DebugSettings
- def initialize(filename, output_dir=nil)
+ def initialize(filename, output_dir)
@filename = filename
@output_directory = output_dir
- @adaptation_finder = Abrizer::AdaptationFinder.new(@filename)
+ @adaptation_finder = Abrizer::AdaptationFinder.new(filepath: @filename)
end
def process
make_directory
Dir.chdir output_directory
@@ -22,11 +22,11 @@
def make_directory
FileUtils.mkdir_p output_directory unless File.exist? output_directory
end
def first_pass_adaptation
- adaptations = Abrizer::AdaptationFinder.new(@filename).adaptations
+ adaptations = Abrizer::AdaptationFinder.new(filepath: @filename).adaptations
sorted = adaptations.sort_by do |adaptation|
adaptation.width
end
sorted[-2]
end
@@ -44,11 +44,11 @@
def process_second_passes
@adaptation_finder.adaptations.each do |adaptation|
cmd = adaptation.ffmpeg_cmd(@filename, output_directory, 2)
puts cmd
`#{cmd}`
- `mp4fragment #{adaptation.filepath(@filename, output_directory)} #{adaptation.filepath_fragmented(@filename, output_directory)}`
- FileUtils.rm adaptation.filepath(@filename, output_directory)
+ `mp4fragment #{adaptation.filepath(output_directory)} #{adaptation.filepath_fragmented(output_directory)}`
+ FileUtils.rm adaptation.filepath(output_directory)
end
end
def process_audio
`ffmpeg -y #{debug_settings} -i #{@filename} -c:a libfdk_aac -b:a 128k -vn #{audio_filepath}`